/* ============================================================
   BusGo - Seat Layout Stylesheet
   ============================================================ */

.seat-selection-wrapper {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* ---- Bus Layout Container ---- */
.bus-layout-container {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    flex: 1;
    min-width: 280px;
}

.bus-layout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.bus-layout-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e1e2f;
}

.deck-tabs {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.deck-tab {
    padding: 8px 24px;
    border-radius: 30px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
    color: #475569;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.deck-tab:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}
.deck-tab.active {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border-color: #4f46e5;
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2), 0 2px 4px -2px rgba(79, 70, 229, 0.2);
}

/* ---- Bus Shape ---- */
.bus-shape {
    border: 2px solid #e9ecef;
    border-radius: 16px 16px 8px 8px;
    padding: 16px;
    position: relative;
    background: #fafbff;
    width: fit-content;
    min-width: 250px;
    max-width: 360px;
    margin: 0 auto;
}

.bus-front {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 8px 8px 0 0;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    color: #fff;
    font-size: .8rem;
    font-weight: 600;
}

.bus-driver {
    display: flex;
    align-items: center;
    gap: 6px;
}

.steering { font-size: 1.2rem; }

/* ---- Seat Grid ---- */
.seat-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.seat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.seat-row-number {
    width: 20px;
    font-size: .7rem;
    color: #b2bec3;
    font-weight: 600;
    flex-shrink: 0;
    text-align: center;
}

.seat-group {
    display: flex;
    gap: 6px;
}

.seat-aisle {
    width: 24px;
    flex-shrink: 0;
}

.seat-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.seat-price-under {
    font-size: 0.65rem;
    font-weight: 700;
    color: #64748b;
    margin-top: 1px;
    transition: color 0.2s ease, font-weight 0.2s ease;
}

.seat.selected + .seat-price-under {
    color: #4f46e5;
    font-weight: 800;
}

/* ---- Individual Seat ---- */
.seat {
    width: 38px;
    height: 38px;
    border-radius: 8px 8px 4px 4px;
    border: 2px solid;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
    font-weight: 700;
    position: relative;
    transition: all .2s ease;
    user-select: none;
    flex-shrink: 0;
}

.seat::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 4px;
    right: 4px;
    height: 4px;
    border-radius: 4px 4px 0 0;
    background: inherit;
    filter: brightness(0.85);
}

/* Sleeper seat shape */
.seat.sleeper {
    width: 60px;
    height: 32px;
    border-radius: 6px;
    writing-mode: horizontal-tb;
}

.seat.sleeper::before {
    top: auto;
    bottom: -3px;
    left: -4px;
    right: auto;
    width: 4px;
    top: 4px;
    height: auto;
    bottom: 4px;
    border-radius: 4px 0 0 4px;
    background: inherit;
}

/* Semi-Sleeper seat shape */
.seat.semi-sleeper {
    border-radius: 10px 10px 5px 5px;
    border-width: 2px;
    position: relative;
}

.seat.semi-sleeper::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 6px;
    right: 6px;
    height: 4px;
    background: currentColor;
    opacity: 0.45;
    border-radius: 2px;
    transition: background-color 0.2s ease;
}

/* ---- Seat Status Colors ---- */
.seat.available {
    background: #eafaf1;
    border-color: #00b894;
    color: #00b894;
}
.seat.available:hover {
    background: #00b894;
    color: #fff;
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0,184,148,.3);
    z-index: 2;
}

.seat.window.available {
    background: #e0f2fe;
    border-color: #0284c7;
    color: #0284c7;
    border-style: dashed;
}
.seat.window.available:hover {
    background: #0284c7;
    color: #fff;
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(2,132,199,.3);
    z-index: 2;
}

.seat.premium.available {
    background: #fffbeb;
    border-color: #d97706;
    color: #d97706;
}
.seat.premium.available:hover {
    background: #d97706;
    color: #fff;
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(217,119,6,.3);
    z-index: 2;
}

