@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Poppins:wght@600&family=Raleway:wght@700;800&display=swap');

:root {
    --bg-dark: #070a13;
    --bg-darker: #04060c;
    --bg-card: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.08);

    --primary: #8b5cf6;
    /* Violet */
    --primary-glow: rgba(139, 92, 246, 0.4);
    --secondary: #06b6d4;
    /* Neon Cyan */
    --secondary-glow: rgba(6, 182, 212, 0.4);
    --success: #10b981;
    /* Emerald */
    --success-glow: rgba(16, 185, 129, 0.3);
    --warning: #f59e0b;
    /* Amber */
    --error: #ef4444;
    /* Red */

    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;

    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --shadow-glow: 0 0 25px var(--primary-glow);
    --shadow-glow-cyan: 0 0 25px var(--secondary-glow);
    --shadow-glow-green: 0 0 25px var(--success-glow);
}

/* ==========================================================================
   LIGHT THEME STYLING
   ========================================================================== */
body[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-darker: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.7);
    --border-color: rgba(15, 23, 42, 0.08);

    --primary: #7c3aed;
    --primary-glow: rgba(124, 58, 237, 0.2);
    --secondary: #0891b2;
    --secondary-glow: rgba(8, 145, 178, 0.2);

    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #94a3b8;

    --shadow-glow: 0 4px 20px rgba(124, 58, 237, 0.12);
    --shadow-glow-cyan: 0 4px 20px rgba(8, 145, 178, 0.12);

    background-color: var(--bg-dark);
    background-image:
        radial-gradient(at 0% 0%, rgba(124, 58, 237, 0.06) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(8, 145, 178, 0.04) 0px, transparent 50%);
    color: var(--text-main);
}

body[data-theme="light"] .glass-panel {
    box-shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.05);
}

body[data-theme="light"] header h1 {
    background: linear-gradient(135deg, #0f172a 30%, var(--primary) 70%, var(--secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

body[data-theme="light"] .dash-logo {
    background: linear-gradient(135deg, #0f172a, var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
}

body[data-theme="light"] .dash-mode-badge {
    background: rgba(15, 23, 42, 0.05) !important;
}

#btn-stop-tour {
    background: transparent;
    border: none;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    color: var(--text-muted);
    transition: all 0.2s ease-in-out;
}

#btn-stop-tour:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    transform: scale(1.05);
}

#btn-stop-tour:active {
    transform: scale(0.95);
}

#btn-stop-tour svg {
    width: 20px;
    height: 20px;
}

body[data-theme="light"] #btn-stop-tour {
    color: var(--text-muted);
    background: transparent !important;
}

body[data-theme="light"] #btn-stop-tour:hover {
    background: rgba(15, 23, 42, 0.06) !important;
    color: var(--text-main) !important;
}

body[data-theme="light"] .option-card {
    background: transparent;
    border-color: var(--border-color);
}

body[data-theme="light"] .option-card:hover {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(124, 58, 237, 0.2);
}

body[data-theme="light"] .option-card.selected {
    background: #ffffff;
    border-color: var(--primary) !important;
    box-shadow: 0 4px 15px var(--primary-glow) !important;
}

body[data-theme="light"] .option-icon {
    background: rgba(15, 23, 42, 0.03);
}

body[data-theme="light"] .option-card.selected .option-icon {
    background: rgba(124, 58, 237, 0.15);
}

body[data-theme="light"] #app-dashboard .telemetry-bar {
    background: rgba(255, 255, 255, 0.75) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.06) !important;
}

body[data-theme="light"] #app-dashboard .dash-header {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.06) !important;
}

body[data-theme="light"] .telemetry-bar.playing-audio {
    animation: hudGlowPulseLight 2.5s infinite alternate ease-in-out;
}

@keyframes hudGlowPulseLight {
    0% {
        border-color: rgba(8, 145, 178, 0.25);
        box-shadow: 0 0 8px rgba(8, 145, 178, 0.08), 0 10px 40px rgba(15, 23, 42, 0.06);
    }

    100% {
        border-color: rgba(8, 145, 178, 0.75);
        box-shadow: 0 0 18px rgba(8, 145, 178, 0.3), 0 10px 40px rgba(15, 23, 42, 0.06);
    }
}

body[data-theme="light"] .bottom-sheet {
    background: rgba(248, 250, 252, 0.96);
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.06);
}

body[data-theme="light"] .bottom-sheet-handle {
    background: rgba(15, 23, 42, 0.15);
}

body[data-theme="light"] .bottom-sheet-header h2 {
    color: #0f172a;
}

body[data-theme="light"] .bottom-sheet-close-btn {
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: var(--text-muted);
}

body[data-theme="light"] .bottom-sheet-close-btn:hover {
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
}

body[data-theme="light"] .deep-dive-player-container {
    background: rgba(15, 23, 42, 0.03);
}

body[data-theme="light"] .location-item-card {
    background: rgba(15, 23, 42, 0.02);
}

body[data-theme="light"] .location-item-card:hover {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(124, 58, 237, 0.2);
}

body[data-theme="light"] .location-item-card.active-cp-item {
    background: rgba(8, 145, 178, 0.04);
}

