/* =============================================
   GoSafar Seat Picker — RedBus-style v13
   Desktop: horizontal bus layout
   ============================================= */

.sm-container {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    width: 100%;
}

/* ── Top bar ── */
.sm-top-bar {
    border-bottom: 1px solid #e2e8f0;
}

.sm-price-filter {
    display: flex;
    align-items: stretch;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.sm-price-filter::-webkit-scrollbar { display: none; }

.sm-price-filter-all,
.sm-price-filter-item {
    flex: 0 0 auto;
    border: none;
    background: #fff;
    text-align: left;
    padding: .85rem 1.1rem;
    border-right: 1px solid #e2e8f0;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}

.sm-price-filter-all:hover,
.sm-price-filter-item:hover { background: #f8fafc; }

.sm-price-filter-all.is-active,
.sm-price-filter-item.is-active {
    background: #fff5ed;
    box-shadow: inset 0 -2px 0 #EA881D;
}

.sm-price-filter-label {
    display: block;
    font-size: .8125rem;
    font-weight: 700;
    color: #141823;
}

.sm-price-filter-count {
    display: block;
    font-size: .72rem;
    color: #64748b;
    margin-top: .15rem;
}

.sm-price-filter-fare {
    display: flex;
    align-items: baseline;
    gap: .35rem;
    flex-wrap: wrap;
}

.sm-price-fare {
    font-size: .875rem;
    font-weight: 800;
    color: #141823;
}

.sm-price-strike {
    font-size: .72rem;
    color: #94a3b8;
}

.sm-price-filter-seats {
    font-size: .68rem;
    color: #64748b;
    margin-top: .2rem;
}

.sm-deck-bar {
    display: flex;
    justify-content: center;
    padding: .55rem .75rem;
    background: #fff;
}

.sm-deck-toggle {
    position: relative;
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    width: 168px;
    padding: 3px;
    border-radius: 999px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.sm-deck-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(20, 24, 35, 0.12);
    transition: transform .25s ease;
    pointer-events: none;
}

.sm-deck-toggle-btn {
    position: relative;
    z-index: 1;
    border: none;
    background: transparent;
    padding: .45rem .75rem;
    font-size: .75rem;
    font-weight: 700;
    color: #64748b;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
}

.sm-deck-toggle-btn.is-active { color: #141823; }

#luxBerthSection[data-deck="upper"] .sm-deck-toggle-slider {
    transform: translateX(100%);
}

#luxBerthSection[data-deck="lower"] .sm-seat-wrap[data-tier="upper"],
#luxBerthSection[data-deck="upper"] .sm-seat-wrap[data-tier="lower"] {
    display: none;
    pointer-events: none;
}

/* ── Root / illustration ── */
.sm-root {
    background: #f8fafc;
}

.sm-illustration-wrap {
    display: flex;
    justify-content: center;
    padding: 12px 17px;
}

.sm-illustration {
    width: fit-content;
    max-width: 100%;
    background: #fff;
    border-radius: 10px;
}

/* ── Vertical grid (mobile) ── */
.sm-grid--horizontal { display: none; }

.sm-grid--vertical {
    display: grid;
    grid-template-columns: repeat(4, minmax(1.85rem, 2rem));
    grid-auto-rows: minmax(1.85rem, 2rem);
    gap: 7px;
    justify-content: center;
}

/* ── Grid chrome ── */
.sm-entry-icon {
    border-radius: 8px 8px 4px 4px;
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    border: 1px solid #94a3b8;
    min-height: 2rem;
    position: relative;
}

.sm-grid--vertical .sm-entry-icon {
    grid-column: span 2;
}

.sm-entry-icon::after {
    content: 'ENTRY';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .4rem;
    font-weight: 800;
    color: #64748b;
    letter-spacing: .06em;
}

.sm-driver-seat {
    border-radius: 8px;
    background: #334155;
    border: 1px solid #1e293b;
    position: relative;
    min-height: 2rem;
}

.sm-driver-seat::after {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 4px;
    border: 1.5px dashed rgba(255, 255, 255, 0.45);
}

.sm-grid-spacer { visibility: hidden; }

.sm-aisle-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .5rem;
    font-weight: 700;
    color: #94a3b8;
}

/* ── Seat cell ── */
.sm-seat-cell {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    min-height: 1.65rem;
}

.sm-seat-wrap {
    grid-row: 1;
    grid-column: 1;
    position: relative;
    width: 100%;
    height: 100%;
}

/* ── Sleeper bed (reference style) ── */
.sm-bed,
.sm-seat {
    width: 100%;
    height: auto;
    aspect-ratio: 2.15 / 1;
    min-height: 1.65rem;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 3px;
    padding: 3px 4px;
    border: 1.5px solid #2b2b2b;
    border-radius: 7px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
    font-family: inherit;
    box-sizing: border-box;
}

.sm-bed-sheet {
    flex: 1;
    border-radius: 4px;
    background: transparent;
    min-width: 0;
}

.sm-bed-pillow {
    width: 24%;
    max-width: 14px;
    min-width: 7px;
    align-self: stretch;
    border: 1.5px solid #2b2b2b;
    border-radius: 999px;
    background: #fff;
    flex-shrink: 0;
}

.sm-seat--available:hover {
    border-color: #0891b2;
    box-shadow: 0 0 0 1px rgba(8, 145, 178, 0.35);
}

.sm-seat.selected {
    border-color: #22d3ee;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.45);
}

.sm-seat.selected .sm-bed-pillow {
    border-color: #22d3ee;
    background: #ecfeff;
}

.sm-seat--female,
.sm-seat--male,
.sm-seat--other {
    background: #d4d4d8;
    border-color: #a1a1aa;
    cursor: not-allowed;
}

.sm-seat--female .sm-bed-pillow,
.sm-seat--male .sm-bed-pillow,
.sm-seat--other .sm-bed-pillow {
    background: #c4c4c4;
    border-color: #a1a1aa;
}

.sm-seat--female {
    background: #e9d5e8;
    border-color: #c084b8;
}

.sm-seat--female .sm-bed-pillow {
    background: #dfc4de;
    border-color: #c084b8;
}

.sm-seat--male {
    background: #dbeafe;
    border-color: #93c5fd;
}

.sm-seat--male .sm-bed-pillow {
    background: #cfe4fc;
    border-color: #93c5fd;
}

.sm-seat:disabled { pointer-events: none; }

/* ── Footer ── */
.sm-footer-bar {
    border-top: 1px solid #e2e8f0;
}

.sm-legends-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.5rem;
    padding: .65rem .75rem;
    background: #fff;
}

