/* ── Global ── */

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ── Navbar ── */

.navbar {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.navbar .nav-link.active {
    border-bottom: 2px solid #fff;
    padding-bottom: calc(0.5rem - 2px);
}

/* ── Page entrance ── */

.container-md {
    animation: fadeIn 0.4s ease-out;
}

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

/* ── Footer ── */

.site-footer {
    font-size: 0.75rem;
    color: #6c757d;
    text-align: center;
    padding: 1rem 0;
}

/* ── Hero (landing page) ── */

.hero-section {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8ecf4 100%);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 0;
}

.tool-card {
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 1.5rem;
    height: 100%;
    transition: box-shadow 0.2s ease;
}

.tool-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* ── ICON Viewer ── */

#menu-button {
    position: fixed;
    top: 70px;
    left: 0;
    z-index: 1040;
}

#menu-button .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

#canvas-scroller {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

#viewer-error {
    display: none;
}

/* ── Climatch ── */

.result-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fff;
    animation: cardSlideIn 0.3s ease-out both;
}

.result-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.score-bar-bg {
    background: #e9ecef;
    border-radius: 4px;
    height: 8px;
    width: 100%;
}

.score-bar-fill {
    border-radius: 4px;
    height: 8px;
}

.climate-detail {
    font-size: 0.85rem;
    color: #6c757d;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0d6efd;
    color: white;
    font-weight: bold;
    font-size: 0.85rem;
    margin-right: 10px;
    flex-shrink: 0;
}

.map-rank-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #0d6efd;
    color: white;
    font-weight: bold;
    font-size: 0.85rem;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

#results-map {
    height: 60vh;
    min-height: 350px;
    max-height: 700px;
    border-radius: 8px;
}

.importance-dots {
    display: inline-flex;
    gap: 4px;
}

.importance-dots .dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #0d6efd;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s;
}

.importance-dots .dot.active {
    background: #0d6efd;
}

.importance-dots .dot:hover {
    border-color: #0b5ed7;
}

.importance-header {
    font-size: 0.75rem;
    line-height: 1;
    margin-bottom: 2px !important;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 2px 0;
    color: #adb5bd;
    transition: color 0.2s;
}

.filter-header.filter-active {
    color: inherit;
}

.filter-toggle-icon {
    font-size: 1rem;
    font-weight: bold;
    color: #adb5bd;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1.5px solid #adb5bd;
    flex-shrink: 0;
    transition: color 0.2s, border-color 0.2s;
}

.filter-header:hover .filter-toggle-icon,
.filter-header:active .filter-toggle-icon {
    color: #0d6efd;
    border-color: #0d6efd;
}

.filter-header.filter-active .filter-toggle-icon {
    color: #dc3545;
    border-color: #dc3545;
}

.filter-section {
    margin-bottom: 0.35rem !important;
    transition: margin-bottom 0.2s;
}

.filter-section.filter-section-active {
    margin-bottom: 1rem !important;
}

@keyframes filter-auto-pulse {
    0%   { background-color: rgba(13, 110, 253, 0.15); }
    100% { background-color: transparent; }
}

.filter-auto-highlight {
    animation: filter-auto-pulse 1.2s ease-out;
    border-radius: 4px;
}

.airport-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #0d6efd;
    color: #fff;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.airport-chip .chip-remove {
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.8;
}

.airport-chip .chip-remove:hover {
    opacity: 1;
}

#airport-dropdown .list-group-item {
    padding: 6px 10px;
    font-size: 0.85rem;
    cursor: pointer;
}

#airport-dropdown .list-group-item:hover {
    background: #e9ecef;
}

.flight-price-slot {
    font-size: 0.85rem;
}

.flight-price-slot .spinner-border {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

.flight-summary {
    cursor: pointer;
    user-select: none;
}

.flight-detail {
    display: none;
    font-size: 0.82rem;
    color: #6c757d;
    margin-top: 4px;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    line-height: 1.5;
}

.flight-detail.open {
    display: block;
}

.flight-chevron {
    font-size: 0.75em;
    margin-left: 4px;
    display: inline-block;
    transition: transform 0.15s;
}

.flight-chevron.open {
    transform: rotate(90deg);
}

.show-flight-btn {
    font-size: 0.8rem;
    padding: 2px 10px;
}

.inspiration-price {
    color: #198754;
    font-weight: 500;
}

/* ── Focus styles (keyboard accessibility) ── */

*:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

.btn:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
    box-shadow: none;
}

.form-select:focus-visible,
.form-control:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 0;
    box-shadow: none;
}

/* ── Score labels (colorblind accessibility) ── */

.score-label {
    font-size: 0.7rem;
    font-weight: 600;
}

/* ── Dark mode overrides ── */

[data-bs-theme="dark"] .hero-section {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

[data-bs-theme="dark"] .tool-card {
    border-color: #495057;
}

[data-bs-theme="dark"] .result-card {
    background: #212529;
    border-color: #495057;
}

[data-bs-theme="dark"] .score-bar-bg {
    background: #495057;
}

[data-bs-theme="dark"] .flight-detail {
    background: #2b3035;
}

[data-bs-theme="dark"] #airport-dropdown .list-group-item:hover {
    background: #495057;
}

[data-bs-theme="dark"] .hero-subtitle,
[data-bs-theme="dark"] .climate-detail,
[data-bs-theme="dark"] .site-footer {
    color: #adb5bd;
}

/* Leaflet dark tiles */
[data-bs-theme="dark"] .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg);
}

[data-bs-theme="dark"] .leaflet-control-attribution {
    background: rgba(33, 37, 41, 0.8) !important;
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .leaflet-control-attribution a {
    color: #6ea8fe !important;
}

/* Hide year selector — app only uses month-day ranges */
.flatpickr-current-month .numInputWrapper,
.flatpickr-current-month input.cur-year {
    display: none !important;
}

/* Flatpickr dark overrides */
[data-bs-theme="dark"] .flatpickr-calendar {
    background: #212529;
    border-color: #495057;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .flatpickr-months,
[data-bs-theme="dark"] .flatpickr-month,
[data-bs-theme="dark"] .flatpickr-weekdays,
[data-bs-theme="dark"] span.flatpickr-weekday {
    background: #212529;
    color: #adb5bd;
}

[data-bs-theme="dark"] .flatpickr-day {
    color: #dee2e6;
}

[data-bs-theme="dark"] .flatpickr-day:hover {
    background: #495057;
    border-color: #495057;
}

[data-bs-theme="dark"] .flatpickr-day.inRange {
    background: #2b3035;
    border-color: #2b3035;
    box-shadow: -5px 0 0 #2b3035, 5px 0 0 #2b3035;
}

[data-bs-theme="dark"] .flatpickr-day.selected,
[data-bs-theme="dark"] .flatpickr-day.startRange,
[data-bs-theme="dark"] .flatpickr-day.endRange {
    background: #0d6efd;
    border-color: #0d6efd;
}

[data-bs-theme="dark"] .flatpickr-current-month input.cur-year,
[data-bs-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months {
    color: #dee2e6;
}

[data-bs-theme="dark"] .flatpickr-months .flatpickr-prev-month,
[data-bs-theme="dark"] .flatpickr-months .flatpickr-next-month {
    fill: #adb5bd;
}


/* ── Responsive ── */

@media (max-width: 992px) {
    #results-map {
        height: 55vh;
    }
}

@media (max-width: 576px) {
    #results-map {
        height: 50vh;
        min-height: 280px;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .navbar-brand {
        font-size: 0.95rem;
    }
}
