/* ============================================================
   Idiripela News — Stylesheet
   Colors: Navy #1B3A6B | Gold #C8952A | Light #F4F6FA
   ============================================================ */

:root {
    --navy:       #1B3A6B;
    --navy-dark:  #122951;
    --navy-light: #2a5298;
    --gold:       #C8952A;
    --gold-light: #e0aa44;
    --bg-light:   #F4F6FA;
    --text-dark:  #1a1a2e;
    --text-muted: #6c757d;
    --white:      #ffffff;
    --border:     #dee2e6;
    --font-main:  'Inter', sans-serif;
    --font-si:    'Noto Sans Sinhala', sans-serif;
}

/* Base */
* { box-sizing: border-box; }

body {
    font-family: var(--font-main);
    color: var(--text-dark);
    background: var(--bg-light);
    font-size: 1rem;
    line-height: 1.7;
}

body.lang-si,
body.lang-si p,
body.lang-si h1,
body.lang-si h2,
body.lang-si h3,
body.lang-si h4,
body.lang-si h5,
body.lang-si h6,
body.lang-si .nav-link,
body.lang-si .btn,
body.lang-si .card-title,
body.lang-si .card-text {
    font-family: var(--font-si);
}

a { color: var(--navy); text-decoration: none; transition: color .2s; }
a:hover { color: var(--gold); }
img { max-width: 100%; }

/* ── Top Bar ───────────────────────────────────────────────── */
.topbar {
    background: var(--navy-dark);
    color: #cdd8ec;
    padding: 6px 0;
    font-size: .82rem;
}
.topbar a { color: #cdd8ec; }
.topbar a:hover { color: var(--gold-light); }

.lang-switch-btn {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: .8rem;
    transition: background .2s;
}
.lang-switch-btn:hover { background: var(--gold); color: var(--white) !important; }

/* ── Navbar ────────────────────────────────────────────────── */
#mainNav {
    background: var(--white);
    box-shadow: 0 2px 12px rgba(27,58,107,.1);
    padding: 0;
}

.navbar-brand img { height: 46px; }
.brand-text {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--navy);
    line-height: 1.2;
}
.brand-sub {
    font-size: .72rem;
    color: var(--text-muted);
    line-height: 1;
}
.navbar-nav .nav-link {
    color: var(--text-dark);
    font-weight: 500;
    padding: 1.1rem .75rem;
    position: relative;
}
.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0; left: .75rem; right: .75rem;
    height: 3px;
    background: var(--gold);
    transform: scaleX(0);
    transition: transform .2s;
}
.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after { transform: scaleX(1); }
.navbar-nav .nav-link.active { color: var(--navy); }

#mainNav.scrolled { box-shadow: 0 4px 20px rgba(27,58,107,.15); }

.btn-gold {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--white);
}
.btn-gold:hover {
    background: var(--gold-light);
    border-color: var(--gold-light);
    color: var(--white);
}

/* ── Breaking News Ticker ──────────────────────────────────── */
.breaking-ticker {
    background: var(--gold);
    color: var(--white);
    padding: 7px 0;
    overflow: hidden;
    font-size: .9rem;
    font-weight: 600;
}
.breaking-label {
    background: var(--navy);
    padding: 2px 14px;
    border-radius: 3px;
    white-space: nowrap;
    font-size: .82rem;
    letter-spacing: .04em;
    margin-right: 12px;
}
.ticker-wrap { overflow: hidden; flex: 1; }
.ticker-items {
    display: flex;
    gap: 60px;
    animation: ticker 15s linear infinite;
    white-space: nowrap;
}
.ticker-items a {
    color: var(--white);
    text-decoration: none;
}
.ticker-items a:hover { text-decoration: underline; }
@keyframes ticker {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ── Hero / Featured ───────────────────────────────────────── */
.featured-hero {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    background: var(--navy);
}
.featured-hero img {
    width: 100%;
    height: 440px;
    object-fit: cover;
    opacity: .75;
    display: block;
}
.featured-hero .hero-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,.85));
    padding: 40px 28px 28px;
    color: var(--white);
}
.featured-hero .hero-overlay h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}
.featured-hero .hero-overlay h2 a {
    color: var(--white);
}
.featured-hero .hero-overlay h2 a:hover { color: var(--gold-light); }

