/* ===== PERFORMANCE OPTIMIZATION ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    max-width: 100vw;
}

/* Wrapping all content to prevent horizontal scroll instead of root body */
.site-wrapper {
    overflow-x: clip;
    width: 100%;
}

/* ===== CSS VARIABLES FOR THEMING ===== */
:root[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --accent-primary: #2563eb;
    --accent-secondary: #3b82f6;
    --border-color: #e5e7eb;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.12);
}

:root[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    /* Solid color for Hard Colour look */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --border-color: #334155;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ===== BASE STYLES ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: transparent;
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== HEADER ===== */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: auto;
    width: 75px;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    margin-left: auto;
}

/* Force right-side controls to always be visible */
.site-header .header-right,
.site-header .header-controls,
.header-container .header-actions,
.header-container .nav-controls {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Prevent long nav text from pushing out right side */
.site-header .main-nav,
.site-header .nav-links,
.header-container .header-links {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}

.site-header .main-nav a,
.site-header .nav-links a,
.header-container .header-links a {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Brand + nav item spacing */
.logo-section,
.site-header .header-brand-nav,
.site-header .header-left,
.header-container .brand-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.site-brand,
.logo-link,
.brand-link,
.logo-section .site-title {
    margin-right: 0;
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--accent-primary);
    color: white;
}

/* ===== HERO SECTION ===== */
.hero {
    background: transparent;
    padding: 4rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Optional subtle overlay for better text readability */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 0;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    color: white;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    word-wrap: break-word;
}

.hero p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 2rem;
}

/* ===== SEARCH & FILTER SECTION ===== */
.search-filter-section {
    background-color: var(--bg-card) !important;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    position: -webkit-sticky;
    position: sticky;
    top: 90px;
    /* Measured height of compact header on desktop */
    z-index: 995;
}

@media (max-width: 768px) {
    .search-filter-section {
        top: 83px;
        /* Matches exactly the height of the ultra-slim mobile header */
        padding: 1rem;
    }
}

