/* 
   LEGACY GOVERNMENT DESIGN SYSTEM (ASP.NET ERA)
   Inspired by hienmau.vn / Tuyen Quang Gov portals
*/

:root {
    --bg-header: #dbeaf9;
    --bg-body: #f4f4f4;
    --text-navy: #1e3a8a;
    --border-legacy: #a3c1e8;
    --menu-bg: #2b579a;
    --menu-hover: #1e40af;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Tahoma', 'Arial', sans-serif;
    background-color: #cbd5e1;
    font-size: 13px;
    color: #334155;
}

/* THE BOXED FRAME */
.page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    min-height: 100vh;
    border-left: 1px solid #94a3b8;
    border-right: 1px solid #94a3b8;
    display: flex;
    flex-direction: column;
}

/* HEADER BAR */
.gov-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-legacy);
    padding: 20px 25px;
}

.gov-header-title h1 {
    margin: 0;
    font-size: 26px;
    color: var(--text-navy);
    font-weight: normal; /* Retro titles are often not super bold */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gov-header-title p {
    margin: 5px 0 0 0;
    font-size: 12px;
    color: #64748b;
    font-weight: bold;
}

/* NAVIGATION (Solid Dark Blue) */
.gov-nav {
    background-color: var(--menu-bg);
    height: 40px;
    position: relative;
    z-index: 1000;
}

.gov-nav .container {
    height: 40px;
    padding: 0;
}

.gov-nav a, .nav-item {
    color: #fff !important;
    text-decoration: none !important;
    padding: 0 20px;
    line-height: 40px;
    height: 40px;
    display: inline-block;
    font-weight: bold;
    font-size: 12px;
    border-right: 1px solid rgba(255,255,255,0.1);
    vertical-align: top;
}

.gov-nav a:hover, .gov-nav a.active, .dropdown:hover > .nav-item {
    background-color: var(--menu-hover) !important;
    color: #ffcc00 !important;
}

/* DROPDOWN (Strict Legacy Style) */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 220px;
    border: 1px solid #94a3b8;
    z-index: 2000;
    top: 40px;
    left: 0;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
}

.dropdown-content.force-left {
    left: auto !important;
    right: 0 !important;
}

.dropdown-content a {
    color: #1e293b !important;
    padding: 8px 15px !important;
    display: block !important;
    border-bottom: 1px solid #eee !important;
    line-height: 1.4 !important;
    text-align: left !important;
    height: auto !important;
    font-weight: normal !important;
}

.dropdown-content a:hover {
    background-color: #f1f5f9 !important;
    color: var(--menu-bg) !important;
}

.dropdown:hover .dropdown-content {
    display: block !important;
}

#auth-menu-container {
    position: absolute;
    right: 0;
    top: 0;
    height: 40px;
}

/* CONTENT AREA */
.main-content-area {
    padding: 25px;
    background-color: #fff;
    flex: 1; /* Pushes footer down */
}

/* FOOTER (Simple Bar Style) */
.gov-footer {
    background-color: var(--bg-header);
    border-top: 1px solid var(--border-legacy);
    padding: 30px 25px;
    color: #475569;
    width: 100%;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 30px;
}

.footer-col h4 {
    margin: 0 0 15px 0;
    font-size: 13px;
    color: var(--text-navy);
    border-bottom: 1px solid var(--border-legacy);
    padding-bottom: 5px;
}

.footer-bottom {
    background-color: #e2e8f0;
    padding: 10px 0;
    text-align: center;
    font-size: 11px;
    color: #64748b;
    border-top: 1px solid var(--border-legacy);
    width: 100%;
}

#shared-footer {
    margin-top: auto;
    width: 100%;
}

/* NEWS LIST STYLES (Flat Retro) */
.news-item-horizontal {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px dotted var(--border-legacy);
}

.news-item-horizontal:last-child {
    border-bottom: none;
}

.news-item-img {
    width: 140px;
    height: 90px;
    flex-shrink: 0;
    border: 1px solid var(--border-legacy);
}

.news-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-item-content {
    flex: 1;
}

.news-item-title {
    font-size: 15px;
    font-weight: bold;
    color: var(--text-navy);
    text-decoration: none;
    margin-bottom: 5px;
    display: block;
    line-height: 1.3;
}

.news-item-title:hover {
    color: var(--menu-hover);
    text-decoration: underline;
}

.news-item-summary {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 8px;
}

.news-item-meta {
    font-size: 11px;
    color: #94a3b8;
}

/* SECTION HEADERS */
.box-header {
    background-color: #f1f5f9;
    border-bottom: 1px solid var(--border-legacy);
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-title-retro {
    color: var(--text-navy);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 13px;
    margin: 0;
}

/* ============================================
   RESPONSIVE MOBILE STYLES
   Breakpoint: <= 768px (phones/small tablets)
   ============================================ */

/* Hamburger button (hidden on desktop) */
#mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0 15px;
    height: 40px;
    line-height: 40px;
}

