@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

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

.navbar {
    background-color: #050811 !important;
    border-bottom: 1px solid #1e293b;
}

.navbar-brand {
    color: #cbd5e1 !important;
    font-weight: 600;
}

/* Navbar Layout Fixes */
nav .max-w-7xl {
    width: 100%;
}

nav .flex.justify-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav .flex.items-center.justify-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #050811;
    /* Deep dark blue/black specific to the image */
    background-image: radial-gradient(circle at 50% 0%, #0f1c30 0%, #050811 60%);
    color: #cbd5e1;
    line-height: 1.5;
    min-height: 100vh;
}

.fids-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.fids-header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 2.25rem;
    font-weight: 500;
    color: #475569;
}

.fids-header-title span {
    color: #475569;
}

.fids-header-title .icon {
    font-size: 2.25rem;
    filter: grayscale(100%) opacity(0.7);
}

.flights-table {
    width: 100%;
    border-collapse: collapse;
}

/* Date Header Row styling */
.date-header {
    background-color: #2D2A20;
    /* Dark brownish gold background */
    color: #C2B07E;
    /* Gold/Beige text */
    padding: 0.75rem;
    font-size: 1.1rem;
    font-weight: 500;
    text-transform: uppercase;
    border-top: 1px solid #48422F;
    border-bottom: 1px solid #48422F;
    margin-bottom: 0;
    /* Removing margin to connect with table */
}

/* Table Headers */
.flights-table thead th {
    text-align: left;
    padding: 1rem 0;
    /* Reduced horizontal padding, alignment handled by col spacing */
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    border-bottom: 1px solid #1e293b;
}

/* Column specific spacing */
.flights-table th:nth-child(1),
.flights-table td:nth-child(1) {
    width: 10%;
    padding-left: 1.5rem;
}

.flights-table th:nth-child(2),
.flights-table td:nth-child(2) {
    width: 15%;
}

.flights-table th:nth-child(3),
.flights-table td:nth-child(3) {
    width: 10%;
}

.flights-table th:nth-child(4),
.flights-table td:nth-child(4) {
    width: 30%;
}

.flights-table th:nth-child(5),
.flights-table td:nth-child(5) {
    width: 25%;
    text-align: right;
}

.flights-table th:nth-child(6),
.flights-table td:nth-child(6) {
    width: 10%;
    text-align: right;
}

.flights-table tbody tr {
    border-bottom: 1px solid #1e293b;
}

.flights-table tbody td {
    vertical-align: middle;
}

/* Time Column */
.flight-time {
    color: #3b82f6;
    /* Bright blue */
    font-weight: 500;
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
}

/* Airline Logo */
.airline-logo-container {
    display: flex;
    align-items: center;
}

.airline-logo {
    /* Dark grey container */
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    width: 120px;
    /* Fixed width for logo box */
}

.airline-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
    /* Make logos white if they are dark, or remove if logos are colored */
}

/* User might want colored logos, removing filter if needed. The image shows white text logos on dark bg. keeping simple. */
.airline-logo img {
    filter: none;
}

/* Flight NUmber */
.flight-number {
    font-size: 1.25rem;
    color: #f1f5f9;
    font-weight: 400;
}

/* Destination / City */
.flight-destination {
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    color: #f1f5f9;
}

.flight-destination .code {
    color: #64748b;
    font-size: 1.1rem;
}

/* Status Badges */
.flight-status {
    text-align: right;
}

.status-badge {
    display: inline-block;
    padding: 0.4rem;
    border-radius: 9999px;
    /* Pill shape */
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    border: 1px solid transparent;
    text-align: center;
    min-width: 140px;
}

/* Status variants */
.status-boarding,
.status-arrived,
.status-landed {
    /* Green */
    color: #94a3b8;
    background: transparent;
    /* Image has 'Posadka' in green outline/fill? Image shows 'Posadka' as green outline with dark fill */
    background: rgba(34, 197, 94, 0.05);
}