.search-filter-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 100px;
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.search-box input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1rem;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box button {
    padding: 0.75rem 1.5rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.search-box button:hover {
    background: var(--accent-secondary);
}

.category-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .category-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .category-filters::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* ===== MAIN CONTENT ===== */
.main-container {
    max-width: 1400px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
}

/* ===== FEATURED ARTICLE ===== */
.featured-article {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    transition: all 0.3s;
}

.featured-article:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.featured-thumbnail {
    width: 100%;
    height: 300px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.featured-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--accent-primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    z-index: 2;
    pointer-events: none;
    /* Don't block clicks */
}

/* Make featured thumbnail link clickable */
.featured-thumbnail a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* Make featured title link clickable and preserve styling */
.featured-content a {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

.featured-content a:hover {
    opacity: 0.8;
}

.featured-content {
    padding: 2rem;
}

.featured-category {
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.featured-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.featured-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.read-more-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: var(--accent-primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
}

.read-more-btn:hover {
    background: var(--accent-secondary);
    transform: translateX(4px);
}

/* ===== ARTICLES GRID ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.article-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
    .article-card:hover {
        box-shadow: var(--shadow-hover);
        transform: translateY(-4px);
    }
}

.article-thumbnail {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-body {
    padding: 1.25rem;
}

.article-category {
    color: var(--accent-primary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.article-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.article-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.article-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: gap 0.3s;
}

.article-link:hover {
    gap: 0.5rem;
}

/* ===== SIDEBAR ===== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-widget {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.widget-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.category-list {
    list-style: none;
}

.category-list li {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
}

@media (hover: hover) and (pointer: fine) {
    .category-list li:hover {
        background: var(--bg-secondary);
        padding-left: 1rem;
    }
}

.category-list li:last-child {
    border-bottom: none;
}

.category-name {
    color: var(--text-primary);
    font-weight: 500;
}

.category-count {
    background: var(--accent-primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }

    /* Target sidebar explicitly: keep articles first by NOT using order: -1 */
    .sidebar {
        margin-top: 2rem;
    }

    .articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .header {
        height: 83px;
        box-sizing: border-box;
    }

    .header-container {
        flex-direction: row;
        justify-content: space-between;
        gap: 0.25rem;
        padding: 0.25rem 1rem;
        /* Quartered top/bottom padding for ultra-slim height */
        width: 100%;
        box-sizing: border-box;
    }

    .logo {
        max-width: 75px;
        /* Further reduced logo size on mobile */
        height: auto;
    }

    .site-title {
        display: none;
        /* Logo already has the text on mobile */
    }

    .theme-text {
        display: none;
        /* Just show icon */
    }

    .theme-toggle {
        padding: 0.5rem;
        /* Tighter padding for icon-only */
    }

    .header-actions {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        flex-shrink: 0 !important;
        margin-left: auto !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Ensure theme toggle never disappears on mobile */
    .theme-toggle,
    #themeToggle {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .hero {
        padding: 3rem 1.5rem;
        width: 100%;
        box-sizing: border-box;
    }

    .search-filter-container {
        flex-direction: column;
        width: 100%;
        box-sizing: border-box;
    }

    .search-box {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .main-container {
        padding: 0 1rem;
        width: 100%;
        box-sizing: border-box;
    }

    .articles-grid {
        grid-template-columns: 1fr;
        width: 100%;
        box-sizing: border-box;
    }

    .featured-thumbnail {
        height: 200px;
    }
}

/* ===== LOADING ANIMATION ===== */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== NO RESULTS ===== */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.no-results.hidden {
    display: none;
}

.article-container {
    max-width: 800px;
    width: 100%;
    margin: 2rem auto;
    padding: 3rem;
    background-color: var(--bg-card);
    /* Dark blue sheet in dark mode */
    border-radius: 12px;
    box-shadow: var(--shadow);
    color: var(--text-primary);
    position: relative;
    z-index: 10;
}

@media (max-width: 768px) {
    .article-container {
        padding: 1.5rem;
        margin: 1rem auto;
        border-radius: 8px;
        max-width: 100%;
        box-sizing: border-box;
    }
}

.article-content {
    line-height: 1.8;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .article-content {
        font-size: 1.05rem;
    }
}

/* ===== CUSTOM CURSOR ===== */
@media (hover: hover) and (pointer: fine) {
    body {
        cursor: none;
    }

    a,
    button,
    input,
    textarea,
    select,
    .clickable {
        cursor: none;
    }

    .custom-cursor {
        position: fixed;
        top: -100px;
        left: -100px;
        width: 20px;
        height: 20px;
        border: 2px solid var(--accent-primary);
        border-radius: 50%;
        transform: translate(-50%, -50%);
        pointer-events: none;
        z-index: 9999;
        transition: width 0.2s, height 0.2s, background-color 0.2s;
        mix-blend-mode: difference;
    }

    .custom-cursor.clicking {
        width: 15px;
        height: 15px;
        background-color: var(--accent-secondary);
        border-color: transparent;
    }

    .custom-cursor.hovering {
        width: 40px;
        height: 40px;
        background-color: rgba(59, 130, 246, 0.1);
        border-color: var(--accent-secondary);
        border-width: 1px;
    }

    .cursor-trail {
        position: fixed;
        width: 8px;
        height: 8px;
        background-color: var(--accent-primary);
        border-radius: 50%;
        pointer-events: none;
        transform: translate(-50%, -50%);
        z-index: 9998;
        mix-blend-mode: screen;
        transition: opacity 0.1s;
    }
}

/* ===== HAMBURGER MENU ===== */
.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 250px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    padding: 2rem;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-close {
    align-self: flex-end;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

.mobile-menu a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Base styles adjustments for header links */
.header-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.header-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.header-links a:hover {
    color: var(--accent-primary);
}

@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .header-links {
        display: none;
    }
}

/* ===== TABLE STYLES ===== */
.article-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    margin: 2.5rem 0;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.article-content thead {
    background-color: rgba(59, 130, 246, 0.1);
    border-bottom: 2px solid var(--accent-primary);
}

.article-content th,
.article-content td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.article-content th {
    font-weight: 700;
    color: var(--accent-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
    white-space: nowrap;
}

.article-content td {
    color: var(--text-primary);
}

.article-content tbody tr {
    transition: background-color 0.2s ease;
}

.article-content tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

:root[data-theme="light"] .article-content tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* ===== DROPDOWN LANGUAGE SWITCHER ===== */
.lang-switcher-wrapper {
    position: relative;
    display: inline-block;
}

.lang-switcher-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
}

.lang-switcher-toggle:hover {
    background: rgba(148, 163, 184, 0.1);
    border-color: var(--accent-primary);
}

.lang-switcher-toggle .lang-flag {
    font-size: 1.1rem;
}

.lang-switcher-toggle .lang-code {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.lang-switcher-toggle .lang-chevron {
    transition: transform 0.2s;
    opacity: 0.7;
}

.lang-switcher-wrapper.open .lang-chevron {
    transform: rotate(180deg);
}

.lang-switcher-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem;
    min-width: 180px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 2000;
}

.lang-switcher-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-switcher-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.lang-switcher-option:hover {
    background: rgba(148, 163, 184, 0.1);
}

.lang-switcher-option[aria-selected="true"] {
    color: var(--accent-primary);
    font-weight: 600;
}

.lang-switcher-option .lang-flag {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
}

.lang-switcher-option .lang-name {
    flex: 1;
}

.lang-switcher-option .lang-check {
    color: var(--accent-primary);
    font-weight: 700;
}

/* ===== LANGUAGE MODAL ===== */
.lang-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lang-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lang-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.lang-modal-overlay.active .lang-modal {
    transform: translateY(0);
}

.lang-modal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.lang-modal h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.lang-modal p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.lang-modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.lang-modal-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.lang-modal-btn.primary {
    background: var(--accent-primary);
    color: white;
}

.lang-modal-btn.primary:hover {
    background: var(--accent-secondary);
}

.lang-modal-btn.secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.lang-modal-btn.secondary:hover {
    background: var(--bg-secondary);
}
/* ===== MOBILE LANGUAGE SWITCHER FIXES ===== */
@media (max-width: 768px) {
    /* 1. Toggle button — larger touch target */
    .lang-switcher-toggle {
        padding: 10px 14px !important;
        font-size: 14px !important;
        min-height: 44px !important;
        min-width: 72px !important;
        gap: 6px !important;
        border-radius: 10px !important;
        background: #1e293b !important;
        border: 1px solid #334155 !important;
        color: #f1f5f9 !important;
        -webkit-tap-highlight-color: transparent;
    }

    .lang-switcher-toggle .lang-flag {
        font-size: 1.15rem !important;
    }

    .lang-switcher-toggle .lang-code {
        font-size: 0.85rem !important;
    }

    .lang-switcher-toggle .lang-chevron {
        width: 14px !important;
        height: 14px !important;
    }

    /* 2. Dropdown menu — FULLY OPAQUE, fixed, highest specificity */
    html body .lang-switcher-wrapper .lang-switcher-menu,
    html body .lang-switcher-wrapper .lang-switcher-menu.open {
        position: fixed !important;
        top: 64px !important;
        left: 12px !important;
        right: 12px !important;
        max-width: none !important;
        min-width: auto !important;
        width: auto !important;
        background: #0f172a !important;
        background-color: #0f172a !important;
        border: 1px solid #334155 !important;
        border-radius: 14px !important;
        padding: 8px !important;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6) !important;
        z-index: 9999 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transform: translateY(-10px) scale(0.96) !important;
        transition: all 0.2s ease !important;
    }

    html body .lang-switcher-wrapper .lang-switcher-menu.open {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) scale(1) !important;
    }

    /* 3. Language options — big touch targets, NO blue underline, explicit a-tag styling */
    html body .lang-switcher-wrapper .lang-switcher-menu a.lang-switcher-option,
    html body .lang-switcher-wrapper .lang-switcher-menu a.lang-switcher-option:link,
    html body .lang-switcher-wrapper .lang-switcher-menu a.lang-switcher-option:visited {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        padding: 14px 16px !important;
        border-radius: 10px !important;
        color: #f1f5f9 !important;
        text-decoration: none !important;
        font-size: 15px !important;
        min-height: 48px !important;
        -webkit-tap-highlight-color: transparent;
        position: relative !important;
        z-index: 10000 !important;
        background: transparent !important;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
        cursor: pointer !important;
    }

    html body .lang-switcher-wrapper .lang-switcher-menu a.lang-switcher-option:hover,
    html body .lang-switcher-wrapper .lang-switcher-menu a.lang-switcher-option:active {
        background: rgba(148, 163, 184, 0.15) !important;
        color: #f1f5f9 !important;
        text-decoration: none !important;
    }

    html body .lang-switcher-wrapper .lang-switcher-menu a.lang-switcher-option .lang-flag {
        font-size: 1.3rem !important;
        width: 28px !important;
        text-align: center !important;
        flex-shrink: 0 !important;
    }

    html body .lang-switcher-wrapper .lang-switcher-menu a.lang-switcher-option .lang-name {
        flex: 1 !important;
        font-weight: 500 !important;
        color: #f1f5f9 !important;
    }

    html body .lang-switcher-wrapper .lang-switcher-menu a.lang-switcher-option .lang-check {
        font-size: 1rem !important;
        color: #3b82f6 !important;
        font-weight: 700 !important;
        flex-shrink: 0 !important;
    }

    /* 4. Make sure header-actions don't wrap weirdly */
    .header-actions {
        gap: 0.5rem !important;
    }
}

/* ============================================
   MOBILE HEADER REORDER: Hamburger → Far Right
   ============================================ */

@media (max-width: 768px) {
  /* Move hamburger button to the far right of header-actions */
  .hamburger,
  #hamburgerMenu {
    order: 999 !important;
    margin-left: auto !important;
  }

  /* Ensure language switcher stays before hamburger */
  #language-switcher-container,
  .lang-switcher-wrapper {
    order: 1 !important;
  }

  /* Ensure theme toggle stays before hamburger */
  #themeToggle,
  .theme-toggle {
    order: 2 !important;
  }
}