body[data-theme="light"] .location-item-icon-container {
    background: rgba(15, 23, 42, 0.03);
}

body[data-theme="light"] .location-item-card:hover .location-item-icon-container {
    background: rgba(8, 145, 178, 0.05);
}

body[data-theme="light"] .location-item-action {
    background: rgba(15, 23, 42, 0.03);
}

body[data-theme="light"] .filter-pill {
    background: rgba(15, 23, 42, 0.03);
}

body[data-theme="light"] .filter-pill:hover {
    background: rgba(15, 23, 42, 0.05);
    color: #0f172a;
}

body[data-theme="light"] .filter-pill.active {
    background: var(--primary) !important;
    color: white !important;
}

body[data-theme="light"] .leaflet-popup-content-wrapper,
body[data-theme="light"] .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #0f172a !important;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

body[data-theme="light"] .popup-title {
    color: #0f172a !important;
}

body[data-theme="light"] .popup-text {
    color: #475569 !important;
}

body[data-theme="light"] .popup-btn-nav {
    background: rgba(8, 145, 178, 0.08);
    color: var(--secondary) !important;
    border: 1px solid rgba(8, 145, 178, 0.2);
}

body[data-theme="light"] .popup-btn-drawer {
    background: rgba(124, 58, 237, 0.08);
    color: var(--primary) !important;
    border: 1px solid rgba(124, 58, 237, 0.2);
}

/* Toast styling override */
body[data-theme="light"] .toast {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(16, 185, 129, 0.4);
    color: #0f172a;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

/* Admin Specific Overrides */
body[data-theme="light"] .admin-sidebar {
    background: #f8fafc;
}

body[data-theme="light"] .admin-header h1 {
    color: #0f172a;
}

body[data-theme="light"] .admin-mobile-tabs {
    background: #f1f5f9;
}

body[data-theme="light"] input,
body[data-theme="light"] select,
body[data-theme="light"] textarea {
    background: rgba(15, 23, 42, 0.02);
    color: #0f172a;
}

body[data-theme="light"] select option {
    background-color: #f8fafc;
    color: #0f172a;
}

body[data-theme="light"] input:focus,
body[data-theme="light"] select:focus,
body[data-theme="light"] textarea:focus {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--primary);
}

body[data-theme="light"] .admin-item-card {
    background: rgba(15, 23, 42, 0.02);
}

body[data-theme="light"] .admin-item-title {
    color: #0f172a;
}

/* Audio controls container background gradient rules */
.telemetry-audio-controls {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(139, 92, 246, 0.15) 100%);
}

body[data-theme="light"] .telemetry-audio-controls {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12) 0%, rgba(124, 58, 237, 0.05) 100%) !important;
    border-left-color: rgba(124, 58, 237, 0.2) !important;
}

/* Circular HUD control buttons styling */
.hud-control-btn {
    background: transparent;
    border: none;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    color: var(--secondary);
    transition: all 0.2s;
}

.hud-control-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

body[data-theme="light"] .hud-control-btn:hover {
    background: rgba(15, 23, 42, 0.06);
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.1) 0px, transparent 50%);
    color: var(--text-main);
    display: block;
    height: 100dvh;
    overflow: hidden;
    line-height: 1.5;
}

/* Glassmorphism Panel Base */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Custom Scrollbar (for inner panels) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}


/* Onboarding Wizard Screens */
.container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: auto;
    scrollbar-width: none;
}

.container::-webkit-scrollbar {
    display: none;
}

header {
    text-align: center;
    padding: 20px 0;
}

.install-badge-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 15px;
    background: #1e3a8a;
    border: 1px solid #2563eb;
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    animation: installPulse 2.5s infinite;
}

.install-badge-btn:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #3b82f6;
}

@keyframes installPulse {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(37, 99, 235, 0.2);
    }

    50% {
        box-shadow: 0 0 15px rgba(37, 99, 235, 0.5);
    }
}

header h1 {
    font-family: 'Poppins', var(--font-sans);
    font-size: 2.2rem;
    font-weight: 600;
    background: linear-gradient(135deg, #fff 30%, var(--primary) 70%, var(--secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -2px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.wizard-card {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 30px 20px;
    margin: auto 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.wizard-step {
    display: none;
    opacity: 0;
    animation: fadeInUp 0.5s forwards cubic-bezier(0.16, 1, 0.3, 1);
}

.wizard-step.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    opacity: 1;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.step-title .main-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.step-title .sub-title {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* Grid Selections */
.grid-select {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    width: 100%;
}

.option-card {
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.option-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: transparent;
    transition: background-color 0.3s;
}

.option-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
}

.option-card.selected {
    background: rgba(139, 92, 246, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.15);
}

.option-card.selected::before {
    background: var(--primary);
}

.option-icon {
    font-size: 1.4rem;
    /* Slightly smaller icons for better spacing inside circle */
    margin-right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    /* Prevent horizontal squishing in flex containers */
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    /* Circular container */
    transition: all 0.3s;
    overflow: hidden;
    /* Ensure flag images respect border-radius */
}

.flag-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.option-card.selected .option-icon {
    background: rgba(139, 92, 246, 0.2);
    transform: scale(1.05);
}

.option-details {
    flex-grow: 1;
}

.option-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.option-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Pulsing Big Button for Start */
.launch-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
}

.pulse-btn {
    min-width: 220px;
    height: 56px;
    border-radius: 28px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    color: white;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    display: flex;
    flex-direction: row;
    /* Horizontal layout */
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 32px;
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: breathing 3s infinite ease-in-out;
    letter-spacing: 0.5px;
}

.pulse-btn::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 34px;
    /* Matches the outer boundary of the button + offset */
    border: 2px solid var(--primary);
    opacity: 0.5;
    animation: ripple 2s infinite ease-out;
}

