:root {
    --bg: #050505;
    --card-bg: #0a0a0a;
    --accent: #00ff41;
    --text: #e0e0e0;
    --muted: #666;
    --border: #1a1a1a;
    --font: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.scanlines {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(transparent 50%, rgba(0, 255, 65, 0.02) 50%);
    background-size: 100% 4px;
    z-index: 1000;
    pointer-events: none;
    opacity: 0.4;
    animation: flicker 0.2s infinite;
}

@keyframes flicker {
    0% { opacity: 0.35; }
    50% { opacity: 0.45; }
    100% { opacity: 0.35; }
}

.main-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.neon-text {
    color: var(--accent);
    text-shadow: 0 0 8px rgba(0, 255, 65, 0.4);
}

.subtitle { font-size: 0.6rem; color: var(--muted); letter-spacing: 2px; }

.system-status { display: flex; gap: 2rem; }
.status-item { text-align: right; }
.label { display: block; font-size: 0.5rem; color: var(--muted); }
.value { font-size: 0.9rem; }

.grid-container {
    flex: 1;
    min-height: 0; /* KEY: Force flex item to respect viewport boundary and scroll internally */
    display: grid;
    /* Stable responsive grid with better min-width for mobile */
    grid-template-columns: repeat(auto-fill, minmax(345px, 1fr));
    grid-auto-rows: max-content; /* KEY: Force rows to take maximum content height and never compress */
    gap: 1.5rem;
    padding: 2rem;
    width: 100%;
    max-width: 1800px; /* NEW: Avoid excessive stretching on 4K screens */
    margin: 0 auto;    /* NEW: Center the hub */
    overflow-y: auto;
}

.webcam-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: auto; /* Allow heights to grow with content */
    min-height: 305px; /* Safety height to prevent clipping */
}

.webcam-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.1);
}

.video-container {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    cursor: pointer;
    flex-shrink: 0;
}

/* The technical overlay is ON TOP but passes clicks to the iframe below */
.video-overlay-tech {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
    pointer-events: none; /* KEY: Clicks go through to the iframe */
    transition: opacity 0.2s ease;
}

.video-placeholder {
    width: 100%; height: 100%;
    background-color: transparent; /* Show IFRAME preview through */
    /* Add a technical grid effect instead of an image */
    background-image: 
        linear-gradient(rgba(0, 255, 65, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    display: flex;
    align-items: flex-end;
    padding: 15px;
    box-sizing: border-box;
}

.video-placeholder::after {
    content: "READY // SIGNAL DETECTED";
    font-size: 0.6rem;
    color: var(--accent);
    letter-spacing: 1px;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 6px;
    border-radius: 2px;
}

.coastal-radar {
    position: absolute;
    bottom: 10px; right: 10px;
    width: 140px; height: 40px; /* Perfect relief scale */
    z-index: 50;
    pointer-events: none;
}

.radar-map {
    position: relative;
    width: 100%; height: 100%;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(3px);
    border-radius: 4px;
    border: 1px solid rgba(0, 255, 65, 0.25);
    padding: 2px;
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.1) inset;
}

/* Removed Provincial Sweep */

@keyframes radar-sweep {
    from { transform: rotate(0deg) translate(0, -50%); }
    to { transform: rotate(360deg) translate(0, -50%); }
}

.radar-beacon {
    position: absolute;
    width: 4px; height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px #00ff41;
    z-index: 11;
    transform: translate(-50%, -50%);
    animation: ping 1.5s infinite;
}

/* Radar Sweep centered exactly on the GPS camera location */
.radar-beacon::before {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 80px; height: 1px;
    background: linear-gradient(to right, #00ff41, transparent);
    transform-origin: left center;
    animation: radar-sweep 3s linear infinite;
    opacity: 0.6;
    pointer-events: none;
}

@keyframes ping {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}

.coastline-svg {
    width: 100%; height: 100%;
    stroke: #00ff41;
    fill: none;
    stroke-width: 2;
    opacity: 1;
    filter: drop-shadow(0 0 2px rgba(0, 255, 65, 0.6));
}

.radar-label {
    font-size: 0.45rem;
    color: var(--accent);
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
}

@keyframes ping {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}

.play-btn-custom {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100px; height: 100px;
    background: rgba(5, 5, 5, 0.4); /* Slightly transparent center */
    backdrop-filter: blur(2px);
    border: 3px solid var(--accent);
    color: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 0 25px rgba(0, 255, 65, 0.4);
    z-index: 12;
}

.play-btn-custom::before, .play-btn-custom::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--accent);
    animation: pulser 2s infinite;
}