.sm-legends {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .45rem .65rem;
    flex: 1;
    min-width: 140px;
}

.sm-legends li {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .66rem;
    color: #475569;
}

.sm-legend {
    width: 26px;
    height: 13px;
    border-radius: 4px;
    flex-shrink: 0;
    position: relative;
    border: 1.5px solid #2b2b2b;
    background: #fff;
    box-sizing: border-box;
}

.sm-legend::after {
    content: '';
    position: absolute;
    right: 2px;
    top: 2px;
    bottom: 2px;
    width: 5px;
    border: 1px solid #2b2b2b;
    border-radius: 999px;
    background: #fff;
}

.sm-legend--unavailable {
    background: #d4d4d8;
    border-color: #a1a1aa;
}

.sm-legend--unavailable::after {
    background: #c4c4c4;
    border-color: #a1a1aa;
}

.sm-legend--available {
    background: #fff;
    border-color: #2b2b2b;
}

.sm-legend--male {
    background: #dbeafe;
    border-color: #93c5fd;
}

.sm-legend--male::after {
    background: #cfe4fc;
    border-color: #93c5fd;
}

.sm-legend--female-reserved {
    background: #fdf2f8;
    border: 1.5px dashed #ec4899;
}

.sm-legend--female {
    background: #e9d5e8;
    border-color: #c084b8;
}

.sm-legend--female::after {
    background: #dfc4de;
    border-color: #c084b8;
}

.sm-legend--selected {
    background: #fff;
    border-color: #22d3ee;
    box-shadow: 0 0 0 1px #22d3ee;
}

.sm-legend--selected::after {
    border-color: #22d3ee;
    background: #ecfeff;
}

.sm-summary {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    margin: 0;
    padding: .65rem .75rem;
    background: #fff5ed;
    border-top: 1px solid rgba(234, 136, 29, 0.2);
}

.sm-summary-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #EA881D;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .72rem;
}

.sm-summary-body {
    flex: 1;
    font-size: .72rem;
    color: #1e293b;
    font-weight: 600;
}