.seat.sleeper.available {
    background: #e0e7ff;
    border-color: #4f46e5;
    color: #4f46e5;
}
.seat.sleeper.available:hover {
    background: #4f46e5;
    color: #fff;
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(79,70,229,.3);
    z-index: 2;
}

.seat.semi-sleeper.available {
    background: #fff7ed;
    border-color: #ea580c;
    color: #ea580c;
}
.seat.semi-sleeper.available:hover {
    background: #ea580c;
    color: #fff;
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(234,88,12,.3);
    z-index: 2;
}

.seat.selected {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #667eea;
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102,126,234,.4);
    z-index: 2;
}

.seat.booked,
.seat.male_occupied {
    background: #ffeaa7;
    border-color: #fdcb6e;
    color: #b8860b;
    cursor: not-allowed;
}

.seat.female_occupied {
    background: #fce4ec;
    border-color: #f48fb1;
    color: #880e4f;
    cursor: not-allowed;
}

.seat.hold {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
    cursor: not-allowed;
    animation: pulse-hold 1.5s infinite;
}

.seat.blocked,
.seat.reserved {
    background: #f0f0f0;
    border-color: #bdc3c7;
    color: #bdc3c7;
    cursor: not-allowed;
}

.seat.ladies {
    /* Green for ladies, but overridden by status */
}
.seat.ladies.available {
    border-color: #e91e63;
    background: #fdf2f8;
    color: #e91e63;
}
.seat.ladies.available:hover {
    background: #e91e63;
    color: #fff;
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(233,30,99,.3);
    z-index: 2;
}
.seat.ladies.available::after {
    content: '♀';
    position: absolute;
    top: -8px; right: -4px;
    font-size: .6rem;
    color: #e91e63;
}

.seat.window.available { border-style: dashed; }