.play-btn-custom::before { width: 120%; height: 120%; opacity: 0.3; }
.play-btn-custom::after { width: 140%; height: 140%; opacity: 0.1; animation-delay: 0.5s; }

@keyframes pulser {
    0% { transform: scale(1); opacity: 0.3; }
    100% { transform: scale(1.2); opacity: 0; }
}

.video-container:hover .play-btn-custom {
    text-shadow: 0 0 10px var(--accent);
    border-color: #fff;
}

/* When the camera is active, hide the tech overlay */
.video-container.active-feed .video-overlay-tech {
    opacity: 0;
}

.video-container iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
    z-index: 5;
    filter: brightness(0.9);
}

.overlay-top {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
    pointer-events: none;
    z-index: 15; /* Always on top */
}

.live-indicator {
    background: var(--accent);
    color: #000;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 4px;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-container.active-feed .live-indicator {
    opacity: 1;
}

/* NEW: Radar Scan Sweep Animation centered on BEACON */
.radar-beacon::before {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 250px; height: 2px; /* Large enough to sweep the whole map */
    background: linear-gradient(to right, var(--accent), transparent);
    transform-origin: left center;
    animation: radar-sweep 4s linear infinite;
    opacity: 0.3;
    z-index: 14;
    pointer-events: none;
}

@keyframes radar-sweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* NEW: Cinema Mode (Fullscreen Technical View) */
.webcam-card.cinema-mode {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 2000;
    padding: 2rem;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(20px);
}

.webcam-card.cinema-mode .video-container {
    height: 70vh;
    aspect-ratio: auto;
}

.webcam-card.cinema-mode .overlay-bottom {
    grid-template-columns: repeat(4, 1fr);
    background: var(--card-bg);
    border: 1px solid var(--border);
    margin-top: 1rem;
}

.close-cinema {
    position: absolute;
    top: 2rem; right: 2rem;
    background: var(--accent);
    color: #000;
    border: none;
    padding: 0.5rem 1rem;
    font-family: var(--font);
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
    display: none;
}

.webcam-card.cinema-mode .close-cinema {
    display: block;
}

.expand-btn {
    position: absolute;
    top: 45px; left: 10px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.6rem;
    padding: 2px 6px;
    cursor: pointer;
    z-index: 16;
    opacity: 0.6;
    transition: all 0.2s;
}

.expand-btn:hover {
    opacity: 1;
    background: var(--accent);
    color: #000;
}

.dot {
    width: 4px; height: 4px;
    background: #000;
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.cam-name {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0, 255, 65, 0.35);
    border-radius: 30px;
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--accent);
    text-shadow: 0 0 4px rgba(0, 255, 65, 0.3);
}

.overlay-bottom {
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    flex-shrink: 0;
}