.sm-pick-line {
    font-size: .65rem;
    color: #64748b;
    margin-bottom: .12rem;
}

.sm-pick-line strong { color: #EA881D; }

.sm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem;
    margin-top: .3rem;
}

.lux-chip {
    font-size: .58rem;
    font-weight: 700;
    padding: .1rem .35rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #EA881D;
    color: #c2440a;
}

.lux-sidebar-berths {
    margin: .75rem 0;
    padding: .7rem .8rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.lux-sidebar-berths h6 {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #64748b;
    margin-bottom: .4rem;
    font-weight: 700;
}

.lux-sidebar-berths h6 i { color: #EA881D; }

.lux-sidebar-berth-list {
    font-size: .8rem;
    min-height: 1rem;
    color: #1e293b;
}

.lux-sidebar-berth-list.empty {
    color: #94a3b8;
    font-style: italic;
}

/* ── Mobile ── */
@media (max-width: 767px) {
    .sm-price-filter { display: none; }
}

/* ── Desktop: horizontal layout ── */
@media (min-width: 768px) {
    .sm-top-bar {
        display: flex;
        align-items: stretch;
    }

    .sm-price-filter {
        flex: 1;
        min-width: 0;
    }

    .sm-price-filter-all.is-active,
    .sm-price-filter-item.is-active {
        box-shadow: inset 0 -2px 0 #EA881D;
    }

    .sm-deck-bar {
        flex-shrink: 0;
        justify-content: center;
        padding: .75rem 1.25rem;
        border-left: 1px solid #e2e8f0;
    }

    .sm-root {
        background: #fff;
    }

    .sm-illustration-wrap {
        justify-content: flex-start;
        padding: 1rem 1.25rem;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: thin;
        scrollbar-color: #EA881D #f1f5f9;
    }

    .sm-illustration-wrap::-webkit-scrollbar { height: 6px; }
    .sm-illustration-wrap::-webkit-scrollbar-thumb {
        background: #EA881D;
        border-radius: 10px;
    }

    .sm-illustration {
        background: transparent;
        border-radius: 0;
        width: max-content;
        min-width: 100%;
    }

    .sm-grid--vertical { display: none; }

    .sm-grid--horizontal {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        gap: 8px;
        width: max-content;
        min-width: min(100%, max-content);
        padding: .25rem 0;
    }

    .sm-bus-front {
        display: flex;
        flex-direction: column;
        gap: 8px;
        flex-shrink: 0;
        width: 2.75rem;
        padding-top: .15rem;
    }

    .sm-bus-front .sm-driver-seat {
        min-height: 2.5rem;
    }

    .sm-bus-front .sm-entry-icon {
        min-height: 2.5rem;
    }

    .sm-bus-front-label {
        font-size: .58rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .06em;
        color: #64748b;
        text-align: center;
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        align-self: center;
        margin-top: .25rem;
    }

    .sm-bus-col {
        display: flex;
        flex-direction: column;
        gap: 6px;
        flex: 0 0 2.65rem;
        align-items: stretch;
    }

    .sm-bus-col .sm-seat-cell {
        min-height: 2.35rem;
    }

    .sm-bus-col .sm-bed,
    .sm-bus-col .sm-seat {
        min-height: 2.35rem;
        aspect-ratio: 1.35 / 1;
    }

    .sm-bus-col .sm-aisle-marker {
        min-height: 1.25rem;
        font-size: .58rem;
    }

    .sm-bus-rear {
        flex-shrink: 0;
        width: 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        align-self: stretch;
        border-left: 2px dashed #cbd5e1;
        margin-left: 4px;
        padding-left: 6px;
    }

    .sm-bus-rear span {
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        font-size: .58rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .06em;
        color: #94a3b8;
    }

    .sm-entry-icon::after { font-size: .45rem; }

    .sm-footer-bar {
        display: flex;
        align-items: stretch;
    }

    .sm-legends-row {
        flex: 1;
        padding: .85rem 1.1rem;
        border-right: 1px solid #e2e8f0;
    }

    .sm-legends li { font-size: .72rem; }

    .sm-legend {
        width: 30px;
        height: 15px;
    }

    .sm-summary {
        flex: 0 0 min(320px, 34%);
        border-top: none;
        padding: .85rem 1.1rem;
        align-self: stretch;
    }

    .sm-summary-body { font-size: .78rem; }
}