.status-delayed,
.status-cancelled {
    /* Red */
    color: #f87171;
    background: rgba(239, 68, 68, 0.05);
}

.status-departed,
.status-departing {
    /* Blue */
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.05);
}

.status-waiting,
.status-scheduled,
.status-checkin,
.status-registration {
    /* Grey/Outline */
    color: #4ade80;
    background: transparent;
}

/* Gate */
.flight-gate {
    font-size: 1.35rem;
    color: #f1f5f9;
    text-align: right;
    font-weight: 500;
}


.empty-state {
    text-align: center;
    padding: 4rem;
    color: #64748b;
    font-size: 1.5rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {

    /* Container */
    .fids-container {
        padding: 1rem;
    }

    /* Header */
    .fids-header-title {
        font-size: 1.75rem;
        justify-content: center;
        margin-bottom: 1.5rem;
    }

    .date-header {
        text-align: center;
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
        margin-bottom: 1rem;
    }

    /* Transform Table to Card Layout */
    .flights-table thead {
        display: none;
    }

    .flights-table tbody tr {
        display: grid;
        grid-template-columns: 80px 1fr auto;
        /* Col 1 Time, Col 2 Info, Col 3 Gate */
        gap: 0.25rem 0.5rem;
        background: #0b1322;
        /* Slightly Lighter Dark */
        border: 1px solid #1e293b;
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        align-items: center;
    }

    /* Generic cell reset */
    .flights-table td {
        padding: 0 !important;
        border: none !important;
        width: auto !important;
        display: block;
    }

    /* 1. Time - Top Left */
    .flights-table td:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
        text-align: left;
        font-size: 1.25rem;
        font-weight: 600;
    }

    /* 2. Airline Logo - Row 2 Left */
    .flights-table td:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
        padding-top: 0.5rem !important;
    }

    .airline-logo {
        height: 32px;
        width: 60px;
        padding: 2px;
        background: transparent;
        /* Remove box bg on mobile for cleaner look? No, nice to keep visual weight */
        background: #1e293b;
    }

    /* 3. Flight Number - Row 2 Middle */
    .flights-table td:nth-child(3) {
        grid-column: 2 / span 2;
        grid-row: 2;
        font-size: 1rem;
        color: #94a3b8;
        padding-top: 0.5rem !important;
        padding-left: 0.5rem !important;
    }

    /* Combine logo and flight number visually better? */
    /* Let's try flight number next to logo */

    /* 4. Destination - Row 1 Middle (span to gate) */
    .flights-table td:nth-child(4) {
        grid-column: 2 / -1;
        /* Fill remaining space on Row 1 */
    }

    /* 5. Status - Row 3 Full Width */
    .flights-table td:nth-child(5) {
        grid-column: 1 / -1;
        grid-row: 3;
        text-align: center;
        padding-top: 1rem !important;
    }

    .status-badge {
        width: 100%;
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    /* 6. Gate - Hidden/Moved to end of Row 1? No, Destination is long. */
    /* Let's Try: Time | Destination
                 Logo | Flight No | Gate (Right) */

    .flights-table td:nth-child(6) {
        grid-column: 3;
        grid-row: 2;
        text-align: right;
        font-size: 1.25rem;
        color: #fbbf24;
        font-weight: 600;
        padding-top: 0.5rem !important;
    }

    /* Adjust destination to only span 1 column if gate is there? No gate is Row 2 now. */

    /* Let's refine Destination to not hit the edge too hard */
    .flights-table td:nth-child(4) {
        grid-column: 2 / -1;
        /* Fill remaining space on Row 1 */
    }
}

/* Navbar Controls Responsiveness */
.fids-nav-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0;
}