/* ── News Cards ────────────────────────────────────────────── */
.news-card {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(27,58,107,.08);
    transition: transform .2s, box-shadow .2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(27,58,107,.15);
}
.news-card .card-img-top {
    height: 200px;
    object-fit: cover;
    width: 100%;
}
.news-card .card-body {
    padding: 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.news-card .card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 8px;
    line-height: 1.4;
}
.news-card .card-title a { color: inherit; }
.news-card .card-title a:hover { color: var(--gold); }
.news-card .card-text {
    font-size: .88rem;
    color: var(--text-muted);
    flex: 1;
}
.news-card .card-footer-meta {
    font-size: .78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 10px;
}

/* ── Compact List Card ─────────────────────────────────────── */
.list-news-item {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.list-news-item:last-child { border-bottom: none; }
.list-news-item img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.list-news-item .item-body { flex: 1; }
.list-news-item .item-title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.3;
    margin-bottom: 4px;
}
.list-news-item .item-title a { color: inherit; }
.list-news-item .item-title a:hover { color: var(--gold); }
.list-news-item .item-meta { font-size: .75rem; color: var(--text-muted); }

/* ── Badges ────────────────────────────────────────────────── */
.badge-cat {
    background: var(--navy);
    color: var(--white);
    font-size: .72rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 500;
    display: inline-block;
}
.badge-breaking {
    background: #dc3545;
    color: var(--white);
    font-size: .72rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    display: inline-block;
}
.badge-press {
    background: var(--gold);
    color: var(--white);
    font-size: .72rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    display: inline-block;
}

/* ── Section Titles ────────────────────────────────────────── */
.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--navy);
    padding-bottom: 10px;
    border-bottom: 3px solid var(--gold);
    margin-bottom: 20px;
    display: inline-block;
}

/* ── Single Article Page ───────────────────────────────────── */
.article-header { padding: 32px 0 20px; }
.article-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.3;
}
.article-meta {
    font-size: .85rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin: 12px 0;
}
.article-featured-img {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 28px;
}
.article-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text-dark);
}
.article-content p { margin-bottom: 1.2rem; }
.article-content h2, .article-content h3 {
    color: var(--navy);
    margin: 2rem 0 1rem;
}

.share-bar {
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin: 28px 0;
}
.share-bar a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 6px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--white);
    margin-right: 8px;
    transition: opacity .2s;
}
.share-bar a:hover { opacity: .85; color: var(--white); }
.share-fb { background: #1877F2; }
.share-x  { background: #000; }
.share-wa { background: #25D366; }
.share-li { background: #0A66C2; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar-widget {
    background: var(--white);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(27,58,107,.07);
    margin-bottom: 24px;
}
.sidebar-widget-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
    border-bottom: 2px solid var(--gold);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

/* ── Category Page ─────────────────────────────────────────── */
.cat-card {
    background: var(--white);
    border-radius: 10px;
    padding: 24px 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(27,58,107,.08);
    transition: transform .2s, box-shadow .2s;
    text-decoration: none;
    color: var(--text-dark);
    display: block;
}
.cat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(27,58,107,.15);
    color: var(--navy);
}
.cat-card .cat-icon {
    font-size: 2.2rem;
    color: var(--gold);
    margin-bottom: 12px;
}
.cat-card h5 { font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.cat-card .cat-count { font-size: .85rem; color: var(--text-muted); }

/* ── Admin Sidebar ─────────────────────────────────────────── */
.admin-wrapper { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 260px;
    background: var(--navy);
    color: var(--white);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.admin-sidebar .sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.admin-sidebar .sidebar-brand .brand-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--white);
    line-height: 1.2;
}
.admin-sidebar .sidebar-brand .brand-sub {
    font-size: .72rem;
    color: rgba(255,255,255,.55);
}
.admin-sidebar .sidebar-brand img { height: 38px; }
.sidebar-nav { padding: 12px 0; }
.sidebar-nav .nav-label {
    font-size: .7rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.4);
    padding: 14px 20px 6px;
}
.sidebar-nav .nav-link {
    color: rgba(255,255,255,.75);
    padding: 10px 20px;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .92rem;
    transition: background .15s, color .15s;
}
.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: rgba(255,255,255,.1);
    color: var(--white);
}
.sidebar-nav .nav-link.active {
    border-left: 3px solid var(--gold);
}
.sidebar-nav .nav-link i { width: 18px; text-align: center; }

