.filter-btn:hover, .filter-tag:hover {
    background-color: var(--control-bg-hover);
}

/* --- TICKET LIST & CARDS --- */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    /* Tata letak kartu mengikuti lebar daftar (bukan viewport) — lihat @container di bawah. */
    container-type: inline-size;
    container-name: tickets;
}

.ticket-card {
    background-color: var(--surface-color);
    border-radius: 16px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px; /* Ensures space between columns even on smaller screens */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    border: 2px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden; /* Keeps contents inside */
}

/* Hover and Selected state */


.ticket-card:hover, .ticket-card.selected {
    border-color: #2E79C1;
    box-shadow: 0 4px 12px rgba(46, 121, 193, 0.15);
}

/* Menyorot kartu tiket saat pengguna kembali lewat "Pesan Lagi" */
.ticket-highlight .ticket-card {
    animation: ticket-pulse 1.6s ease;
}

@keyframes ticket-pulse {
    0%, 100% {
        border-color: transparent;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    }
    25% {
        border-color: #2E79C1;
        box-shadow: 0 0 0 4px rgba(46, 121, 193, 0.25);
    }
}

/* Airline Branding */
.airline-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 120px;
    flex-shrink: 0; /* CRITICAL: Forces the logo to always stay visible */
}

.airline-info img {
    width: 100%;
    margin-bottom: 8px;
    display: block; /* Helps broken image text behave */
}

.airline-name {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
}

/* Flight Legs (Pergi / Pulang) */
.flight-details {
    display: flex;
    flex-grow: 1; 
    justify-content: start;     /* Keeps the separators short to match text height */
    padding-left: 0;
    gap: 0; /* Remove the 200px gap, we will use padding instead */
}

.flight-detail-row img{
    width: 20px;
}

.flight-details img {
    width: 20px;
    position: relative;
}

/* Kedua leg berbagi ruang sisa sama rata, tapi tidak pernah lebih sempit
   dari isinya — padding tetap 100px dulu membuat kartu meluap dan tombol
   "Pilih Tiket" terpotong di layar ~1600px. */
.flight-leg {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 1 0;
    min-width: max-content;
    gap: 6px;
    padding: 0 24px;
}

.flight-leg:first-child {
    border-right: 2px solid var(--border-soft); 
}

.route {
    font-size: 16px;
    color: var(--text-color);
    white-space: nowrap; /* Prevents location names from wrapping */
}

.time-details {
    font-size: 16px;
    color: var(--text-color);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap; /* Prevents times from wrapping */
}

.time-date {
    font-weight: 750;
}

/* --- TAB MENU CONTAINER --- */
.tab-menu-container {
    padding-top: 3%;
    padding-left: 1%;
    width: 100%;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 24px;
}

/* --- TAB LIST LAYOUT --- */
.tab-list {
    display: flex;
    align-items: flex-start;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 32px;
}

/* --- TAB ITEM (ICON BADGE + LABEL) --- */
.tab-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.tab-badge {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-muted);
    color: var(--text-subtle);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.tab-badge svg {
    width: 22px;
    height: 22px;
}