.pulse-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 35px var(--primary);
}

.pulse-btn:active {
    transform: scale(0.96);
}

.pulse-btn i {
    font-size: 1.1rem;
}

.pulse-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

@keyframes breathing {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px var(--primary-glow);
    }

    50% {
        transform: scale(1.04);
        box-shadow: 0 0 35px rgba(139, 92, 246, 0.6);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* Wizard Navigation Footer */
.wizard-footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding-top: 10px;
}

.btn {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    flex-grow: 1;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-primary {
    background: var(--primary);
    color: white;
    flex-grow: 1;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

.btn-primary:hover {
    background: #7c3aed;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* MAIN TRACKING SCREEN */
.main-screen {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 24px;
    gap: 10px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.main-screen::-webkit-scrollbar {
    display: none;
}

.main-screen.active {
    display: flex;
}

/* Top Dashboard Header */
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
}

.dash-logo {
    font-family: 'Poppins', var(--font-sans);
    font-weight: 600;
    font-size: 1.15rem;
    background: linear-gradient(135deg, #fff, var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -2px;
    display: flex;
    align-items: center;
}

.dash-mode-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Telemetry Bar (GPS + Speed row, Location + Audio row) */
.telemetry-bar {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-radius: 14px;
    /* Fixed height prevents text changes from causing flex reflow */
    height: 58px;
    flex-shrink: 0;
    overflow: hidden;
    transition: all 0.4s ease-in-out;
}

.telemetry-bar.playing-audio {
    border-color: var(--secondary);
    animation: hudGlowPulse 2.5s infinite alternate ease-in-out;
}

@keyframes hudGlowPulse {
    0% {
        border-color: rgba(6, 182, 212, 0.25);
        box-shadow: 0 0 8px rgba(6, 182, 212, 0.1), 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    }

    100% {
        border-color: rgba(6, 182, 212, 0.85);
        box-shadow: 0 0 20px rgba(6, 182, 212, 0.45), 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    }
}

/* Status Indicator Display */
.status-card {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
}

.status-dot-container {
    position: relative;
    width: 20px;
    height: 20px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--text-dim);
    position: absolute;
    top: 4px;
    left: 4px;
    transition: background-color 0.4s;
}

.status-dot.active {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: statusPulse 1.8s infinite;
}

.status-dot.paused {
    background-color: var(--warning);
    box-shadow: 0 0 10px var(--warning);
}

.status-dot.searching {
    background-color: var(--secondary);
    box-shadow: 0 0 10px var(--secondary);
    animation: statusPulseCyan 1.5s infinite;
}

@keyframes statusPulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes statusPulseCyan {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 8px rgba(6, 182, 212, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
    }
}

.status-text-content {
    flex-grow: 1;
}

.status-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}

.status-message {
    font-size: 0.95rem;
    font-weight: 700;
    margin-top: 1px;
}

/* Map Styling */
.map-card {
    /* Flex grow allows the map to fill vertical space on taller screens
       while maintaining a minimum height. */
    flex-grow: 1;
    flex-shrink: 0;
    min-height: 200px;
    overflow: hidden;
    position: relative;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

#map {
    width: 100%;
    height: 100%;
    background-color: var(--bg-darker);
}

/* Map UI Controls Overlays */
.map-overlay-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(13, 19, 38, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

.map-overlay-btn:hover {
    background: rgba(139, 92, 246, 0.4);
    border-color: var(--primary);
    color: white;
}

/* Audio & Location HUD panel */
.hud-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.hud-card {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 16px;
}

/* Speedometer */
.speed-val {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, white, var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.speed-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-left: 2px;
}

/* Active Story Display */
.story-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.story-title {
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-progress {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Custom Waveform playing animation */
.waveform {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 24px;
    margin-top: 10px;
}

.wave-bar {
    width: 3px;
    height: 4px;
    background-color: var(--primary);
    border-radius: 3px;
    transition: height 0.15s ease;
}

.waveform.playing .wave-bar {
    animation: bounceWave 1s infinite alternate;
}

.waveform.playing .wave-bar:nth-child(2) {
    animation-delay: 0.15s;
}

.waveform.playing .wave-bar:nth-child(3) {
    animation-delay: 0.3s;
}

.waveform.playing .wave-bar:nth-child(4) {
    animation-delay: 0.45s;
}

.waveform.playing .wave-bar:nth-child(5) {
    animation-delay: 0.2s;
}

.waveform.playing .wave-bar:nth-child(6) {
    animation-delay: 0.35s;
}

@keyframes bounceWave {
    0% {
        height: 4px;
    }

    100% {
        height: 22px;
        background-color: var(--secondary);
    }
}

/* Text Reader Subtitle Bar */
.subtitle-panel {
    padding: 10px 12px;
    max-height: 90px;
    overflow-y: auto;
    font-size: 0.85rem;
    color: var(--text-main);
    border-left: 3px solid var(--primary);
    line-height: 1.3;
    border-radius: 12px;
}

/* System controls at bottom */
.system-actions {
    display: flex;
    gap: 8px;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--error);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* ADMIN PANEL STYLING */
.admin-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.admin-sidebar {
    width: 420px;
    height: 100%;
    background: var(--bg-darker);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    flex-shrink: 0;
}

.admin-map-container {
    flex-grow: 1;
    height: 100%;
    position: relative;
}

.admin-header {
    padding: 25px;
    border-bottom: 1px solid var(--border-color);
}

.admin-header h1 {
    font-family: 'Poppins', var(--font-sans);
    font-size: 1.6rem;
    font-weight: 600;
    color: white;
    letter-spacing: -2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.admin-form {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input,
select,
textarea {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-main);
    transition: all 0.3s;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

select option {
    background-color: var(--bg-darker);
    color: var(--text-main);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.25);
}

.calc-info-box {
    background: rgba(6, 182, 212, 0.05);
    border: 1px solid rgba(6, 182, 212, 0.15);
    padding: 12px 15px;
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calc-info-box strong {
    font-weight: 700;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.tab {
    flex-grow: 1;
    text-align: center;
    padding: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    transition: all 0.2s;
}

.tab.active {
    color: var(--primary);
    border-color: var(--primary);
}

.tab-content {
    display: none;
    flex-direction: column;
    gap: 15px;
}

.tab-content.active {
    display: flex;
}

.admin-footer-btn-container {
    padding: 15px 25px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Checklist / Table for Admin items */
.admin-items-list {
    padding: 0 25px 25px 25px;
}

.admin-item-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-item-info {
    overflow: hidden;
    margin-right: 10px;
}

.admin-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-item-coords {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.admin-item-delete {
    background: transparent;
    border: none;
    color: var(--error);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: 1.1rem;
    padding: 5px;
}

.admin-item-delete:hover {
    opacity: 1;
}

/* Leaflet Map Dark Mode Specific Hacks */
.leaflet-container {
    background: var(--bg-darker) !important;
}

.leaflet-bar {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border: none !important;
}

.leaflet-bar a {
    background-color: rgba(13, 19, 38, 0.3) !important;
    color: var(--text-muted) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(4px);
}

.leaflet-bar a:hover {
    background-color: rgba(139, 92, 246, 0.4) !important;
    color: white !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: rgba(13, 19, 38, 0.9) !important;
    backdrop-filter: blur(12px);
    color: var(--text-main) !important;
    border: 1px solid var(--border-color);
}

.leaflet-popup-content h3 {
    font-weight: 700;
    color: white;
    font-size: 1rem;
    margin-bottom: 5px;
}

.leaflet-popup-content p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.leaflet-popup-close-button {
    color: var(--text-muted) !important;
}

/* Custom Marker Styling */
.user-marker {
    background: var(--secondary);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 10px var(--secondary);
}

.checkpoint-marker {
    background: var(--primary);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary);
}

.checkpoint-marker-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px !important;
    height: 28px !important;
}

.checkpoint-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary);
    border: 1.5px solid white;
    border-radius: 50%;
    color: white;
    box-shadow: 0 0 10px var(--primary-glow);
    transition: all 0.2s ease;
}

.checkpoint-icon-wrapper svg {
    width: 14px !important;
    height: 14px !important;
    stroke-width: 2.2px !important;
    color: white !important;
}

/* Toast Message */
.toast {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%) translateY(-80px);
    background: rgba(13, 19, 38, 0.85);
    /* Sleek dark glass */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(16, 185, 129, 0.4);
    /* Subtly colored emerald border */
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
    z-index: 10000;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Floating Map Search Container */
.map-search-container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 12px;
    width: 340px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    background: rgba(13, 19, 38, 0.8);
    border: 1px solid var(--border-color);
}

.map-search-container input {
    background: transparent !important;
    border: none !important;
    flex-grow: 1;
    color: white !important;
    font-size: 0.9rem;
    padding: 8px 5px !important;
    box-shadow: none !important;
}

.map-search-container input::placeholder {
    color: var(--text-dim);
}

.map-search-container button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    transition: color 0.2s, transform 0.2s;
}

.map-search-container button:hover {
    color: var(--secondary);
    transform: scale(1.1);
}

.map-search-container button:active {
    transform: scale(0.95);
}

/* Floating Map Layer Selector Switcher */
.map-layer-selector {
    position: absolute;
    bottom: 15px;
    left: 15px;
    z-index: 1000;
    display: flex;
    gap: 6px;
    padding: 5px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    background: rgba(13, 19, 38, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
}

.layer-opt {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.layer-opt:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: scale(1.08);
}

.layer-opt:active {
    transform: scale(0.95);
}

.layer-opt.active {
    background: rgba(139, 92, 246, 0.5);
    color: white;
    border: 1px solid var(--primary);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

/* Color & Satellite mode map buttons visibility tweaks */
/* Color & Satellite mode map buttons visibility tweaks */

/* 1. LIGHT / COLOR MAP MODE - Elegant light transparent glass */
body[data-map-layer="color"] .map-overlay-btn,
body[data-map-layer="color"] .map-layer-selector {
    background: rgba(255, 255, 255, 0.35) !important;
    border-color: rgba(15, 23, 42, 0.15) !important;
    color: rgba(15, 23, 42, 0.75) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
}

body[data-map-layer="color"] .map-overlay-btn svg {
    stroke: rgba(15, 23, 42, 0.75) !important;
}

body[data-map-layer="color"] .map-overlay-btn:hover {
    background: rgba(139, 92, 246, 0.15) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

body[data-map-layer="color"] .map-overlay-btn:hover svg {
    stroke: var(--primary) !important;
}

body[data-map-layer="color"] .leaflet-bar a {
    background-color: rgba(255, 255, 255, 0.35) !important;
    border-color: rgba(15, 23, 42, 0.15) !important;
    color: rgba(15, 23, 42, 0.75) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
}

body[data-map-layer="color"] .leaflet-bar a:hover {
    background-color: rgba(139, 92, 246, 0.15) !important;
    color: var(--primary) !important;
}

body[data-map-layer="color"] .layer-opt {
    color: rgba(15, 23, 42, 0.6) !important;
}

body[data-map-layer="color"] .layer-opt svg {
    stroke: rgba(15, 23, 42, 0.6) !important;
}

body[data-map-layer="color"] .layer-opt:hover {
    background: rgba(15, 23, 42, 0.08) !important;
    color: rgba(15, 23, 42, 0.9) !important;
}

body[data-map-layer="color"] .layer-opt:hover svg {
    stroke: rgba(15, 23, 42, 0.9) !important;
}

body[data-map-layer="color"] .layer-opt.active {
    background: var(--primary) !important;
    color: white !important;
    border: 1px solid var(--primary) !important;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2) !important;
}

body[data-map-layer="color"] .layer-opt.active svg {
    stroke: white !important;
}

body[data-map-layer="color"] .map-search-container {
    background: rgba(255, 255, 255, 0.7) !important;
    border-color: rgba(15, 23, 42, 0.15) !important;
}

/* 2. SATELLITE MAP MODE - Slightly darker transparent glass for high readability */
body[data-map-layer="satellite"] .map-overlay-btn,
body[data-map-layer="satellite"] .map-layer-selector {
    background: rgba(7, 10, 19, 0.45) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
}

body[data-map-layer="satellite"] .map-overlay-btn svg {
    stroke: rgba(255, 255, 255, 0.8) !important;
}

body[data-map-layer="satellite"] .map-overlay-btn:hover {
    background: rgba(139, 92, 246, 0.45) !important;
    border-color: var(--primary) !important;
    color: white !important;
}

body[data-map-layer="satellite"] .map-overlay-btn:hover svg {
    stroke: white !important;
}

body[data-map-layer="satellite"] .leaflet-bar a {
    background-color: rgba(7, 10, 19, 0.45) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
}

body[data-map-layer="satellite"] .leaflet-bar a:hover {
    background-color: rgba(139, 92, 246, 0.45) !important;
    color: white !important;
}

body[data-map-layer="satellite"] .layer-opt {
    color: rgba(255, 255, 255, 0.65) !important;
}

body[data-map-layer="satellite"] .layer-opt svg {
    stroke: rgba(255, 255, 255, 0.65) !important;
}

body[data-map-layer="satellite"] .layer-opt:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
}

body[data-map-layer="satellite"] .layer-opt:hover svg {
    stroke: white !important;
}

body[data-map-layer="satellite"] .layer-opt.active {
    background: rgba(139, 92, 246, 0.5) !important;
    color: white !important;
    border: 1px solid var(--primary) !important;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3) !important;
}

body[data-map-layer="satellite"] .layer-opt.active svg {
    stroke: white !important;
}

body[data-map-layer="satellite"] .map-search-container {
    background: rgba(7, 10, 19, 0.75) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* ==========================================================================
   ADMIN MOBILE RESPONSIVE TAB PORTAL
   ========================================================================== */
.admin-mobile-tabs {
    display: none;
}

@media (max-width: 991px) {
    body {
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        position: relative !important;
        height: 100vh !important;
        height: calc(var(--vh, 1vh) * 100) !important;
        height: 100dvh !important;
        width: 100vw !important;
    }

    .form-row {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .admin-mobile-tabs {
        display: flex;
        width: 100%;
        height: 60px;
        background: var(--bg-darker);
        border-bottom: 1px solid var(--border-color);
        z-index: 1000;
        flex-shrink: 0;
    }

    .m-tab {
        flex: 1;
        background: transparent;
        border: none;
        color: var(--text-muted);
        font-family: var(--font-sans);
        font-size: 0.95rem;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        border-bottom: 3px solid transparent;
        transition: all 0.25s ease;
    }

    .m-tab:focus {
        outline: none;
    }

    .m-tab.active {
        color: var(--secondary);
        border-color: var(--secondary);
        background: rgba(6, 182, 212, 0.03);
    }

    /* Layout toggles based on body classes on mobile */
    .admin-sidebar {
        width: 100% !important;
        height: calc(100vh - 60px) !important;
        height: calc((var(--vh, 1vh) * 100) - 60px) !important;
        height: calc(100dvh - 60px) !important;
    }

    .admin-header {
        display: none !important;
    }

    .admin-map-container {
        width: 100% !important;
        height: calc(100vh - 60px) !important;
        height: calc((var(--vh, 1vh) * 100) - 60px) !important;
        height: calc(100dvh - 60px) !important;
        display: none;
    }

    /* When showing the map, hide sidebar and show map */
    body.show-map-view .admin-sidebar {
        display: none !important;
    }

    body.show-map-view .admin-map-container {
        display: block !important;
    }

    /* Adjust floating buttons in map for mobile screen */
    .map-search-container {
        width: calc(100% - 40px) !important;
        top: 15px !important;
        left: 20px !important;
    }

    .admin-footer-btn-container {
        padding: 10px 15px !important;
        background: var(--bg-darker);
        border-top: 1px solid var(--border-color);
    }

    .admin-footer-btn-container .btn {
        padding: 8px 16px !important;
        font-size: 0.9rem !important;
        height: 44px !important;
        border-radius: 8px !important;
        font-weight: 700 !important;
        letter-spacing: 0.3px;
    }
}

/* Bottom Sheet for Deep Dive */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 80vh;
    background: rgba(13, 19, 38, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    border-radius: 24px 24px 0 0;
    z-index: 2000;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
}

.bottom-sheet.open {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 12px auto 8px auto;
    flex-shrink: 0;
}

.bottom-sheet-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 0 20px 20px 20px;
}

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.bottom-sheet-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 15px;
}

.bottom-sheet-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.bottom-sheet-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.bottom-sheet-body {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 20px;
}

/* Deep Dive Player Styling inside Bottom Sheet */
.deep-dive-player-container {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    flex-shrink: 0;
}

.deep-dive-play-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--warning) 0%, #f59e0b 100%);
    border: none;
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
    transition: all 0.2s;
    flex-shrink: 0;
}

.deep-dive-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

.deep-dive-player-info {
    display: flex;
    flex-direction: column;
}

#deep-dive-player-status-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.deep-dive-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    overflow-y: auto;
    white-space: pre-wrap;
    padding-right: 5px;
}

.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.bottom-sheet-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* App version badge */
.app-version-badge {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.25);
    padding: 2px 8px;
    border-radius: 8px;
    vertical-align: middle;
    margin-left: 8px;
    letter-spacing: 0.5px;
    display: inline-block;
}

