:root {
    --bg-main: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-glass: #ffffff;
    --border-glass: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --cz-accent: #3b82f6;
    --cz-glow: rgba(59, 130, 246, 0.4);
    --vn-accent: #10b981;
    --vn-glow: rgba(16, 185, 129, 0.4);
    
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-glass: 0 1px 3px rgba(0,0,0,0.05);
}

body.theme-light {
    --bg-main: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-glass: #ffffff;
    --border-glass: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --shadow-glass: 0 1px 3px rgba(0,0,0,0.05);
}

/* Light Theme Variables */
body.theme-light {
    --bg-main: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.9);
    --border-glass: rgba(15, 23, 42, 0.12);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --shadow-glass: 0 10px 25px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navbar */
.navbar {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

body.theme-light .navbar {
    background: rgba(255, 255, 255, 0.85);
}

.nav-container {
    max-width: 1350px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--cz-accent), var(--vn-accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.brand h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--cz-accent);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.4rem;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

body.theme-light .badge {
    background: rgba(15, 23, 42, 0.08);
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.nav-actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-glass);
}

body.theme-light .btn-secondary {
    background: rgba(15, 23, 42, 0.06);
    border-color: rgba(15, 23, 42, 0.15);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}

body.theme-light .btn-secondary:hover {
    background: rgba(15, 23, 42, 0.12);
}

.btn-admin {
    background: rgba(14, 165, 233, 0.15);
    color: #38bdf8;
    border-color: rgba(14, 165, 233, 0.3);
}

.btn-admin:hover {
    background: rgba(14, 165, 233, 0.25);
    color: #fff;
    transform: translateY(-2px);
}

.btn-gold {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
    transform: translateY(-2px);
}

body.theme-dark .icon-moon { display: none; }
body.theme-dark .icon-sun { display: inline-block; }
body.theme-light .icon-sun { display: none; }
body.theme-light .icon-moon { display: inline-block; }

.admin-toolbar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: rgba(14, 165, 233, 0.1);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(14, 165, 233, 0.3);
}

.admin-badge {
    font-size: 0.75rem;
    font-weight: 800;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.4rem;
}

.hidden {
    display: none !important;
}

/* Container */
.container {
    max-width: 1350px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.only-print {
    display: none;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.flag-icon {
    font-size: 2.5rem;
}

.header-title h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-title p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Progress Card */
.progress-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.25rem;
    min-width: 250px;
    backdrop-filter: blur(10px);
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.progress-text strong {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cz-bar {
    background: linear-gradient(90deg, #d97706, #f59e0b);
    box-shadow: 0 0 10px var(--cz-glow);
}

.vn-bar {
    background: linear-gradient(90deg, #059669, #10b981);
    box-shadow: 0 0 10px var(--vn-glow);
}

/* Grid Layout */
.grid-layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

@media (max-width: 992px) {
    .grid-layout {
        grid-template-columns: 1fr;
    }
}

/* Glass Panels */
.glass-panel {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-glass);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
}

/* Map Card */
.map-card {
    position: relative;
    padding: 0.5rem;
    height: 520px;
}

.leaflet-map {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-md);
    z-index: 10;
    background: #ffffff !important;
}

.map-legend {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    z-index: 400;
    color: #f8fafc;
}

body.theme-light .map-legend {
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.unvisited-legend {
    color: #64748b;
}

.visited-legend {
    color: #f59e0b;
}

#section-vn .visited-legend {
    color: #10b981;
}

/* Visited Panel */
.visited-panel {
    height: 520px;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-glass);
    margin-bottom: 1rem;
}

.panel-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.text-gold { color: var(--cz-accent); }
.text-emerald { color: var(--vn-accent); }

.stat-badge {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* Visited List */
.visited-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.visited-list::-webkit-scrollbar {
    width: 6px;
}

.visited-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.visited-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    margin: auto 0;
    padding: 2rem 1rem;
    font-style: italic;
}

/* Visited City Item */
.visited-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease;
}

body.theme-light .visited-item {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.1);
}

.visited-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(3px);
}

body.theme-light .visited-item:hover {
    background: rgba(15, 23, 42, 0.08);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.item-info h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.item-info span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    transition: color 0.2s;
}

.item-remove:hover {
    color: #f87171;
}

/* Quick Toggle Section */
.quick-toggle-section {
    border-top: 1px solid var(--border-glass);
    padding-top: 1rem;
}

.quick-toggle-section h4 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 140px;
    overflow-y: auto;
}

/* Chip Button */
.chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

body.theme-light .chip {
    background: rgba(15, 23, 42, 0.05);
    border-color: rgba(15, 23, 42, 0.15);
}

.chip:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

body.theme-light .chip:hover {
    background: rgba(15, 23, 42, 0.1);
}

.chip.active-cz {
    background: rgba(245, 158, 11, 0.2);
    border-color: var(--cz-accent);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.chip.active-vn {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--vn-accent);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

/* Custom Leaflet Marker Styling */
.custom-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.pin-unvisited {
    width: 24px;
    height: 24px;
    background-color: #334155;
    border: 2px solid #94a3b8;
    color: #fff;
    font-size: 0.7rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.pin-visited-cz {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: 2px solid #fff;
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.8);
    animation: pulseGlowCz 2s infinite;
}

.pin-visited-vn {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #10b981, #059669);
    border: 2px solid #fff;
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.8);
    animation: pulseGlowVn 2s infinite;
}