.admin-content { flex: 1; background: var(--bg-light); padding: 28px; overflow-y: auto; }
.admin-topbar {
    background: var(--white);
    padding: 12px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -28px -28px 28px;
}
.admin-topbar h5 { margin: 0; font-weight: 700; color: var(--navy); }

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-card {
    background: var(--white);
    border-radius: 10px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 10px rgba(27,58,107,.07);
}
.stat-card .stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-card .stat-value { font-size: 1.9rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-card .stat-label { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }

/* ── Login Page ────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 60%, var(--navy-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.login-box {
    background: var(--white);
    border-radius: 14px;
    padding: 44px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-box .login-logo { text-align: center; margin-bottom: 24px; }
.login-box .login-logo img { height: 60px; }
.login-box h3 { text-align: center; color: var(--navy); font-weight: 700; margin-bottom: 28px; }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
    background: var(--navy-dark);
    color: rgba(255,255,255,.7);
    padding: 52px 0 0;
    margin-top: 60px;
}
.footer-brand { font-weight: 700; font-size: 1rem; color: var(--white); line-height: 1.2; }
.footer-tagline { font-size: .72rem; color: rgba(255,255,255,.5); }
.footer-heading { color: var(--gold); font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; }
.footer-links li { margin-bottom: 6px; }
.footer-links a { color: rgba(255,255,255,.6); font-size: .88rem; }
.footer-links a:hover { color: var(--gold-light); }
.footer-divider { border-color: rgba(255,255,255,.1); margin: 32px 0 20px; }
.site-footer .text-muted { color: rgba(255,255,255,.4) !important; }
.site-footer small { padding-bottom: 20px; display: inline-block; }

.social-links { display: flex; gap: 10px; }
.social-links a {
    width: 36px; height: 36px;
    background: rgba(255,255,255,.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.7);
    transition: background .2s, color .2s;
    font-size: .9rem;
}
.social-links a:hover { background: var(--gold); color: var(--white); }

/* ── Pagination ────────────────────────────────────────────── */
.page-link { color: var(--navy); }
.page-item.active .page-link { background: var(--navy); border-color: var(--navy); }
.page-link:hover { color: var(--gold); }

/* ── Alerts ────────────────────────────────────────────────── */
.alert { border-radius: 8px; }

/* ── Responsive ────────────────────────────────────────────── */

/* Tablet (≤992px) */
@media (max-width: 991.98px) {
    /* Admin */
    .admin-sidebar { width: 100%; height: auto; position: relative; }
    .admin-wrapper { flex-direction: column; }
    .admin-content { padding: 20px; }
    .admin-topbar { margin: -20px -20px 20px; padding: 12px 20px; }

    /* Navbar collapse */
    .navbar-collapse { border-top: 1px solid var(--border); padding: .5rem 0; }
    .navbar-nav .nav-link { padding: .75rem 1rem; }
    .navbar-nav .nav-link::after { display: none; }
    .navbar-nav .nav-link.active { background: var(--bg-light); border-radius: 6px; }

    /* Search in collapsed nav gets full width */
    .navbar-nav .input-group { width: 100%; margin: .5rem 1rem; width: calc(100% - 2rem); }

    /* Featured hero */
    .featured-hero img { height: 280px; }
    .featured-hero .hero-overlay { padding: 24px 18px 18px; }
    .featured-hero .hero-overlay h2 { font-size: 1.2rem; }

    /* Sidebar shows below on md — add top margin */
    .col-lg-4 { margin-top: 0; }
}

/* Mobile (≤768px) */
@media (max-width: 767.98px) {
    /* Topbar */
    .topbar .container { flex-wrap: nowrap; gap: .25rem; }
    .topbar small { font-size: 0; } /* hide "main site" text, keep arrow icon */
    .topbar small a i { font-size: .8rem; }
    .topbar .d-flex.gap-3 { gap: .4rem !important; }
    .lang-switch-btn { padding: 2px 8px; font-size: .75rem; }
    .topbar a { font-size: .8rem; }

    /* Navbar */
    .navbar-brand img { height: 38px; }
    .brand-text { font-size: 1rem; }
    .brand-sub { display: none; }

    /* Breaking ticker: tighter on mobile */
    .breaking-ticker { padding: 5px 0; font-size: .82rem; }
    .breaking-label { padding: 2px 10px; font-size: .75rem; margin-right: 8px; }

    /* Featured hero */
    .featured-hero img { height: 220px; }
    .featured-hero .hero-overlay h2 { font-size: 1.05rem; line-height: 1.3; }

    /* News cards: improve for 2-column grid */
    .news-card .card-img-top { height: 160px; }
    .news-card .card-body { padding: 14px; }
    .news-card .card-title { font-size: .92rem; }

    /* Article page */
    .article-header h1 { font-size: 1.5rem; }
    .article-meta { gap: 10px; font-size: .8rem; }
    .article-featured-img { max-height: 280px; }
    .article-content { font-size: 1rem; line-height: 1.8; }

    /* Share bar: wrap buttons */
    .share-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
    .share-bar a { margin-right: 0; flex: 0 0 auto; padding: 6px 12px; font-size: .8rem; }

    /* Sidebar widgets */
    .sidebar-widget { padding: 16px; }

    /* Footer */
    .site-footer { padding: 32px 0 0; margin-top: 40px; }

    /* Touch targets */
    .btn, .nav-link, .page-link { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
    .page-link { padding: .5rem .85rem; }
    input, button, select, textarea { min-height: 44px; }

    /* Login */
    .login-box { padding: 32px 24px; }
}

/* Small phones (≤575px) */
@media (max-width: 575.98px) {
    /* News cards: single column */
    .col-md-6 { flex: 0 0 100%; max-width: 100%; }

    /* Topbar: ultra-compact */
    .topbar { font-size: .75rem; }

    /* Featured hero */
    .featured-hero img { height: 180px; }
    .featured-hero .hero-overlay { padding: 16px 14px 14px; }
    .featured-hero .hero-overlay h2 { font-size: .95rem; }

    /* Article */
    .article-header h1 { font-size: 1.3rem; }
    .article-content { font-size: .95rem; }

    /* Share bar: 2-column grid on very small screens */
    .share-bar a { flex: 1 1 calc(50% - 4px); text-align: center; }

    /* Category cards: 2-column */
    .col-lg-3.col-md-4 { flex: 0 0 50%; max-width: 50%; }
    .cat-card { padding: 18px 12px; }
    .cat-card .cat-icon { font-size: 1.8rem; }

    /* Login */
    .login-box { padding: 24px 16px; }
    .login-box h3 { font-size: 1.2rem; }

    /* Sidebar list items */
    .list-news-item img { width: 64px; height: 48px; }

    /* Admin */
    .admin-content { padding: 14px; }
    .admin-topbar { padding: 10px 14px; margin: -14px -14px 14px; }
    .stat-card { padding: 14px; }
    .stat-card .stat-value { font-size: 1.5rem; }
}