.tab-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.tab-buy .tab-badge     { --tab-color: #2E79C1; }
.tab-booking .tab-badge { --tab-color: #1B5E20; }
.tab-history .tab-badge { --tab-color: #6B7280; }
.tab-refund .tab-badge { --tab-color: #D97706; }

.tab-link.active .tab-badge {
    background-color: var(--tab-color, #2E79C1);
    color: #FFFFFF;
}

.tab-link.active .tab-label {
    color: var(--tab-color, #2E79C1);
}

/* --- TAB CONTENT SECTIONS --- */
.tab-content {
    display: none; /* Hides all content by default */
    background-color: var(--bg-color);
}

/* This class will be toggled by JavaScript to show the current tab */
.tab-content.active-content {
    display: block; 
}


.time-details span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap; /* Stops '06' and 'Sep' from splitting onto new lines */
}

.time-details .divider {
    color: var(--text-subtle);
    font-weight: 400;
}

/* Pricing Section */
.price-container {
    display: flex;
    flex-direction: column;
    text-align: left;
    padding-left: 25px;
    padding-right: 25px;
    width: auto; /* CRITICAL: Replaced your 340px with auto */
    min-width: 170px;
    flex-shrink: 0;
    border-left: 1px solid var(--border-soft); 
}



.price-container .duration {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.price-container .price {
    font-size: 23px;
    font-weight: 700;
    color: var(--text-color);
}

/* Action Button */
.action-container {
    flex-shrink: 0; /* PREVENTS SQUISHING */
}

.btn-pilih {
    background-color: #2E79C1;
    color: #FFFFFF;
    border: none;
    padding: 12px 44px;
    border-radius: 999px;
    font-size: 15px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap; /* Keeps "Pilih Tiket" on one line */
}

.btn-pilih:hover {
    background-color: #2463A0;
}

/* --- ACTIVE TICKETS GRID --- */
.active-ticket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(550px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* --- ACTIVE TICKET CARD CONTAINER --- */
.active-ticket-card {
    background-color: var(--surface-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.active-ticket-card:hover {
    border-color: #2E79C1;
    box-shadow: 0 4px 12px rgba(46, 121, 193, 0.15);
}

/* --- MAIN INFO ROW --- */
.ticket-main-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 15px;
    gap: 15px;
}

/* Airline Logo Column */
.airline-column {
    width: 110px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.airline-column img {
    width: 100%;
    object-fit: contain;
}

/* Flight Details Column */
.flight-info-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.route-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 4px;
}

.flight-detail-row {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Booking ID & Gate Column */
.booking-id-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 110px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    color: var(--green-text);
    background-color: var(--green-bg);
    padding: 3px 8px;
    border-radius: 20px;
    width: fit-content;
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: #28a745;
    border-radius: 50%;
}

.meta-block {
    display: flex;
    flex-direction: column;
}

.meta-grid {
    display: flex;
    gap: 15px;
}

.meta-label {
    font-size: 11px;
    color: var(--text-muted);
}

.meta-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-color);
}

.qr-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.qr-img {
    width: 70px;
    height: 70px;
    object-fit: contain;
}

.lihat-eticket {
    font-size: 11px;
    color: #2E79C1;
    text-decoration: none;
    font-weight: 600;
}

.lihat-eticket:hover {
    text-decoration: underline;
}

.ticket-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.action-btn {
    flex: 1;
    background-color: var(--bg-color);
    border: none;
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
}

.action-btn:hover {
    background-color: var(--control-bg);
}

.action-btn.success {
    background-color: var(--green-bg);
    color: var(--green-text);
}

.action-btn.success:hover {
    background-color: var(--green-bg-hover);
}

/* --- BOOKING EXPANSION STYLES --- */
/* Wrapper to hold the card and the form together */
.ticket-wrapper {
    background-color: transparent;
    border-radius: 16px;
    margin-bottom: 15px;
    transition: all 0.2s ease;
}

/* The booking form container - HIDDEN BY DEFAULT */
.booking-form {
    display: none;
    padding: 25px;
    background-color: var(--surface-color);
    border-top: 1px dashed var(--border-color);
    border-radius: 0 0 16px 16px;
    margin-top: -10px; /* Snug up against the card */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
}

/* When the wrapper is active/booking, highlight it with a blue border */
.ticket-wrapper.active-booking {
    border: 2px solid #2E79C1;
    box-shadow: 0 4px 12px rgba(46, 121, 193, 0.15);
    background-color: var(--surface-color);
    border-radius: 16px;
}

/* Show the form ONLY when the wrapper has the 'active-booking' class */
.ticket-wrapper.active-booking .booking-form {
    display: block;
}

/* Remove card background duplication inside wrapper */
.ticket-wrapper .ticket-card {
    margin-bottom: 0;
}

/* Form Styles */
.booking-title {
    font-size: 18px;
    color: var(--text-color);
    margin-bottom: 15px;
}

/* --- ACTIVE TICKET CARD STYLING (Matching the screenshot) --- */
.active-ticket-card {
    background-color: var(--surface-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

/* Hover effect */
.active-ticket-card:hover {
    box-shadow: 0 4px 12px rgba(46, 121, 193, 0.15);
}

/* Selected/Active state with blue border matching the reference image */
.active-ticket-card.selected, 
.active-ticket-card:active {
    border-color: #2E79C1;
    box-shadow: 0 4px 12px rgba(46, 121, 193, 0.15);
}
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.booking-input {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    background: var(--surface-color);
}

.booking-input:focus {
    border-color: #2E79C1;
}

/* Footer & Action Button */
.booking-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-soft);
    padding-top: 20px;
}

.total-price {
    font-size: 14px;
    color: var(--text-secondary);
}

.total-price span {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    margin-left: 10px;
}

.btn-lanjut {
    background-color: #28a745;
    color: #FFFFFF;
    border: none;
    padding: 12px 30px;
    border-radius: 999px;
    font-size: 15px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-lanjut:hover {
    background-color: #218838;
}

/* Change 'Batalkan' button style when active */
.ticket-wrapper.active-booking .btn-pilih {
    background-color: var(--red-bg);
    color: var(--red-text);
}

@media screen and (max-width: 1250px) {
    .tab-list {
        flex-wrap: wrap;
    }
    .ticket-controls {
        flex-wrap: wrap;
    }
}

/* Kartu tidak muat satu baris → harga & tombol turun ke bawah. */
@container tickets (max-width: 1180px) {
    .ticket-card {
        flex-wrap: wrap;
        padding: 20px;
    }

    .price-container {
        width: 100%;
        border-left: none;
        border-top: 2px solid var(--border-soft);
        padding-left: 0;
        padding-top: 15px;
        margin-top: 15px;
        flex-direction: row; /* Makes duration and price sit side-by-side */
        justify-content: space-between;
        align-items: center;
    }

    .action-container {
        width: 100%;
        margin-left: 0;
        margin-top: 15px;
    }

    .btn-pilih {
        width: 100%;
        padding: 15px;
    }
}

/* Dua leg tidak muat berdampingan → tumpuk. */
@container tickets (max-width: 820px) {
    /* Stack the flights vertically on phones */
    .flight-details {
        flex-direction: column;
        gap: 15px;
    }

    .flight-leg {
        align-items: flex-start;
        min-width: 0;
        padding: 0;
    }

    .flight-leg:first-child {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 15px;
    }

    .route,
    .time-details {
        white-space: normal;
        flex-wrap: wrap;
    }

    /* Move the airline logo to the top */
    .airline-info {
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        gap: 15px;
        border-bottom: 2px solid var(--border-soft);
        padding-bottom: 15px;
        margin-bottom: 15px;
    }

    .airline-info img {
        width: 64px;
        margin-bottom: 0;
    }
}

/* ---------- Ponsel (≤640px) ---------- */
@media screen and (max-width: 640px) {
    .tab-list {
        gap: 16px;
    }

    .tab-badge {
        width: 38px;
        height: 38px;
    }

    .tab-badge svg {
        width: 18px;
        height: 18px;
    }

    .tab-label {
        font-size: 11px;
        white-space: normal;
        max-width: 70px;
    }

    .active-ticket-grid {
        grid-template-columns: 1fr;
    }

    .ticket-main-info {
        flex-wrap: wrap;
        row-gap: 12px;
    }

    .airline-column {
        width: auto;
        flex-direction: row;
        gap: 8px;
    }

    .airline-column img {
        width: 40px;
    }

    .flight-info-column {
        flex-basis: 100%;
        order: 3;
    }

    .booking-id-column {
        min-width: 0;
    }

    .meta-grid {
        flex-wrap: wrap;
        row-gap: 6px;
    }

    .ticket-actions {
        flex-wrap: wrap;
    }

    .form-row {
        flex-wrap: wrap;
    }

    .booking-footer {
        flex-wrap: wrap;
        gap: 12px;
    }

    .btn-lanjut {
        width: 100%;
    }
}