/* ===== DRAG-AND-DROP IMAGE UPLOAD ===== */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    background: var(--bg-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.upload-zone:hover {
    border-color: var(--accent-secondary);
    background: color-mix(in srgb, var(--accent-primary) 5%, var(--bg-secondary));
}

.upload-zone.drag-over {
    border-color: var(--accent-secondary);
    background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-secondary));
    transform: scale(1.01);
}

.upload-zone-content {
    pointer-events: none;
}

.upload-icon {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.upload-text {
    color: var(--text-primary);
    font-size: 14px;
    margin: 0 0 8px;
    line-height: 1.5;
}

.upload-bold {
    font-weight: 600;
    color: var(--text-primary);
}

.upload-link {
    color: var(--accent-secondary);
    cursor: pointer;
    text-decoration: underline;
    pointer-events: auto;
}

.upload-link:hover {
    color: var(--accent-primary);
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 12px;
    margin: 0;
}

.upload-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 8px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.upload-preview img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.preview-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.preview-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-size {
    color: var(--text-secondary);
    font-size: 12px;
}

.preview-remove {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}

.preview-remove:hover {
    background: rgba(239, 68, 68, 0.2);
}

@media (max-width: 768px) {
    .upload-zone {
        padding: 24px 16px;
    }

    .upload-preview img {
        width: 48px;
        height: 48px;
    }
}


/* ===== FOOTER ENHANCEMENTS ===== */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 3rem 2rem 2rem;
    margin-top: 4rem;
    position: relative;
    z-index: 10;
}

