/* ========================================================
   Citizen Opinion — Layout System
======================================================== */

/* === Header / Navigation === */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    transition: all var(--transition-normal);
}

.header.scrolled {
    box-shadow: var(--shadow-lg);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
}

.logo img {
    height: 44px;
    width: 44px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.logo-text {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    line-height: 1.2;
}

.logo-text span {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    font-weight: var(--font-normal);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    list-style: none;
}

.nav-links a {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.nav-links a.active {
    color: var(--saffron);
    font-weight: var(--font-semibold);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: var(--space-4);
    right: var(--space-4);
    height: 2px;
    background: var(--saffron);
    border-radius: var(--radius-full);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Nav Dropdown — "More" menu */
.nav-dropdown {
    position: relative;
    list-style: none;
    display: flex;
    align-items: center;
    padding-bottom: 8px;
    margin-bottom: -8px;
}

.nav-dropdown-toggle {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    background: none;
    border: none;
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-dropdown-toggle:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% - 4px);
    right: -20px;
    min-width: 220px;
    background: var(--navy-light);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: var(--space-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.97);
    transition: all 0.2s ease;
    z-index: 200;
    list-style: none;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.nav-dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.nav-dropdown-menu li a:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.nav-dropdown-menu li a.active {
    color: var(--saffron);
    background: rgba(232, 136, 48, 0.08);
}

/* Compact Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    padding: 2px;
}

.lang-btn {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: var(--font-semibold);
    color: var(--text-tertiary);
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
    line-height: 1.2;
}

.lang-btn:hover {
    color: var(--text-primary);
}

.lang-btn.active {
    background: var(--saffron);
    color: white;
    box-shadow: 0 1px 4px rgba(232, 136, 48, 0.3);
}

/* Mobile Menu */
.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--radius-md);
}

.menu-toggle:hover {
    background: var(--surface-hover);
}

/* === Main Content === */
.main {
    padding-top: 68px;
    min-height: 100vh;
}

.page-section {
    padding: var(--space-16) 0;
}

.page-section:nth-child(even) {
    background: var(--surface);
}

/* === Hero Section === */
.hero {
    position: relative;
    padding: var(--space-24) 0 var(--space-16);
    overflow: hidden;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 50%, #0E2442 100%);
    color: var(--white);
}

.hero::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(232, 136, 48, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(42, 143, 158, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 10s ease-in-out infinite reverse;
}

.hero-content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
    align-items: center;
}

.hero-text h1 {
    font-size: var(--text-5xl);
    font-weight: var(--font-extrabold);
    line-height: 1.15;
    margin-bottom: var(--space-6);
}

.hero-text h1 .gradient-text {
    background: linear-gradient(135deg, var(--saffron), var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-text .tagline {
    font-size: var(--text-xl);
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: var(--space-8);
    line-height: var(--leading-relaxed);
}

.hero-buttons {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.hero-phone {
    width: 280px;
    height: 560px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 36px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.4), 0 0 40px rgba(232, 136, 48, 0.1);
    position: relative;
}

.hero-phone .phone-notch {
    width: 120px;
    height: 28px;
    background: #000;
    border-radius: 0 0 16px 16px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero-phone .phone-screen {
    padding: var(--space-4);
    height: calc(100% - 28px);
    overflow: hidden;
}

/* === Footer === */
.footer {
    background: var(--navy);
    color: rgba(255, 255, 255, 0.8);
    padding: var(--space-16) 0 var(--space-8);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-12);
    margin-bottom: var(--space-12);
}

.footer-brand .logo-text {
    color: var(--white);
    margin-bottom: var(--space-4);
}

.footer-brand p {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.6);
    line-height: var(--leading-relaxed);
    max-width: 300px;
}

.footer-col h4 {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--white);
    margin-bottom: var(--space-4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: var(--space-3);
}

.footer-col ul li a {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-col ul li a:hover {
    color: var(--saffron);
}

.footer-social {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

.footer-social a {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    transition: all var(--transition-normal);
    font-size: 16px;
}

.footer-social a:hover {
    background: var(--saffron);
    border-color: var(--saffron);
    color: var(--white);
    transform: translateY(-2px);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.4);
}

/* === Two Column Layout === */
.two-col {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--space-8);
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 84px;
}

/* === Feed Layout === */
.feed-container {
    max-width: 700px;
}

.feed-filters {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    overflow-x: auto;
    padding-bottom: var(--space-2);
    -webkit-overflow-scrolling: touch;
}

.feed-filters::-webkit-scrollbar {
    display: none;
}

/* === Page Header === */
.page-header {
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    color: var(--white);
    padding: calc(68px + var(--space-12)) 0 var(--space-12);
    text-align: center;
}

.page-header h1 {
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-2);
}

.page-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--text-lg);
}