.fids-nav-controls form {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.fids-nav-controls .form-select {
    background-color: transparent;
    color: #f1f5f9;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 1rem;
    min-width: 150px;
    cursor: pointer;
    transition: all 0.2s;
}

.fids-nav-controls .form-select:hover {
    border-color: #3b82f6;
}

.fids-nav-controls .form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.fids-nav-controls .form-select option {
    background-color: #0b1322;
    color: #f1f5f9;
}

.fids-nav-controls .btn-submit {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.fids-nav-controls .btn-submit:hover {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.navbar .container {
    position: relative;
}

@media (max-width: 768px) {

    /* Navbar Mobile Fixes */
    nav .max-w-7xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    nav .flex.justify-between {
        flex-direction: column;
        align-items: stretch;
        height: auto;
        min-height: 4rem;
        padding: 0.75rem 0;
    }

    nav .flex.justify-between>.flex {
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }

    nav .flex.items-center.justify-center {
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .navbar {
        padding-bottom: 0;
    }

    .navbar .container {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .fids-nav-controls {
        position: static;
        transform: none;
        width: 100%;
        padding: 0.5rem 0;
    }

    /* Adjust inner form elements for mobile */
    .fids-nav-controls form {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }

    .fids-nav-controls .form-select {
        width: 100%;
        min-width: unset;
        font-size: 0.95rem;
        padding: 0.625rem 2rem 0.625rem 0.75rem;
    }

    .fids-nav-controls .btn-submit {
        width: 100%;
        padding: 0.625rem 1rem;
        font-size: 0.95rem;
    }



    /* Date Row Mobile Override */
    .flights-table tbody tr.date-row {
        display: block;
        padding: 0;
        border: none;
        background: transparent;
        box-shadow: none;
    }

    .flights-table tbody tr.date-row td {
        display: block;
        width: 100% !important;
    }

    .flights-table tbody tr.date-row .date-header {
        width: 100%;
        box-sizing: border-box;
        border-radius: 12px;
        background-color: #2D2A20;
        /* Ensure bg is kept or adjust if needed */
        margin-bottom: 0.5rem;
        /* Space below date */
    }
}

/* Index Page Styling */
.fids-select-head {
    text-align: center;
    padding: 1rem 0 2.5rem;
}

.fids-select-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.9rem;
    border: 1px solid rgba(213, 161, 7, 0.35);
    border-radius: 9999px;
    background: rgba(213, 161, 7, 0.08);
    color: #d5a107;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.fids-select-eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 9999px;
    background: #d5a107;
    box-shadow: 0 0 0 4px rgba(213, 161, 7, 0.14);
}

.fids-select-title {
    margin-top: 1.1rem;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 600;
    color: #e2e8f0;
    letter-spacing: -0.01em;
}

.airport-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1.25rem;
}

.airport-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    border: 1px solid #1e293b;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(15, 28, 48, 0.75) 0%, rgba(8, 14, 26, 0.55) 100%);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.airport-card:hover {
    transform: translateY(-4px);
    border-color: rgba(72, 92, 165, 0.7);
    box-shadow: 0 18px 34px -18px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(72, 92, 165, 0.22);
}

.airport-card-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.airport-code {
    flex-shrink: 0;
    min-width: 64px;
    padding: 0.4rem 0.6rem;
    border: 1px solid rgba(72, 92, 165, 0.45);
    border-radius: 10px;
    background: rgba(72, 92, 165, 0.16);
    color: #97a8e0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.airport-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f1f5f9;
}

.airport-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
}

.airport-actions form {
    flex: 1;
}

.btn-fids {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.7rem 0.5rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-fids svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex-shrink: 0;
}

.btn-fids:focus-visible {
    outline: 2px solid #97a8e0;
    outline-offset: 2px;
}

.btn-arrival {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.btn-arrival:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
    color: #4ade80;
}

.btn-departure {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.btn-departure:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    color: #60a5fa;
}

@media (max-width: 768px) {
    .fids-select-head {
        padding: 0.5rem 0 1.75rem;
    }

    .airport-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .airport-card {
        gap: 1.1rem;
        padding: 1.25rem;
        background: #0b1322;
        /* Solid background on mobile matching flights list */
    }
}

@media (prefers-reduced-motion: reduce) {

    .airport-card,
    .btn-fids {
        transition: none;
    }

    .airport-card:hover {
        transform: none;
    }
}