/* Locations List Custom Styles */
#btn-toggle-list {
    bottom: 70px;
}

.locations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 5px 0;
}

.location-item-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 12px;
}

.location-item-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
}

.location-item-card.active-cp-item {
    border-color: var(--secondary);
    background: rgba(6, 182, 212, 0.05);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.location-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex-grow: 1;
}

.location-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.location-item-distance {
    font-weight: 600;
    color: var(--secondary);
    background: rgba(6, 182, 212, 0.08);
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid rgba(6, 182, 212, 0.15);
    display: inline-flex;
    align-items: center;
}

.location-item-status {
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
}

.location-item-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    flex-shrink: 0;
}

.location-item-card:hover .location-item-action {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* #btn-toggle-list specific map-layer overrides removed - handled by general transparent rules */

/* Custom Map Popup Styling */
.leaflet-popup-content-wrapper {
    padding: 0 !important;
    overflow: hidden;
    border-radius: 16px !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    width: 280px !important;
}

.custom-map-popup {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}

.popup-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: white;
    margin: 0;
    line-height: 1.3;
    padding-right: 18px;
}

.popup-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
    white-space: normal;
}

.popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    width: 100%;
}

.popup-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    box-sizing: border-box;
}

.popup-btn i {
    font-size: 0.85rem;
}