.site-footer .footer-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
}

.site-footer .footer-heading {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.site-footer p {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.9rem;
}

.site-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

.site-footer .footer-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.site-footer .footer-links-list li {
    margin-bottom: 0.5rem;
}

.site-footer .footer-links-list a {
    color: var(--text-secondary);
    text-decoration: none;
}

.site-footer .footer-links-list a:hover {
    color: var(--accent-primary);
}

.site-footer .footer-bottom {
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
    padding-top: 2rem;
    text-align: center;
}

.site-footer .footer-bottom p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== COOKIE CONSENT BANNER ===== */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] .cookie-banner {
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.cookie-banner p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    flex: 1;
    line-height: 1.5;
}

.cookie-banner a {
    color: var(--accent-primary);
    text-decoration: underline;
}

.cookie-banner a:hover {
    color: var(--accent-secondary);
}

.cookie-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cookie-btn-primary {
    background: var(--accent-primary);
    color: #ffffff;
}

.cookie-btn-primary:hover {
    background: var(--accent-secondary);
}

.cookie-btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.cookie-btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

/* ===== STATIC PAGE CONTENT (About, Contact, Cookie Policy, Privacy, Terms) ===== */
.legal-page {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.legal-container {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-top: 2rem;
    max-width: 800px;
    width: 100%;
    border: 1px solid var(--border-color);
}

.legal-container h1 {
    color: var(--text-primary);
    font-size: 2.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.legal-container h2 {
    color: var(--accent-primary);
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.legal-container h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.legal-container p,
.legal-container li {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.legal-container ul {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.legal-container a {
    color: var(--accent-primary);
    text-decoration: underline;
}

.legal-container a:hover {
    color: var(--accent-secondary);
}

.page-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
}

.page-content h1 {
    color: var(--text-primary);
    font-size: 32px;
    margin-bottom: 24px;
}

.page-content h2 {
    color: var(--text-primary);
    font-size: 22px;
    margin-top: 32px;
    margin-bottom: 16px;
}

.page-content p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}

.page-content a {
    color: var(--accent-primary);
    text-decoration: underline;
}

.page-content a:hover {
    color: var(--accent-secondary);
}

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 768px) {
    .site-footer .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .site-footer .footer-links-list li {
        margin-bottom: 0.75rem;
    }

    .cookie-banner {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }

    .cookie-buttons {
        width: 100%;
        justify-content: center;
    }

    .legal-container {
        padding: 2rem 1.5rem;
    }

    .legal-container h1 {
        font-size: 2rem;
    }

    .legal-page {
        padding: 1rem;
    }
}
