/* ═══════ Base ═══════ */
html { scroll-behavior: smooth; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: var(--accent-800, #333); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-700, #555); }

/* ═══════ Mountain Background Scene ═══════ */
.mountain-scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.mountain-scene svg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
}
.mountain-scene .stars {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 40%;
}
.mountain-scene .star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    opacity: 0.3;
}
.mountain-scene .star.bright {
    opacity: 0.6;
    width: 3px;
    height: 3px;
    box-shadow: 0 0 4px rgba(255,255,255,0.3);
}
@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.6; }
}
.mountain-scene .star.twinkle {
    animation: twinkle 3s ease-in-out infinite;
}

/* ═══════ Glassmorphism ═══════ */
.glass {
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ═══════ Animations ═══════ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.animate-fade-in-up { animation: fadeInUp 0.5s ease-out both; }
.animate-fade-in    { animation: fadeIn 0.4s ease-out both; }
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.10s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.20s; }
.delay-5 { animation-delay: 0.25s; }
.delay-6 { animation-delay: 0.30s; }

/* ═══════ Board Cards ═══════ */
.board-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.board-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(54, 165, 255, 0.1);
}

/* ═══════ Score Ring ═══════ */
.score-ring {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

/* ═══════ Data-completeness tooltip (Q2) ═══════ */
/* Show the factor breakdown when the user hovers the score-ring wrap OR
   focuses the warning badge via keyboard. The tooltip is positioned
   below-left of the ring so it can't overflow the right edge of a
   3-column grid card. */
.score-ring-wrap:hover .factor-tooltip,
.factor-badge:focus + .factor-tooltip,
.factor-badge:focus-visible + .factor-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.factor-tooltip {
    transition: opacity 0.15s ease, visibility 0.15s ease;
}
.score-ring::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(
        var(--ring-color, #0c87f0) calc(var(--pct, 0) * 3.6deg),
        rgba(55, 65, 81, 0.5) calc(var(--pct, 0) * 3.6deg)
    );
    mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px));
}

/* ═══════ Range Slider ═══════ */
.range-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: #374151;
    outline: none;
    cursor: pointer;
}
.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-500, #0c87f0);
    border: 2px solid var(--accent-400, #36a5ff);
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.range-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 0 12px var(--accent-500, #0c87f0);
    transform: scale(1.15);
}
.range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-500, #0c87f0);
    border: 2px solid var(--accent-400, #36a5ff);
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.range-slider::-moz-range-thumb:hover {
    box-shadow: 0 0 12px var(--accent-500, #0c87f0);
    transform: scale(1.15);
}
.range-slider::-moz-range-track {
    height: 8px;
    border-radius: 4px;
    background: #374151;
}

/* ═══════ Table row hover ═══════ */
tbody tr { transition: background-color 0.15s ease; }

/* ═══════ Admin Tabs ═══════ */
.tab-btn {
    transition: color 0.15s ease, border-color 0.15s ease;
    color: #9ca3af;
    border-color: transparent;
}
.tab-btn:hover {
    color: white;
    border-color: #4b5563;
}
.tab-btn.active {
    color: white;
    border-color: var(--accent-500, #0c87f0);
}

/* ═══════ Stat Bars (usage analytics) ═══════ */
.stat-bar {
    border-radius: 4px;
    background: linear-gradient(to right, var(--accent-700, #0054a6), var(--accent-500, #0c87f0));
    transition: width 0.3s ease;
}

/* ═══════ Trip Planner ═══════ */
.resort-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.resort-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(54, 165, 255, 0.1);
}

/* Snow condition badges */
.snow-badge-pow  { background: rgba(34, 197, 94, 0.2); color: #4ade80; border-radius: 4px; }
.snow-badge-fresh { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border-radius: 4px; }
.snow-badge-light { background: rgba(156, 163, 175, 0.15); color: #9ca3af; border-radius: 4px; }
.snow-badge-dry   { background: rgba(75, 85, 99, 0.15); color: #6b7280; border-radius: 4px; }

/* Distance badge */
.distance-badge {
    font-variant-numeric: tabular-nums;
}

/* Leaflet overrides for dark theme */
#resort-map { background: #111827; }
.leaflet-popup-content-wrapper {
    background: rgba(17, 24, 39, 0.95);
    color: #e5e7eb;
    border: 1px solid rgba(75, 85, 99, 0.5);
    border-radius: 8px;
    backdrop-filter: blur(8px);
}
.leaflet-popup-tip { background: rgba(17, 24, 39, 0.95); }
.leaflet-popup-content { margin: 10px 14px; font-size: 13px; line-height: 1.5; }
.leaflet-popup-content b { color: white; }
.leaflet-control-zoom a {
    background: rgba(17, 24, 39, 0.9) !important;
    color: #e5e7eb !important;
    border-color: #374151 !important;
}
.leaflet-control-zoom a:hover { background: #1f2937 !important; }
.leaflet-control-attribution { background: rgba(0,0,0,0.5) !important; color: #6b7280 !important; }
.leaflet-control-attribution a { color: #9ca3af !important; }

/* ═══════ Price History Modal (Phase B) ═══════ */
/* Clickable price on each recommendation card opens a modal with a
   14-day price trend graph. The button is styled to look like the
   original span until hovered, so the card layout is unchanged. */
.price-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: inherit;
    font: inherit;
    font-weight: inherit;
}
.price-btn:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}
.price-btn:focus-visible {
    outline: 2px solid var(--accent-400, #36a5ff);
    outline-offset: 2px;
    border-radius: 2px;
}
.price-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
    animation: fadeIn 0.15s ease-out both;
}
.price-modal.hidden {
    display: none;
}
.price-modal-content {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(75, 85, 99, 0.6);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