/* Navigate Button Styling */
.popup-btn-nav {
    background: rgba(6, 182, 212, 0.08);
    color: var(--secondary) !important;
    border: 1px solid rgba(6, 182, 212, 0.25);
    text-decoration: none;
}

.popup-btn-nav:hover {
    background: var(--secondary);
    color: white !important;
    border-color: var(--secondary);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

/* Learn More Button Styling */
.popup-btn-drawer {
    background: rgba(139, 92, 246, 0.08);
    color: var(--primary) !important;
    border: 1px solid rgba(139, 92, 246, 0.25);
}

.popup-btn-drawer:hover {
    background: var(--primary);
    color: white !important;
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
}

/* Category Filter Bar */
.category-filter-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 12px 0;
    scrollbar-width: none;
    /* Hide standard scrollbar in Firefox */
    -ms-overflow-style: none;
    /* Hide in IE/Edge */
    flex-shrink: 0;
}

.category-filter-bar::-webkit-scrollbar {
    display: none;
    /* Hide in Chrome/Safari */
}

/* Filter Pill Buttons */
.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.filter-pill:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(139, 92, 246, 0.3);
    color: var(--text-main);
    transform: translateY(-1px);
}

.filter-pill.active {
    background: rgba(139, 92, 246, 0.16);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.25);
}

