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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f1923;
    color: #e0e6ed;
    min-height: 100vh;
}

a {
    color: #ff6b00;
}

/* Header */
header {
    background: linear-gradient(135deg, #ff6b00, #ff8c33);
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 20px rgba(255, 107, 0, 0.3);
}

.header-content h1 {
    font-size: 1.8rem;
    color: #fff;
    font-weight: 700;
}

.subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Main */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Cards */
.card {
    background: #1a2633;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #2a3a4a;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #ff8c33;
}

/* API Setup */
.input-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.input-group input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: #0f1923;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    color: #e0e6ed;
    font-size: 0.95rem;
}

.input-group input:focus {
    outline: none;
    border-color: #ff6b00;
}

button, #save-key-btn, #refresh-btn {
    padding: 0.75rem 1.5rem;
    background: #ff6b00;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s;
}

button:hover {
    background: #e65e00;
}

/* Stats */
#stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #1a2633;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    border: 1px solid #2a3a4a;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #ff8c33;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: #8899aa;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab {
    flex: 1;
    padding: 0.85rem 1.5rem;
    background: #1a2633;
    color: #8899aa;
    border: 1px solid #2a3a4a;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.tab:hover {
    background: #223344;
    color: #e0e6ed;
}

.tab.active {
    background: #ff6b00;
    color: #fff;
    border-color: #ff6b00;
}

/* Route Search */
.route-search-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1rem;
    background: #1a2633;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #2a3a4a;
}

.route-field {
    flex: 1;
}

.route-field label {
    display: block;
    font-size: 0.75rem;
    color: #8899aa;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.route-field input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #0f1923;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    color: #ff8c33;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.route-field input:focus {
    outline: none;
    border-color: #ff6b00;
}

.route-field input::placeholder {
    color: #3a4a5a;
    font-weight: 400;
    font-size: 0.85rem;
}

.route-swap {
    font-size: 1.5rem;
    color: #ff6b00;
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.2s;
    user-select: none;
    margin-bottom: 0.25rem;
}

.route-swap:hover {
    transform: scale(1.3);
}

/* Controls */
.search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.search-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: #1a2633;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    color: #e0e6ed;
    font-size: 0.95rem;
}

.search-bar input:focus {
    outline: none;
    border-color: #ff6b00;
}

.search-bar select {
    padding: 0.75rem 1rem;
    background: #1a2633;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    color: #e0e6ed;
    font-size: 0.95rem;
    cursor: pointer;
}

/* Map */
#map-section {
    margin-bottom: 1.5rem;
}

#map {
    height: 450px;
    border-radius: 12px;
    border: 1px solid #2a3a4a;
    z-index: 1;
}

/* Flight List */
#flight-list-section h2 {
    color: #ff8c33;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

#flight-count {
    font-size: 0.85rem;
    color: #8899aa;
    font-weight: 400;
}

#flight-list {
    display: grid;
    gap: 0.75rem;
}

.flight-card {
    background: #1a2633;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    border: 1px solid #2a3a4a;
    display: grid;
    grid-template-columns: 100px 1fr 1fr 100px;
    align-items: center;
    gap: 1rem;
    transition: border-color 0.2s;
}

.flight-card:hover {
    border-color: #ff6b00;
}

.flight-number {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
}

.flight-route {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.airport-code {
    font-weight: 600;
    color: #ff8c33;
    font-size: 1rem;
}

.route-arrow {
    color: #556677;
    font-size: 1.2rem;
}

.flight-details {
    font-size: 0.85rem;
    color: #8899aa;
}

.flight-details span {
    display: block;
    margin-top: 0.15rem;
}

.status-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.03em;
}

.status-en-route {
    background: rgba(0, 200, 83, 0.15);
    color: #00c853;
}

.status-landed {
    background: rgba(41, 121, 255, 0.15);
    color: #2979ff;
}

.status-scheduled {
    background: rgba(255, 171, 0, 0.15);
    color: #ffab00;
}

/* Flight Lookup */
.flight-lookup-section {
    margin-bottom: 1.5rem;
}

.flight-lookup-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    background: #1a2633;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #2a3a4a;
}

.flight-lookup-field {
    flex: 1;
}

.flight-lookup-field label {
    display: block;
    font-size: 0.75rem;
    color: #8899aa;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.flight-lookup-field input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #0f1923;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    color: #ff8c33;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.flight-lookup-field input:focus {
    outline: none;
    border-color: #ff6b00;
}

.flight-lookup-field input::placeholder {
    color: #3a4a5a;
    font-weight: 400;
    font-size: 0.85rem;
    text-transform: none;
}

