/* webapp/static/style.css */
body { 
    background-color: #0d1117; 
    color: #c9d1d9; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.refresh-icon {
    display: inline-block;
    font-size: 1.4rem;
    line-height: 1;
}

.refresh-icon.spinning {
    animation: spin-animation 1s infinite linear;
}

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

/* --- CARDS & CONTAINERS --- */
.card { 
    background-color: #161b22; 
    border: 1px solid #30363d; 
    transition: all 0.2s; 
}

.card-header-flag {
    padding: 1.5rem; 
    border-bottom: 1px solid #30363d;
}


.flag-icon {
    height: 2.5rem;
    width: auto;
    border-radius: 4px; /* Rounded corners */
    display: block; /* Removes inline image gaps */
}

/* --- BOTTOM FILTER BAR --- */
/* Backdrop for click-outside */
.sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1045; /* Below sheet (1050) but above content */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.sheet-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #161b22;
    border-top: 1px solid #30363d;
    padding: 0 20px 20px 20px;
    z-index: 1050;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.7);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    max-height: 85vh;
    overflow-y: auto;
}

.bottom-sheet.active {
    transform: translateY(0);
}

/* The small "pull tab" trigger */
.bottom-trigger {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: #161b22;
    border: 1px solid #30363d;
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    padding: 10px 40px;
    z-index: 1040;
    cursor: pointer;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.3);
    color: #8b949e;
    transition: transform 0.3s ease;
    text-align: center;
    line-height: 1;
}

.bottom-trigger:hover {
    color: #58a6ff;
    background-color: #1c2128;
}

/* Hide trigger when sheet is open (slide it down) */
.bottom-trigger.hidden {
    transform: translate(-50%, 100%);
}

/* Handle inside the sheet to close it */
.sheet-handle-bar {
    width: 40px;
    height: 4px;
    background-color: #30363d;
    border-radius: 2px;
    margin: 12px auto 20px auto;
    cursor: pointer;
}

/* --- FILTER CHIPS --- */
.filter-chip {
    display: none; /* Hide actual checkbox */
}

.filter-chip + label {
    cursor: pointer;
    background-color: #21262d;
    border: 1px solid #30363d;
    color: #8b949e;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    transition: all 0.2s;
    user-select: none;
}

.filter-chip:checked + label {
    background-color: #1f6feb;
    color: white;
    border-color: #1f6feb;
}

/* --- TYPOGRAPHY & PRICING --- */
.price-huge { 
    font-size: 2.5rem; 
    font-weight: 800; 
    color: #2ea043; 
    letter-spacing: -1px; 
    line-height: 1; 
}

.price-compact { 
    font-weight: 700; 
    color: #2ea043; 
    font-size: 1.1rem; 
}

/* Tolerance Warning Colors */
.tolerance-hit .price-huge, 
.tolerance-hit .price-compact { 
    color: #d29922; 
}

.airport-code { 
    font-weight: 700; 
    color: #e6edf3; 
}

.date-badge { 
    background: #21262d; 
    border: 1px solid #30363d; 
    color: #8b949e; 
    padding: 2px 8px; 
    border-radius: 4px; 
    font-size: 0.85em; 
    font-family: monospace; 
}

.flight-time { 
    color: #8b949e; 
    font-size: 0.9em; 
    font-family: monospace; 
}

.arrow { 
    color: #484f58; 
    margin: 0 8px; 
}

/* --- LIST GROUPS --- */
.list-group-item { 
    background-color: transparent; 
    border-color: #30363d; 
}

.list-group-item:hover { 
    background-color: #21262d; 
}

/* --- CONTROL BAR --- */
.control-bar { 
    background: #161b22; 
    border-bottom: 1px solid #30363d; 
    padding: 1rem 0; 
    margin-bottom: 2rem; 
}

/* --- FORM ELEMENTS (DARK MODE) --- */
.form-control, .form-select { 
    background-color: #0d1117; 
    border-color: #30363d; 
    color: #c9d1d9; 
}

.form-control:focus, .form-select:focus { 
    background-color: #0d1117; 
    color: #fff; 
    border-color: #58a6ff; 
    box-shadow: none; 
}

/* --- LINKS --- */
.flight-segment { 
    transition: opacity 0.2s; 
    border-radius: 4px; 
    padding: 2px 4px; 
}
.flight-segment:hover { 
    background-color: rgba(255,255,255,0.05); 
    opacity: 1; 
    text-decoration: none; 
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .card-header-flag { padding: 1rem; }
    .price-huge { font-size: 2rem; }
    .flight-row-mobile {
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid #21262d;
    }
    .flight-row-mobile:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }
    .bottom-trigger { padding: 8px 30px; }
    .bottom-sheet { padding: 0 12px 16px 12px; }
    .filter-chip + label { font-size: 0.75rem; padding: 4px 8px; }
    .strategy-time-row { flex-wrap: wrap; gap: 0.5rem; }
    .nouislider-wrap { min-width: 100%; }
}

/* --- Airport Autocomplete --- */
.airport-input-wrapper {
    position: relative;
}
.airport-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}
.airport-chip {
    display: inline-flex;
    align-items: center;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 1rem;
    padding: 0.15rem 0.6rem;
    font-size: 0.85rem;
    color: #c9d1d9;
}
.chip-remove {
    cursor: pointer;
    margin-left: 0.35rem;
    color: #8b949e;
    font-weight: bold;
}
.chip-remove:hover {
    color: #f85149;
}
.airport-dropdown {
    display: none;
    position: absolute;
    z-index: 1000;
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 0.375rem;
    margin-top: 2px;
}
.airport-dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: #c9d1d9;
    font-size: 0.85rem;
}
.airport-dropdown-item:hover {
    background: #21262d;
}

/* --- Strategy Editor --- */
.strategy-section {
    margin-bottom: 1rem;
}
.strategy-day-btn {
    min-width: 3rem;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}
.strategy-time-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0;
}
.strategy-day-label {
    color: #c9d1d9;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 2.5rem;
}
.range-value {
    color: #58a6ff;
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 7rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
/* --- noUiSlider dark theme overrides --- */
.nouislider-wrap {
    flex: 1;
    min-width: 120px;
    padding: 0 8px;
}
.noUi-target {
    background: #30363d;
    border: none;
    box-shadow: none;
    height: 6px;
    border-radius: 3px;
}
.noUi-connect {
    background: #1f6feb;
}
.noUi-handle {
    background: #58a6ff;
    border: 2px solid #0d1117;
    border-radius: 50%;
    box-shadow: none;
    width: 18px !important;
    height: 18px !important;
    right: -9px !important;
    top: -7px !important;
    cursor: pointer;
}
.noUi-handle::before,
.noUi-handle::after {
    display: none;
}
.noUi-horizontal .noUi-tooltip {
    display: none;
}
.strategy-number-input {
    width: 4rem !important;
    text-align: center;
    background: #0d1117 !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}

/* --- Notification Bell Toggle --- */
.notify-bell {
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: transform 0.15s ease;
    vertical-align: middle;
}
.notify-bell:hover {
    transform: scale(1.2);
}
.bell-icon.bell-active {
    color: #58a6ff;
}
.bell-icon.bell-inactive {
    color: #484f58;
    opacity: 0.6;
}