.pill-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pill-icon svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.2px;
}

/* Category icon next to sights list items */
.location-item-icon-container {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 300px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--secondary);
    transition: all 0.25s;
    flex-shrink: 0;
}

.location-item-icon-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 9px;
    z-index: 2;
}

.location-item-fallback-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.location-item-icon-container svg {
    width: 18px;
    height: 18px;
    stroke-width: 2px;
}

.location-item-card:hover .location-item-icon-container {
    border-color: rgba(6, 182, 212, 0.3);
    background: rgba(6, 182, 212, 0.05);
}

.location-item-card.active-cp-item .location-item-icon-container {
    background: rgba(6, 182, 212, 0.12);
    border-color: var(--secondary);
    color: var(--secondary);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.2);
}

/* Leaflet Popup Category SVG styling */
.popup-cat-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.2px;
}

/* General Lucide SVG icons styling */
.lucide-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    stroke: currentColor;
    fill: none;
    display: inline-block;
    vertical-align: middle;
}

/* Custom User GPS Marker Styling */
.user-marker-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px !important;
    height: 32px !important;
}

.user-marker-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--secondary);
    border-radius: 50%;
    color: white;
    box-shadow: 0 0 15px var(--secondary-glow);
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

/* Pulsing radar ripple effect for user marker */
.user-marker-icon-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--secondary);
    box-shadow: 0 0 10px var(--secondary-glow);
    animation: userMarkerRipple 2.2s infinite ease-out;
    z-index: -1;
    pointer-events: none;
    box-sizing: border-box;
}