@media (max-width: 768px) {
    /* --- PAGE WRAPPER --- */
    .page-wrapper {
        border: none;
        min-height: auto;
    }

    /* --- GOV HEADER (Branding bar) --- */
    .gov-header {
        padding: 12px 15px !important;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
    }
    .gov-header > div:first-child {
        gap: 10px !important;
    }
    .gov-header-title h1,
    .header-title-main {
        font-size: 16px !important;
    }
    .gov-header-title p,
    .header-subtitle {
        font-size: 10px !important;
    }
    .header-logo-img {
        height: 44px !important;
    }
    /* Hide desktop search in header branding area */
    .header-search-branding {
        display: none !important;
    }

    /* --- NAV (Mobile Hamburger) --- */
    .gov-nav {
        height: auto;
        position: relative;
    }
    .gov-nav .container {
        height: auto;
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 0 !important;
        flex-wrap: wrap;
    }
    /* Show hamburger, hide desktop links (JS handles display:none on nav) */
    #mobile-menu-btn {
        display: block !important;
    }
    /* Mobile open state - full width dropdown */
    #desktop-nav-links.open {
        display: block !important;
        float: none;
        width: 100%;
        background: #1a3068;
        border-top: 1px solid rgba(255,255,255,0.15);
    }
    #desktop-nav-links.open > a,
    #desktop-nav-links.open > .dropdown > .nav-item {
        padding: 12px 20px !important;
        border-right: none !important;
        border-bottom: 1px solid rgba(255,255,255,0.1) !important;
        height: auto !important;
        line-height: 1.5 !important;
        display: block !important;
        text-align: left !important;
    }
    /* Dropdown inside mobile menu */
    #desktop-nav-links.open .dropdown {
        display: block;
        width: 100%;
    }
    #desktop-nav-links.open .dropdown > .nav-item {
        display: block !important;
        width: 100%;
        box-sizing: border-box;
    }
    #desktop-nav-links.open .dropdown-content {
        position: static !important;
        display: none;
        box-shadow: none !important;
        background: #1a2f6f;
        border: none !important;
        width: 100%;
    }
    #desktop-nav-links.open .dropdown.open > .dropdown-content {
        display: block !important;
    }
    #desktop-nav-links.open .dropdown-content a {
        color: rgba(255,255,255,0.85) !important;
        padding-left: 35px !important;
        background: transparent !important;
        border-bottom: 1px solid rgba(255,255,255,0.05) !important;
        font-size: 12px;
        text-align: left !important;
    }

    /* Auth menu & search on mobile (right side of nav bar) */
    #auth-menu-container {
        position: static !important;
        height: 40px;
        display: flex;
        align-items: center;
    }
    .header-search-nav {
        display: none !important; /* hidden — put search in mobile menu instead */
    }
    /* Mobile search (inside hamburger menu) */
    #mobile-search-row {
        display: flex;
        align-items: center;
        padding: 10px 15px;
        background: #1e3a8a;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        gap: 0;
    }
    #mobile-search-row input {
        flex: 1;
        height: 32px;
        border: 1px solid rgba(255,255,255,0.3);
        background: rgba(0,0,0,0.2);
        color: #fff;
        padding: 0 10px;
        font-size: 13px;
        outline: none;
    }
    #mobile-search-row button {
        height: 32px;
        background: #ffcc00;
        border: none;
        color: #1e3a8a;
        padding: 0 14px;
        font-weight: bold;
        font-size: 12px;
        cursor: pointer;
    }

    /* --- MAIN CONTENT --- */
    .main-content-area {
        padding: 12px;
    }

    /* --- 2-COLUMN GRID -> SINGLE COLUMN --- */
    .grid-layout {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    /* --- 3-COLUMN ORG NEWS -> SINGLE COLUMN --- */
    div[style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* --- NEWS ITEMS --- */
    .news-item-horizontal {
        gap: 10px;
        padding: 10px 0;
    }
    .news-item-img {
        width: 100px;
        height: 70px;
    }
    .news-item-title {
        font-size: 13px !important;
    }

    /* --- FOOTER --- */
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    /* --- PAGINATION --- */
    .pagination-container {
        flex-wrap: wrap;
        gap: 5px;
    }
    .page-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* --- BOX-HEADER --- */
    .box-header {
        flex-wrap: wrap;
        gap: 5px;
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .gov-header-title h1,
    .header-title-main {
        font-size: 14px !important;
    }
    .header-logo-img {
        height: 36px !important;
    }
    .news-item-img {
        width: 80px;
        height: 60px;
    }
    .news-item-title {
        font-size: 12px !important;
    }
}