.overlay-bottom .label { font-size: 0.55rem; background-color: var(--accent); color: #000; padding: 1px 4px; display: inline-block; font-weight: bold; margin-bottom: 2px; text-transform: uppercase; }
.overlay-bottom .value { font-size: 0.85rem; color: var(--accent); font-weight: bold; }

.loader { grid-column: 1/-1; text-align: center; padding: 4rem; }
.spinner {
    width: 30px; height: 30px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.main-footer {
    padding: 0.8rem 2rem;
    border-top: 1px solid var(--border);
    font-size: 0.6rem;
    color: var(--muted);
    display: flex;
    justify-content: center;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* MOBILE OPTIMIZATION */
@media (max-width: 600px) {
    .main-header {
        padding: 1rem;
        flex-direction: column;
        gap: 0.8rem;
        text-align: center;
    }
    .system-status {
        flex-direction: column;
        gap: 0.4rem;
        width: 100%;
        align-items: center;
    }
    .status-item {
        text-align: center;
        width: 100%;
    }
    .status-item .label {
        display: inline-block;
        margin-bottom: 0;
        margin-right: 6px;
    }
    .status-item .value {
        display: inline-block;
    }
    .grid-container {
        padding: 10px;
        grid-template-columns: 1fr !important; /* Force single column on mobile */
    }
    .webcam-card {
        margin-bottom: 20px;
    }
}

.tide-alert-vivas {
    background-color: #ffff00 !important;
    color: #ff0000 !important;
    padding: 1px 6px;
    font-weight: bold;
    display: inline-block;
    text-shadow: none !important;
}

/* Theme Selector Segmented Control */
.theme-selector {
    display: flex;
    background: rgba(0, 255, 65, 0.05);
    padding: 2px;
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 65, 0.2);
}

.theme-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: bold;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-btn.active {
    background: var(--accent);
    color: #000;
}

/* Premium Mode (Apple Light Mode) overrides */
body.premium-mode {
    --accent: #007aff !important;
    --border: #d2d2d7 !important;
    --card-bg: #ffffff !important;
    --muted: #86868b !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #e2e2e7 !important;
    color: #1d1d1f;
}

body.premium-mode .scanlines {
    display: none !important;
}

body.premium-mode::before {
    display: none; /* Disable dark gradients */
}

/* Header styling in premium */
body.premium-mode .main-header {
    background: #ffffff !important;
    border-bottom: 1px solid #d2d2d7 !important;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.02);
}

body.premium-mode .logo-area h1 {
    color: #1d1d1f !important;
}

body.premium-mode .neon-text {
    color: #007aff !important; /* Apple Blue logo highlight */
    text-shadow: none !important;
}

body.premium-mode .subtitle {
    color: #86868b !important;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

body.premium-mode .system-status .label {
    color: #86868b !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.55rem;
}

body.premium-mode .system-status .value {
    color: #1d1d1f !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

body.premium-mode #global-status {
    color: #34c759 !important; /* Clean Apple Green */
    text-shadow: none !important;
}

/* Theme Selector Segmented Control */
body.premium-mode .theme-selector {
    background: #e3e3e6 !important;
    border: none !important;
    padding: 2px !important;
    border-radius: 8px !important;
}

body.premium-mode .theme-btn {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: #8e8e93;
    padding: 6px 16px;
    border-radius: 6px;
}

body.premium-mode .theme-btn.active {
    background: #ffffff !important;
    color: #1d1d1f !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}

/* Card Styling in premium */
body.premium-mode .webcam-card {
    background: #ffffff !important;
    border: 1.5px solid #b8b8bf !important;
    border-radius: 20px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.10), 0 1px 4px rgba(0,0,0,0.06) !important;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

body.premium-mode .webcam-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14) !important;
    border-color: #007aff !important;
}

body.premium-mode .video-container {
    background: #f5f5f7 !important;
    flex-shrink: 0;
}

body.premium-mode .video-container iframe {
    filter: none !important;
}

body.premium-mode .video-overlay-tech {
    border-bottom: 1px solid #e5e5ea !important;
    background-image: none !important; /* Remove scanline grid */
    background-color: rgba(0, 0, 0, 0.01) !important;
}

body.premium-mode .video-placeholder::after {
    background: rgba(0, 122, 255, 0.1) !important;
    color: #007aff !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid rgba(0, 122, 255, 0.15);
}

/* Play Button (Custom) */
body.premium-mode .play-btn-custom {
    color: #007aff !important;
    border-color: #007aff !important;
    background: #ffffff !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    text-shadow: none !important;
}

body.premium-mode .video-container:hover .play-btn-custom {
    background: #007aff !important;
    color: #ffffff !important;
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.3) !important;
}

/* Expand button */
body.premium-mode .expand-btn {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(4px);
    color: #007aff !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    border: 1px solid #d2d2d7 !important;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    opacity: 0.9;
    top: 40px; /* Slight adjust for layout */
}

body.premium-mode .expand-btn:hover {
    background: #007aff !important;
    color: #ffffff !important;
    border-color: #007aff !important;
    opacity: 1;
}

/* Top overlay in premium */
body.premium-mode .overlay-top {
    background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(255,255,255,0));
}