@keyframes userMarkerRipple {
    0% {
        transform: scale(0.95);
        opacity: 1;
    }

    100% {
        transform: scale(2.4);
        opacity: 0;
    }
}

.user-marker-icon-wrapper svg {
    width: 22px !important;
    height: 22px !important;
    stroke-width: 2.2px !important;
    margin: 0 !important;
}

/* --- APP FULLSCREEN MAP LAYOUT WITH FLOATING BOTTOM HUD --- */
#app-dashboard.main-screen {
    padding: 0;
    gap: 0;
    overflow: hidden;
}

#app-dashboard .dash-header {
    position: absolute;
    top: calc(20px + env(safe-area-inset-top, 0px));
    left: calc(20px + env(safe-area-inset-left, 0px));
    right: calc(20px + env(safe-area-inset-right, 0px));
    z-index: 1000;
    background: rgba(7, 10, 19, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    padding: 12px 20px 12px 10px;
    transition: all 0.3s ease;
}

#app-dashboard .hud-panel {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: calc(20px + env(safe-area-inset-left, 0px));
    right: calc(20px + env(safe-area-inset-right, 0px));
    z-index: 1000;
    margin: 0;
}

#app-dashboard .telemetry-bar {
    background: rgba(7, 10, 19, 0.85);
    /* Rich opaque dark backdrop */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
}

#app-dashboard .map-card {
    border: none;
    border-radius: 0;
    width: 100%;
    height: auto;
    margin: 0;
    flex-grow: 1;
    min-height: 0;
}

#app-dashboard #btn-recenter {
    bottom: calc(110px + env(safe-area-inset-bottom, 0px)) !important;
    right: calc(20px + env(safe-area-inset-right, 0px));
}

#app-dashboard #btn-toggle-list {
    bottom: calc(165px + env(safe-area-inset-bottom, 0px)) !important;
    right: calc(20px + env(safe-area-inset-right, 0px));
}

#app-dashboard .map-layer-selector {
    bottom: calc(220px + env(safe-area-inset-bottom, 0px)) !important;
    right: calc(20px + env(safe-area-inset-right, 0px));
    left: auto;
    flex-direction: column;
}

#app-dashboard #btn-refresh-map {
    bottom: calc(355px + env(safe-area-inset-bottom, 0px)) !important;
    right: calc(20px + env(safe-area-inset-right, 0px));
}