.seat.available + .seat-price-under { color: #00b894; }
.seat.window.available + .seat-price-under { color: #0284c7; }
.seat.premium.available + .seat-price-under { color: #d97706; }
.seat.sleeper.available + .seat-price-under { color: #4f46e5; }
.seat.semi-sleeper.available + .seat-price-under { color: #ea580c; }
.seat.ladies.available + .seat-price-under { color: #e91e63; }

@keyframes pulse-hold {
    0%,100% { opacity: 1; }
    50% { opacity: .6; }
}

/* ---- Seat Tooltip ---- */
.seat-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30,30,47,.9);
    color: #fff;
    font-size: .7rem;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s;
    z-index: 100;
}
.seat-tooltip::after {
    content: '';
    position: absolute;
    top: 100%; left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(30,30,47,.9);
}
.seat:hover .seat-tooltip { opacity: 1; }

/* ---- Legend ---- */
.seat-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .78rem;
    color: #636e72;
    font-weight: 500;
}

.legend-seat {
    width: 22px; height: 22px;
    border-radius: 5px 5px 3px 3px;
    border: 2px solid;
    flex-shrink: 0;
}
.legend-seat.available { background: #eafaf1; border-color: #00b894; }
.legend-seat.selected  { background: #667eea; border-color: #667eea; }
.legend-seat.booked    { background: #ffeaa7; border-color: #fdcb6e; }
.legend-seat.female    { background: #fce4ec; border-color: #f48fb1; }
.legend-seat.blocked   { background: #f0f0f0; border-color: #bdc3c7; }
.legend-seat.hold      { background: #fff3cd; border-color: #ffc107; }

/* ---- Selected Seats Panel ---- */
.selected-seats-panel {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.1);
    width: 100%;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    border-top: 4px solid #667eea;
    border-left: 1px solid rgba(102, 126, 234, 0.05);
    border-right: 1px solid rgba(102, 126, 234, 0.05);
    border-bottom: 1px solid rgba(102, 126, 234, 0.05);
}

.selected-seats-panel h6 {
    font-weight: 800;
    margin-bottom: 18px;
    color: #1e1e2f;
    font-size: 1.05rem;
    letter-spacing: 0.2px;
}

.selected-seat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 14px;
    background: rgba(102, 126, 234, 0.04);
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.selected-seat-item:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.08);
}

.selected-seat-num {
    font-weight: 800;
    font-size: 0.95rem;
    color: #667eea;
}

.selected-seat-price {
    font-weight: 700;
    font-size: 0.9rem;
    color: #2d3748;
}

.remove-seat {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffebe9;
    border: none;
    color: #e17055;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}
.remove-seat:hover {
    background: #e17055;
    color: #fff;
    transform: scale(1.1);
}

.total-fare-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 8px 0;
    border-top: 2px dashed #e2e8f0;
    margin-top: 14px;
    font-weight: 800;
}

.total-fare-amount {
    font-size: 1.35rem;
    color: #4f46e5;
}

.btn-proceed {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 16px;
    transition: all 0.25s ease;
    letter-spacing: 0.4px;
}
.btn-proceed:hover:not(:disabled) {
    background: linear-gradient(135deg, #4338ca, #6d28d9);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
}
.btn-proceed:active:not(:disabled) {
    transform: translateY(0);
}
.btn-proceed:disabled {
    background: #e2e8f0;
    color: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ---- Live status badge ---- */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
}
.live-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #2e7d32;
    animation: blink 1s infinite;
}
@keyframes blink {
    0%,100% { opacity: 1; }
    50% { opacity: .3; }
}

/* ---- Responsive ---- */
@media (max-width: 991px) {
    body.seat-selection-page {
        padding-bottom: 140px !important;
    }

    .seat-selection-wrapper {
        flex-direction: column;
    }

    .selected-seats-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: none;
        z-index: 1050;
        border-radius: 20px 20px 0 0;
        border: none;
        border-top: 4px solid #667eea;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        padding: 12px 20px 16px 20px !important;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
        margin: 0 !important;
        display: grid !important;
        grid-template-columns: auto 1fr;
        grid-template-areas: 
            "list list"
            "fare form";
        align-items: center;
        column-gap: 16px;
    }

    .selected-seats-panel h6,
    .selected-seats-panel .mt-3.p-3.bg-light.rounded,
    .selected-seats-panel .text-muted[style*="font-size:.75rem"] {
        display: none !important;
    }

    .selected-seats-panel .seat-list {
        grid-area: list;
        width: 100%;
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
        margin-bottom: 4px;
        scrollbar-width: none;
    }
    .selected-seats-panel .seat-list::-webkit-scrollbar {
        display: none;
    }

    .selected-seats-panel .selected-seat-item {
        flex: 0 0 auto;
        margin-bottom: 0 !important;
        padding: 6px 12px !important;
        gap: 6px;
        font-size: 0.85rem;
    }

    .selected-seats-panel .selected-seat-item:hover {
        transform: none !important;
    }

    .selected-seats-panel .total-fare-row {
        grid-area: fare;
        border-top: none !important;
        margin-top: 0 !important;
        padding: 0 !important;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
    }

    .selected-seats-panel .total-fare-row span:first-child {
        font-size: 0.7rem;
        color: #718096;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .selected-seats-panel .total-fare-amount {
        font-size: 1.25rem !important;
        line-height: 1.2;
    }

    .selected-seats-panel form {
        grid-area: form;
        margin: 0 !important;
    }

    .selected-seats-panel .btn-proceed {
        margin-top: 0 !important;
        padding: 12px 16px !important;
        font-size: 0.9rem !important;
        border-radius: 10px !important;
        white-space: nowrap;
    }
}

@media (max-width: 767px) {
    .seat { width: 32px; height: 32px; font-size: .6rem; }
    .seat.sleeper { width: 50px; height: 28px; }
    .bus-shape { padding: 12px; }
    .seat-row { gap: 5px; }
    .seat-group { gap: 4px; }
}