body.premium-mode .live-indicator {
    background: rgba(52, 199, 89, 0.1) !important;
    color: #1d8a3a !important;
    border: 1px solid rgba(52, 199, 89, 0.2) !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

body.premium-mode .live-indicator .dot {
    background: #34c759 !important;
}

body.premium-mode .cam-name {
    background: rgba(255, 255, 255, 0.18) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 30px !important;
    padding: 4px 12px !important;
    color: #ffffff !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

/* Bottom HUD overlay in premium */
body.premium-mode .overlay-bottom {
    background: #ffffff !important;
    padding: 1.1rem 1.3rem !important;
    flex-shrink: 0;
}

body.premium-mode .overlay-bottom .label {
    background: #f5f5f7 !important;
    color: #86868b !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.55rem;
    font-weight: 600;
    border-radius: 4px;
    padding: 2px 6px !important;
    border: 1px solid #e5e5ea;
}

body.premium-mode .overlay-bottom .value {
    color: #1d1d1f !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

body.premium-mode .overlay-bottom .muted-text {
    color: #86868b !important;
    font-family: 'Inter', sans-serif;
}

/* SVG Tide gauge overrides */
body.premium-mode .tide-slope-gauge path {
    stroke: #d2d2d7 !important;
    fill: #f5f5f7 !important;
}

body.premium-mode .tide-slope-gauge rect[fill="none"] {
    stroke: #e5e5ea !important;
}

body.premium-mode .tide-slope-gauge rect[fill="var(--accent)"] {
    fill: url(#waterGradPremium) !important;
}

body.premium-mode .tide-slope-gauge text {
    fill: #007aff !important;
}

/* Solar bar overrides */
body.premium-mode .solar-gauge {
    border-color: #d2d2d7 !important;
    border-radius: 4px;
    background: #e5e5ea !important;
}

body.premium-mode .solar-fill {
    background-color: #ff9500 !important; /* Apple Orange/Sun */
    opacity: 1 !important;
}

/* Spring Tide warning in header in premium mode */
body.premium-mode .tide-alert-vivas {
    background-color: rgba(255, 59, 48, 0.1) !important;
    color: #ff3b30 !important;
    border: 1px solid rgba(255, 59, 48, 0.2);
    border-radius: 6px;
    padding: 4px 8px !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    text-shadow: none !important;
}

/* Wind arrow */
body.premium-mode .wind-arrow {
    color: #007aff !important;
}

body.premium-mode .radar-beacon {
    box-shadow: 0 0 10px #007aff !important;
    background: #007aff !important;
}

body.premium-mode .radar-beacon::before {
    background: linear-gradient(to right, #007aff, transparent) !important;
}

body.premium-mode .radar-map {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(0, 122, 255, 0.25) !important;
    box-shadow: 0 0 8px rgba(0, 122, 255, 0.08) inset !important;
}

body.premium-mode .coastline-svg {
    stroke: #007aff !important;
    filter: drop-shadow(0 0 2px rgba(0, 122, 255, 0.5)) !important;
}

/* ── Camera Search Bar ───────────────────────────────────────────────────── */
.cam-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.cam-search-input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 65, 0.35);
    color: #00ff41;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 6px;
    width: 200px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cam-search-input::placeholder { color: rgba(0, 255, 65, 0.4); }

.cam-search-input:focus {
    border-color: #00ff41;
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.25);
}

.cam-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    min-width: 220px;
    background: #0d0d0d;
    border: 1px solid rgba(0, 255, 65, 0.3);
    border-radius: 8px;
    list-style: none;
    padding: 4px 0;
    z-index: 9999;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.cam-search-dropdown.open { display: block; }

.cam-search-item {
    padding: 8px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: #c0c0c0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.cam-search-item:hover,
.cam-search-item.active {
    background: rgba(0, 255, 65, 0.12);
    color: #00ff41;
}

.cam-search-item mark {
    background: transparent;
    color: #00ff41;
    font-weight: bold;
}

/* Flash highlight on selected card */
@keyframes searchFlash {
    0%   { box-shadow: 0 0 0 3px rgba(0, 255, 65, 0.8); }
    50%  { box-shadow: 0 0 0 8px rgba(0, 255, 65, 0.3); }
    100% { box-shadow: 0 0 0 3px rgba(0, 255, 65, 0); }
}

.search-highlight { animation: searchFlash 1.8s ease-out forwards; }

/* ── Premium overrides for search ───────────────────────────────────────── */
body.premium-mode .cam-search-input {
    background: rgba(255, 255, 255, 0.9);
    border: 1.5px solid #c7c7cc;
    color: #1d1d1f;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

body.premium-mode .cam-search-input::placeholder { color: #aeaeb2; }

body.premium-mode .cam-search-input:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

body.premium-mode .cam-search-dropdown {
    background: #ffffff;
    border: 1px solid #e5e5ea;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.10);
}

body.premium-mode .cam-search-item {
    font-family: 'Inter', sans-serif;
    color: #3a3a3c;
}

body.premium-mode .cam-search-item:hover,
body.premium-mode .cam-search-item.active {
    background: rgba(0, 122, 255, 0.08);
    color: #007aff;
}

body.premium-mode .cam-search-item mark {
    color: #007aff;
}

@keyframes searchFlashPremium {
    0%   { box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.8), 0 4px 20px rgba(0,0,0,0.10); }
    50%  { box-shadow: 0 0 0 8px rgba(0, 122, 255, 0.2), 0 4px 20px rgba(0,0,0,0.10); }
    100% { box-shadow: 0 0 0 3px rgba(0, 122, 255, 0), 0 4px 20px rgba(0,0,0,0.10); }
}

body.premium-mode .search-highlight {
    animation: searchFlashPremium 1.8s ease-out forwards;
}

/* ── Interactive Map Section ────────────────────────────────────────────── */
.map-section-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    
    background: #0d0d0d;
    border: none;
    border-bottom: 1px solid rgba(0, 255, 65, 0.3);
    border-radius: 0;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

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

.map-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-toggle-btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.map-toggle-btn:hover {
    background: rgba(0, 255, 65, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.2);
}

.map-container-outer {
    width: 100%;
    height: 0;
    opacity: 0;
    overflow: hidden;
    transition: height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease;
    border-radius: 0;
    border: none;
}

.map-section-wrapper.expanded .map-container-outer {
    height: 320px;
    opacity: 1;
}

#map-element {
    width: 100%;
    height: 100%;
    background: #0d0d0d;
}

/* Leaflet Dark Customizations */
.leaflet-container {
    background: #050505 !important;
    font-family: inherit;
}

.leaflet-bar {
    border: 1px solid rgba(0, 255, 65, 0.3) !important;
    box-shadow: none !important;
    border-radius: 6px !important;
    overflow: hidden;
}

.leaflet-bar a {
    background-color: #0d0d0d !important;
    color: var(--accent) !important;
    border-bottom: 1px solid rgba(0, 255, 65, 0.15) !important;
    transition: background 0.2s;
}

.leaflet-bar a:hover {
    background-color: rgba(0, 255, 65, 0.15) !important;
}

.leaflet-popup-content-wrapper {
    background: #0d0d0d !important;
    color: #e0e0e0 !important;
    border: 1px solid rgba(0, 255, 65, 0.3) !important;
    border-radius: 8px !important;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important;
}

.leaflet-popup-tip {
    background: #0d0d0d !important;
    border-left: 1px solid rgba(0, 255, 65, 0.3) !important;
    border-bottom: 1px solid rgba(0, 255, 65, 0.3) !important;
}

.map-popup-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.map-popup-title {
    font-weight: bold;
    color: var(--accent);
    font-size: 0.72rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 2px;
}

.map-popup-btn {
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    margin-top: 4px;
    text-align: center;
    font-weight: bold;
    transition: background 0.2s;
}

.map-popup-btn:hover {
    background: var(--accent);
    color: #000;
}

/* ── Favorites Heart Button ─────────────────────────────────────────────── */
.fav-btn {
    position: relative;
    pointer-events: auto !important;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.5);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    flex-shrink: 0;
}

.fav-btn:hover {
    transform: scale(1.12);
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.4);
    box-shadow: 0 0 10px rgba(255, 59, 48, 0.25);
}

.fav-btn.favorited {
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.5);
    background: rgba(0, 0, 0, 0.8);
    animation: heartBeat 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-shadow: 0 0 8px rgba(255, 59, 48, 0.5);
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    30% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* ── Golden & Blue Hour Pulses ──────────────────────────────────────────── */
@keyframes pulse-light {
    0% { opacity: 0.8; }
    50% { opacity: 1; text-shadow: 0 0 8px currentColor; }
    100% { opacity: 0.8; }
}

.pulse-light-active {
    animation: pulse-light 2s infinite;
}

/* ── Premium Mode map & fav styles ──────────────────────────────────────── */
body.premium-mode .map-section-wrapper {
    margin-top: 0;
    background: #ffffff !important;
    border: none !important;
    border-bottom: 1.5px solid #d2d2d7 !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}

body.premium-mode .map-header {
    border-color: #d2d2d7 !important;
}

body.premium-mode .map-title {
    font-family: 'Inter', sans-serif;
    color: #1d1d1f;
    font-weight: 600;
}

body.premium-mode .map-toggle-btn {
    border: 1.5px solid #007aff;
    color: #007aff;
    font-family: 'Inter', sans-serif;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

body.premium-mode .map-toggle-btn:hover {
    background: #007aff;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.25);
}

body.premium-mode .map-container-outer {
    border: none !important;
    box-shadow: none !important;
}

body.premium-mode #map-element {
    background: #ffffff;
}

body.premium-mode .leaflet-container {
    background: #ffffff !important;
}

body.premium-mode .leaflet-bar {
    border: 1.5px solid #c7c7cc !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
}

body.premium-mode .leaflet-bar a {
    background-color: #ffffff !important;
    color: #1d1d1f !important;
    border-bottom: 1px solid #e5e5ea !important;
}

body.premium-mode .leaflet-bar a:hover {
    background-color: #f5f5f7 !important;
    color: #007aff !important;
}

body.premium-mode .leaflet-popup-content-wrapper {
    background: #ffffff !important;
    color: #1d1d1f !important;
    border: 1px solid #e5e5ea !important;
    border-radius: 12px !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08) !important;
}

body.premium-mode .leaflet-popup-tip {
    background: #ffffff !important;
    border-left: 1px solid #e5e5ea !important;
    border-bottom: 1px solid #e5e5ea !important;
}

body.premium-mode .map-popup-title {
    color: #1d1d1f;
    font-weight: 600;
}

body.premium-mode .map-popup-btn {
    background: #007aff;
    border: none;
    color: #ffffff;
    border-radius: 6px;
    font-weight: 500;
}

body.premium-mode .map-popup-btn:hover {
    background: #0056b3;
    color: #ffffff;
}

body.premium-mode .fav-btn {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    color: rgba(29, 29, 31, 0.4);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

body.premium-mode .fav-btn:hover {
    background: #ffffff;
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.25);
    box-shadow: 0 4px 15px rgba(255, 59, 48, 0.15);
}

body.premium-mode .fav-btn.favorited {
    background: #ffffff;
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.35);
    box-shadow: 0 4px 15px rgba(255, 59, 48, 0.2);
    text-shadow: none;
}

.weather-icon {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
}