#app-dashboard .map-overlay-btn,
#app-dashboard .map-layer-selector {
    background: rgba(7, 10, 19, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Background wave animations for the telemetry/location bar */
.telemetry-bg-wave {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Above background but below interactive elements */
    pointer-events: none;
    overflow: hidden;
    border-radius: 16px;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.bg-wave-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    /* Extra width for seamless looping */
    height: 100%;
    transform-origin: center;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s ease;
}

/* Infinitely loop moving waves */
.bg-wave-svg.wave-1 {
    animation: flowWaveLeft 12s linear infinite;
}

.bg-wave-svg.wave-2 {
    animation: flowWaveRight 16s linear infinite;
}

.bg-wave-svg.wave-3 {
    animation: flowWaveLeft 8s linear infinite;
}

@keyframes flowWaveLeft {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

@keyframes flowWaveRight {
    0% {
        transform: translate3d(-50%, 0, 0);
    }

    100% {
        transform: translate3d(0, 0, 0);
    }
}

/* Idle state: waves are slowed down and almost completely flat */
.telemetry-bar:not(.playing-audio) .telemetry-bg-wave .wave-1 {
    transform: scaleY(0.12);
    opacity: 0.25;
    animation-duration: 24s;
}

.telemetry-bar:not(.playing-audio) .telemetry-bg-wave .wave-2 {
    transform: scaleY(0.08);
    opacity: 0.15;
    animation-duration: 32s;
}

.telemetry-bar:not(.playing-audio) .telemetry-bg-wave .wave-3 {
    transform: scaleY(0.05);
    opacity: 0.1;
    animation-duration: 18s;
}

/* Playing state: waves grow tall and active */
.telemetry-bar.playing-audio .telemetry-bg-wave .wave-1 {
    transform: scaleY(1);
    opacity: 0.85;
    animation-duration: 8s;
}

.telemetry-bar.playing-audio .telemetry-bg-wave .wave-2 {
    transform: scaleY(0.8);
    opacity: 0.65;
    animation-duration: 11s;
}

.telemetry-bar.playing-audio .telemetry-bg-wave .wave-3 {
    transform: scaleY(0.6);
    opacity: 0.45;
    animation-duration: 5.5s;
}

/* Image display styling for map popup and bottom sheet */
.popup-image-container {
    width: 100%;
    height: 100px;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    margin: 0;
}

.popup-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.deep-dive-img-container {
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: 16px;
    margin-bottom: 5px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.deep-dive-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.deep-dive-img-container img:hover {
    transform: scale(1.03);
}

/* Lock notice banner for teaser mode */
.deep-dive-lock-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(245, 158, 11, 0.08);
    /* Transparent amber */
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 12px;
    margin-bottom: 5px;
    box-sizing: border-box;
}

#deep-dive-lock-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: #f59e0b;
    /* Amber color */
    line-height: 1.3;
}

/* ==========================================================================
   HUD FLOATING BADGE & PULSE RING (Opcija 1)
   ========================================================================== */

/* Lebdeći vizuelni vidžet (Floating Badge) */
.hud-floating-badge {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 10px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    border: 2px solid var(--secondary);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4), 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    overflow: visible;
    /* Da dozvoli da se pulsirajući prsten širi van ivica */
}

.hud-floating-badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.hud-floating-badge:hover {
    transform: scale(1.15);
    box-shadow: 0 0 22px rgba(6, 182, 212, 0.7), 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

.hud-floating-badge:active {
    transform: scale(0.95);
}

/* Pulsirajući prsten (Radar Ripple) */
.badge-pulse-ring {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid var(--secondary);
    border-radius: 50%;
    opacity: 0.8;
    pointer-events: none;
    animation: badgePulse 2s infinite ease-out;
}

@keyframes badgePulse {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Light Theme overrides za lebdeći kružić */
body[data-theme="light"] .hud-floating-badge {
    border-color: var(--secondary);
    box-shadow: 0 4px 15px rgba(8, 145, 178, 0.25), 0 8px 32px 0 rgba(15, 23, 42, 0.08);
}

body[data-theme="light"] .hud-floating-badge:hover {
    box-shadow: 0 6px 20px rgba(8, 145, 178, 0.45), 0 8px 32px 0 rgba(15, 23, 42, 0.12);
}

/* Logo styling has been changed back to text */

/* Version Label inside wizard card */
.app-version-wizard {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    margin-top: 20px;
    opacity: 0.65;
    user-select: none;
}

/* Plain version label text styling */
.app-version-text {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    margin-left: 6px;
    opacity: 0.65;
    user-select: none;
}

/* Active Category badge on the map header */
.active-category-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-family: var(--font-sans);
    transition: all 0.2s ease-in-out;
}

.active-category-badge.glass-panel {
    border-radius: 20px;
    box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.15);
}

.active-category-badge:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(139, 92, 246, 0.3);
}

body[data-theme="light"] .active-category-badge:hover {
    background: rgba(15, 23, 42, 0.04);
}

/* Icon style inside active-category-badge */
.active-category-badge .lucide-icon,
.active-category-badge svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
    color: var(--secondary);
    display: block;
}

/* ==========================================================================
   SVG LOGO STYLING
   ========================================================================== */
.app-logo {
    height: 32px;
    width: auto;
    display: inline-block;
    vertical-align: middle;
    transition: filter 0.3s ease;
}

#app-title .app-logo {
    height: 40px;
}

.dash-logo .app-logo {
    height: 20px;
    margin-top: -5px;
}

body[data-theme="light"] .app-logo {
    filter: none;
}

body[data-theme="light"] #app-title .app-logo {
    content: url('icons/logo-f-l.svg');
}

body[data-theme="light"] .dash-logo .app-logo,
body[data-theme="light"] .admin-header h1 .app-logo {
    content: url('icons/logo-l.svg');
}

/* Screen Lock and OLED Battery Saver Styles */
#app-dashboard #btn-lock-screen {
    bottom: calc(355px + env(safe-area-inset-bottom, 0px)) !important;
    right: calc(20px + env(safe-area-inset-right, 0px));
}

#screen-saver {
    display: none;
    position: fixed;
    inset: 0;
    background: #000000;
    z-index: 99999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
    user-select: none;
    -webkit-user-select: none;
}

@keyframes pulse-lock {
  0% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.08); }
  100% { opacity: 0.25; transform: scale(1); }
}