* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    color: #fff;
}

.container {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 550px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8rem;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #ccc;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus {
    border-color: #3a7bd5;
    box-shadow: 0 0 0 3px rgba(58, 123, 213, 0.2);
}

.form-group input[readonly] {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

/* Dropdown */
.dropdown-wrapper {
    position: relative;
}

.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: #1e1b3a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    z-index: 100;
    display: none;
    margin-top: 4px;
}

.dropdown-list.active {
    display: block;
}

.dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: rgba(58, 123, 213, 0.3);
}

.dropdown-item .iata-code {
    font-weight: 700;
    color: #00d2ff;
    margin-right: 8px;
}

.dropdown-item .airport-name {
    color: #ccc;
}

.dropdown-item .airport-location {
    display: block;
    font-size: 0.78rem;
    color: #888;
    margin-top: 2px;
}

/* Button row */
.btn-row {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

button[type="submit"],
#googleBtn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.btn-label {
    display: block;
}

.btn-quota {
    display: block;
    font-size: 0.68rem;
    font-weight: 400;
    opacity: 0.85;
    background: rgba(0,0,0,0.18);
    border-radius: 20px;
    padding: 1px 8px;
    letter-spacing: 0.03em;
    min-height: 1em;
}

button[type="submit"] {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(90deg, #3a7bd5, #00d2ff);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 210, 255, 0.3);
}

button[type="submit"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#googleBtn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(90deg, #34a853, #4285f4);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

#googleBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.35);
}

#googleBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loading */
.loading {
    text-align: center;
    margin-top: 30px;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #00d2ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Date input color fix */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* Scrollbar */
.dropdown-list::-webkit-scrollbar {
    width: 6px;
}
.dropdown-list::-webkit-scrollbar-track {
    background: transparent;
}
.dropdown-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

/* ========== RESULTS PAGE ========== */

.results-container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.results-header {
    text-align: center;
    margin-bottom: 30px;
}

.results-header h1 {
    margin-bottom: 8px;
}

.results-header .route-info {
    font-size: 1.1rem;
    color: #aaa;
}

.results-count {
    text-align: center;
    color: #888;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* Itinerary card */
.itinerary-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.itinerary-card:hover {
    border-color: rgba(0, 210, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.itinerary-card .price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.itinerary-card .price {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.itinerary-card .agent-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #aaa;
}

.itinerary-card .agent-info img {
    height: 20px;
    border-radius: 4px;
}

.leg {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 10px;
}

.leg:last-child {
    margin-bottom: 0;
}

.leg-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #00d2ff;
    margin-bottom: 10px;
    font-weight: 600;
}

.leg-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.leg-endpoint {
    text-align: center;
    min-width: 80px;
}

.leg-endpoint .time {
    font-size: 1.3rem;
    font-weight: 700;
}

.leg-endpoint .iata {
    font-size: 0.85rem;
    color: #aaa;
}

.leg-endpoint .date {
    font-size: 0.75rem;
    color: #666;
}

.leg-middle {
    flex: 1;
    text-align: center;
    position: relative;
}

.leg-middle .duration {
    font-size: 0.85rem;
    color: #ccc;
    margin-bottom: 6px;
}

.leg-middle .line {
    height: 2px;
    background: rgba(255,255,255,0.15);
    position: relative;
    margin: 0 10px;
}

.leg-middle .line::before,
.leg-middle .line::after {
    content: '';
    position: absolute;
    top: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3a7bd5;
}

.leg-middle .line::before { left: -4px; }
.leg-middle .line::after { right: -4px; }

.leg-middle .stops {
    font-size: 0.78rem;
    color: #888;
    margin-top: 6px;
}

.leg-middle .stops.direct {
    color: #4caf50;
}

.leg-carriers {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.leg-carriers img {
    height: 18px;
    border-radius: 3px;
}

.leg-carriers span {
    font-size: 0.8rem;
    color: #999;
}

.book-btn {
    display: inline-block;
    margin-top: 14px;
    padding: 10px 28px;
    border-radius: 8px;
    background: linear-gradient(90deg, #3a7bd5, #00d2ff);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.book-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 210, 255, 0.3);
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 1.1rem;
}

.error-message {
    text-align: center;
    padding: 40px 20px;
    color: #ff6b6b;
    font-size: 1.1rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #00d2ff;
    text-decoration: none;
    font-size: 0.9rem;
}

.back-link:hover {
    text-decoration: underline;
}

/* ========== QUICK CHIPS ========== */
.quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.quick-chip {
    padding: 5px 12px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 20px;
    background: rgba(255,255,255,0.06);
    color: #ccc;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-chip:hover {
    background: rgba(58,123,213,0.3);
    border-color: #3a7bd5;
    color: #fff;
}

.quick-chip.active {
    background: linear-gradient(90deg, #3a7bd5, #00d2ff);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

/* ========== ALERT PANEL ========== */
.alert-panel {
    margin-top: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255,255,255,0.03);
}

.alert-toggle {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: none;
    color: #ccc;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 14px 18px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.alert-toggle:hover {
    background: rgba(255,255,255,0.09);
    color: #fff;
}

.alert-badge {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 700;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    color: #fff;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.alert-badge.hidden {
    display: none;
}

.alert-body {
    padding: 18px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.alert-body.hidden {
    display: none;
}

.alert-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.save-alert-btn {
    flex: 2;
    padding: 11px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(90deg, #3a7bd5, #00d2ff);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s;
}

.save-alert-btn:hover { transform: translateY(-1px); }

.test-alert-btn {
    flex: 1;
    padding: 11px;
    border: 1px solid rgba(245,158,11,0.4);
    border-radius: 10px;
    background: rgba(245,158,11,0.12);
    color: #f59e0b;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.test-alert-btn:hover { background: rgba(245,158,11,0.25); }

.clear-alert-btn {
    flex: 1;
    padding: 11px;
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 10px;
    background: rgba(239,68,68,0.1);
    color: #f87171;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.clear-alert-btn:hover { background: rgba(239,68,68,0.22); }

.alert-status {
    margin-top: 12px;
    font-size: 0.85rem;
    color: #aaa;
    min-height: 1.2em;
    line-height: 1.5;
}

.alert-status.success { color: #4ade80; }
.alert-status.error { color: #f87171; }

/* ── Active Alerts Panel ────────────────────────────────────────────────── */
.active-alerts-panel {
    margin-top: 14px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255,255,255,0.03);
}

.active-alerts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: rgba(255,255,255,0.05);
    font-size: 0.9rem;
    font-weight: 600;
    color: #ccc;
}

.refresh-alerts-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}
.refresh-alerts-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }

.active-alerts-list {
    padding: 10px 14px 14px;
}

.no-alerts-msg {
    margin: 6px 0;
    font-size: 0.83rem;
    color: #777;
    text-align: center;
}

.active-alert-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
}
.active-alert-card:last-child { margin-bottom: 0; }

.active-alert-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.active-alert-dest {
    font-size: 0.92rem;
    font-weight: 700;
    color: #e2e8f0;
}

.active-alert-dates {
    font-size: 0.8rem;
    color: #94a3b8;
}

.active-alert-meta {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.active-alert-delete {
    flex-shrink: 0;
    background: none;
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 8px;
    color: #f87171;
    font-size: 0.85rem;
    padding: 5px 9px;
    cursor: pointer;
    transition: background 0.2s;
}
.active-alert-delete:hover { background: rgba(239,68,68,0.2); }