#flight-info {
    margin-bottom: 1.5rem;
}

.flight-info-card {
    background: #1a2633;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #2a3a4a;
}

.flight-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.flight-info-callsign {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
}

.flight-info-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.flight-info-airport {
    text-align: center;
}

.flight-info-airport .code {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ff8c33;
}

.flight-info-airport .name {
    font-size: 0.85rem;
    color: #8899aa;
    margin-top: 0.25rem;
}

.flight-info-arrow {
    font-size: 2rem;
    color: #556677;
    text-align: center;
}

.flight-info-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.flight-detail-item {
    background: #0f1923;
    border-radius: 8px;
    padding: 0.75rem;
}

.flight-detail-item .label {
    font-size: 0.7rem;
    color: #556677;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.flight-detail-item .value {
    font-size: 1rem;
    font-weight: 600;
    color: #e0e6ed;
    margin-top: 0.2rem;
}

.flight-info-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.flight-info-links a {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.2s;
}

.flight-link-primary {
    background: #ff6b00;
    color: #fff;
}

.flight-link-primary:hover {
    background: #e65e00;
    color: #fff;
}

.flight-link-secondary {
    background: #2a3a4a;
    color: #e0e6ed;
}

.flight-link-secondary:hover {
    background: #3a4a5a;
    color: #fff;
}

.flight-not-live {
    color: #8899aa;
    font-size: 0.9rem;
    text-align: center;
    padding: 1rem;
    background: #0f1923;
    border-radius: 8px;
    margin-bottom: 1.25rem;
}

.flight-schedule-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
    background: #0f1923;
    border-radius: 8px;
    padding: 1rem;
}

.schedule-col {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.schedule-title {
    font-weight: 600;
    color: #ff6b00;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #2a3a4a;
}

.schedule-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.schedule-row .label {
    color: #8899aa;
}

.schedule-row .value {
    color: #e0e6ed;
    font-weight: 500;
}

.schedule-row.delay .value {
    color: #ff5252;
}

.status-badge.status-scheduled {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.status-badge.status-cancelled {
    background: rgba(255, 82, 82, 0.15);
    color: #ff5252;
}

@media (max-width: 480px) {
    .flight-schedule-grid {
        grid-template-columns: 1fr;
    }
}

#flight-map {
    height: 400px;
    border-radius: 12px;
    border: 1px solid #2a3a4a;
    z-index: 1;
}

#flight-map-section {
    margin-bottom: 1.5rem;
}

/* Route Result */
#route-result {
    margin-bottom: 1.5rem;
}

.route-result-card {
    background: #1a2633;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #2a3a4a;
    text-align: center;
}

.route-result-card.route-found {
    border-color: #00c853;
}

.route-result-card.route-not-found {
    border-color: #ff5252;
}

.route-header {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.route-header .airport-highlight {
    color: #ff8c33;
}

.route-status {
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.route-status.available {
    color: #00c853;
}

.route-status.unavailable {
    color: #ff5252;
}

.route-link {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: #ff6b00;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s;
}

.route-link:hover {
    background: #e65e00;
    color: #fff;
}

/* Route Map */
#route-map-section {
    margin-bottom: 1.5rem;
}

#route-map {
    height: 400px;
    border-radius: 12px;
    border: 1px solid #2a3a4a;
    z-index: 1;
}

/* Destinations */
#destinations-section {
    margin-bottom: 1.5rem;
}

#destinations-section h2 {
    color: #ff8c33;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

#destinations-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.dest-card {
    background: #1a2633;
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid #2a3a4a;
    cursor: pointer;
    transition: border-color 0.2s;
}

.dest-card:hover {
    border-color: #ff6b00;
}

.dest-code {
    font-weight: 700;
    font-size: 1.1rem;
    color: #ff8c33;
}

.dest-name {
    font-size: 0.85rem;
    color: #8899aa;
    margin-top: 0.2rem;
}

.dest-count {
    font-size: 0.75rem;
    color: #556677;
    margin-top: 0.35rem;
}

/* Loading */
#loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #2a3a4a;
    border-top-color: #ff6b00;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error */
#error {
    background: rgba(255, 50, 50, 0.1);
    border: 1px solid rgba(255, 50, 50, 0.3);
    color: #ff6666;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: #556677;
    font-size: 0.85rem;
}

.footer-note {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #3a4a5a;
}

/* Responsive */
@media (max-width: 768px) {
    #stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .flight-card {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }

    .search-bar {
        flex-direction: column;
    }

    #map {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .input-group {
        flex-direction: column;
    }

    .flight-card {
        grid-template-columns: 1fr;
    }
}