/* === Mobile Responsive === */
@media (max-width: 1024px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-visual {
        display: none;
    }

    .hero-text h1 {
        font-size: var(--text-4xl);
    }

    .hero-buttons {
        justify-content: center;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .two-col {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --text-5xl: 2.25rem;
        --text-4xl: 1.875rem;
        --text-3xl: 1.5rem;
    }

    .nav-links {
        display: none;
    }

    .menu-toggle {
        display: flex;
        order: 10;
    }

    /* Mobile nav open */
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--surface);
        padding: var(--space-6);
        gap: var(--space-1);
        z-index: var(--z-modal);
        animation: slideDown 0.3s ease-out;
        overflow-y: auto;
    }

    .nav-links.open a,
    .nav-links.open .nav-dropdown-toggle {
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-base);
        border-radius: var(--radius-md);
        display: block;
        width: 100%;
        text-align: left;
    }

    /* Flatten dropdown on mobile — show items inline */
    .nav-links.open .nav-dropdown {
        display: contents;
    }

    .nav-links.open .nav-dropdown-toggle {
        display: none;
    }

    .nav-links.open .nav-dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: none;
        border: none;
        box-shadow: none;
        padding: 0;
        min-width: 0;
        display: contents;
    }

    .nav-links.open .nav-dropdown-menu li a {
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-base);
    }

    /* Show language switcher inside mobile nav */
    .nav-links.open::after {
        content: '';
        display: block;
        height: 1px;
        background: var(--border-light);
        margin: var(--space-3) 0;
    }

    .header-inner {
        height: 56px;
        padding: 0 var(--space-3);
        gap: var(--space-2);
        max-width: 100vw;
        overflow: hidden;
    }

    .main {
        padding-top: 56px;
    }

    /* Hide language switcher on mobile */
    .lang-switcher {
        display: none !important;
    }

    /* On mobile: hide everything in header-actions except theme + menu */
    .header-actions {
        gap: 4px;
        flex-shrink: 0;
        margin-left: auto;
    }

    /* Hide all dynamically injected items */
    .header-actions .search-wrapper,
    .header-actions .notif-wrapper,
    .header-actions a[href="settings.html"],
    .header-actions .btn-primary,
    .header-actions .btn-sm {
        display: none !important;
    }

    /* Compact remaining buttons */
    .header-actions .theme-toggle {
        font-size: 16px;
        padding: 4px;
        width: 32px;
        height: 32px;
    }

    /* Shrink logo */
    .logo img {
        height: 32px;
        width: 32px;
    }

    .logo-text {
        font-size: var(--text-sm);
        font-weight: var(--font-bold);
    }

    /* Hide subtitle on mobile */
    .logo-text span {
        display: none;
    }

    .hero {
        padding: var(--space-16) 0 var(--space-12);
    }

    .page-section {
        padding: var(--space-10) 0;
    }

    .page-header {
        padding: calc(56px + var(--space-10)) 0 var(--space-10);
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--space-3);
        text-align: center;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 var(--space-4);
    }

    .card {
        padding: var(--space-4);
    }

    .feature-card {
        padding: var(--space-6);
    }

    .section-title {
        font-size: var(--text-2xl);
    }

    .stat-item {
        padding: var(--space-3);
    }

    .stat-number {
        font-size: var(--text-2xl);
    }
}

@media (max-width: 480px) {
    .hero-text h1 {
        font-size: var(--text-3xl);
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    .vote-actions {
        flex-wrap: wrap;
    }
}