@keyframes pulseGlowCz {
    0% { box-shadow: 0 0 10px rgba(245, 158, 11, 0.6); }
    50% { box-shadow: 0 0 22px rgba(245, 158, 11, 1); }
    100% { box-shadow: 0 0 10px rgba(245, 158, 11, 0.6); }
}

@keyframes pulseGlowVn {
    0% { box-shadow: 0 0 10px rgba(16, 185, 129, 0.6); }
    50% { box-shadow: 0 0 22px rgba(16, 185, 129, 1); }
    100% { box-shadow: 0 0 10px rgba(16, 185, 129, 0.6); }
}

/* Section Divider */
.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin: 3.5rem 0;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-glass), transparent);
}

.divider-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    box-shadow: var(--shadow-glass);
}

/* Admin Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-card {
    width: 100%;
    max-width: 420px;
    padding: 1.75rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
}

.modal-body p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 4px;
    margin-bottom: 0.5rem;
}

.error-text {
    color: #f87171;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.modal-footer {
    margin-top: 1.25rem;
    display: flex;
    justify-content: flex-end;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border-glass);
    padding: 2rem 0;
    margin-top: 4rem;
    background: rgba(15, 23, 42, 0.5);
}

body.theme-light .footer {
    background: rgba(255, 255, 255, 0.5);
}

.footer-container {
    max-width: 1350px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ========================================================
   FULL-PAGE 3-PAGE EXECUTIVE PDF PRINT STYLING (@media print)
   Page 1: CZ Map ONLY (Landscape A4, White background)
   Page 2: VN Map ONLY (Portrait A4, White background)
   Page 3: Summary Report ONLY (Portrait A4, White background)
   ======================================================== */
@page {
    margin: 10mm;
}

@page cz-page {
    size: A4 landscape;
    margin: 10mm;
}

@page vn-page {
    size: A4 portrait;
    margin: 10mm;
}

@page summary-page {
    size: A4 portrait;
    margin: 15mm;
}

@media print {
    .no-print {
        display: none !important;
    }
    .only-print {
        display: block !important;
    }
    
    /* Clean White Document Background for Printing */
    body, html, body.theme-light, body.theme-dark {
        background: #ffffff !important;
        color: #0f172a !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .container {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Page 1: CZ Map Only (Landscape) */
    #section-cz {
        page: cz-page;
        page-break-after: always !important;
        break-after: page !important;
        width: 100% !important;
        height: 188mm !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Page 2: VN Map Only (Portrait) - Perfect full height */
    #section-vn {
        page: vn-page;
        page-break-after: always !important;
        break-after: page !important;
        width: 100% !important;
        height: 275mm !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Page 3: Summary Footprint Report (Portrait) */
    #print-summary-page {
        page: summary-page;
        width: 100% !important;
        display: block !important;
        padding-top: 5mm !important;
    }

    .section-header {
        margin-bottom: 4mm !important;
        border-bottom: 2px solid #0f172a !important;
        padding-bottom: 2mm !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }

    .header-title h2 {
        font-size: 15pt !important;
        color: #0f172a !important;
    }

    .progress-card {
        border: 1px solid #0f172a !important;
        background: #f8fafc !important;
        padding: 4px 12px !important;
        border-radius: 6px !important;
    }

    .progress-text {
        color: #0f172a !important;
        font-weight: bold !important;
        margin-bottom: 0 !important;
    }

    /* Print Grid Layout -> Full-Page Map ONLY */
    .grid-layout {
        display: block !important;
        width: 100% !important;
        flex: 1 !important;
        margin-bottom: 0 !important;
    }

    /* Full Page Map Frame */
    .map-card.glass-panel {
        background: #ffffff !important;
        border: 2px solid #0f172a !important;
        box-shadow: none !important;
        padding: 0 !important;
        width: 100% !important;
        height: 160mm !important;
        border-radius: 8px !important;
        overflow: hidden !important;
    }

    #section-vn .map-card.glass-panel {
        height: 250mm !important;
    }

    .leaflet-map, .leaflet-container {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        background: #ffffff !important;
    }

    /* Styling for Page 3 Summary Report */
    .print-report-header {
        border-bottom: 3px solid #0f172a;
        padding-bottom: 8mm;
        margin-bottom: 8mm;
    }

    .print-report-header h1 {
        font-family: 'Outfit', sans-serif;
        font-size: 22pt;
        color: #0f172a;
        margin-bottom: 2mm;
    }

    .print-report-header p {
        font-size: 11pt;
        color: #475569;
    }

    .print-section-title {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #cbd5e1;
        padding-bottom: 3mm;
        margin-bottom: 5mm;
    }

    .print-section-title h2 {
        font-size: 14pt;
        color: #0f172a;
    }

    .print-stat-pill {
        background: #0f172a;
        color: #fff;
        padding: 3px 10px;
        border-radius: 20px;
        font-weight: bold;
        font-size: 10pt;
    }

    .print-chips-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .print-city-box {
        border: 1px solid #0f172a;
        border-radius: 6px;
        padding: 4px 10px;
        font-size: 10pt;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: #f8fafc;
        color: #0f172a;
        font-weight: 600;
    }

    .print-city-box.unvisited-box {
        border-color: #cbd5e1;
        color: #94a3b8;
        background: #ffffff;
        font-weight: 400;
    }

    .print-report-footer {
        margin-top: 15mm;
        border-top: 1px solid #cbd5e1;
        padding-top: 5mm;
        font-size: 9pt;
        color: #64748b;
        text-align: center;
    }
}

/* Dark mode map tiles via CSS filter (no API key required) */
.theme-dark .leaflet-layer {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}
