/**
 * seat_map.css — SwiftBus_X
 * Shared styles for the Quick Booking Modal seat map.
 * Place at:  assets/css/seat_map.css
 * Include on every page that uses #quickBookModal.
 *
 * Covers:
 *   - Category badge colours
 *   - Bus shell + front header
 *   - Seat grid + row layout per bus type
 *   - Seat cell states (available / selected / occupied)
 *   - Special cells (aisle / driver / spacer)
 *   - Legend + capacity counter
 */

/* ─────────────────────────────────────────────────────────────
   CATEGORY BADGES
───────────────────────────────────────────────────────────── */
.qb-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}
.qb-category-badge.cat--vip-standard {
    background: #EFF6FF;
    color: #1D4ED8;
    border: 0.5px solid #BFDBFE;
}
.qb-category-badge.cat--vip-luxury {
    background: #FFF7ED;
    color: #C2410C;
    border: 0.5px solid #FED7AA;
}
.qb-category-badge.cat--2m-express {
    background: #FEF2F2;
    color: #B91C1C;
    border: 0.5px solid #FECACA;
}

/* ─────────────────────────────────────────────────────────────
   BUS SHELL WRAPPER
───────────────────────────────────────────────────────────── */
.qb-bus-shell {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    border: 0.5px solid #e5e7eb;
    overflow-x: auto; /* allow horizontal scroll on very small screens */
}

.qb-bus-front {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: var(--bg-dark, #0F0F12);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px 8px 0 0;
    font-size: 12px;
    font-weight: 600;
    width: 100%;
    margin-bottom: 12px;
}

/* ─────────────────────────────────────────────────────────────
   SEAT GRID CONTAINER
───────────────────────────────────────────────────────────── */
.qb-seat-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
    min-width: 200px; /* prevents collapse when container is narrow */
}

/* ─────────────────────────────────────────────────────────────
   SEAT ROW — base (must always be display:grid)
───────────────────────────────────────────────────────────── */
.seat-row {
    display: grid !important; /* override any flex inheritance */
    gap: 6px;
    width: 100%;
    align-items: center;
}

/* ─────────────────────────────────────────────────────────────
   LAYOUT-SPECIFIC COLUMN TEMPLATES
   VIP LUXURY   : 2 left | aisle | 1 right  → 4 cols
   VIP STANDARD : 2 left | aisle | 2 right  → 5 cols
   2M EXPRESS   : 1 left | aisle | 2 right  → 4 cols (15 seats, 5 rows)
───────────────────────────────────────────────────────────── */
.layout-vip-luxury .seat-row {
    grid-template-columns: 1fr 1fr 0.45fr 1fr;
}

.layout-vip-standard .seat-row {
    grid-template-columns: 1fr 1fr 0.45fr 1fr 1fr;
}

/* Seat X1 | Aisle | Seat X2 | Seat X3  (single LEFT, double RIGHT) */
.layout-2m-express .seat-row {
    grid-template-columns: 1fr 0.45fr 1fr 1fr;
}

/* ─────────────────────────────────────────────────────────────
   SEAT CELL — base
───────────────────────────────────────────────────────────── */
.seat-cell {
    height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    position: relative;
    border: 0.5px solid #e2e8f0;
    background: #ffffff;
    color: #374151;
    gap: 2px;
    user-select: none;
    /* prevent text overflow on very small grids */
    overflow: hidden;
    min-width: 0;
}

.seat-icon {
    font-size: 13px;
    color: #6b7280;
    transition: color 0.18s ease;
    flex-shrink: 0;
}

.seat-label {
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

/* ── Available hover ── */
.seat-cell:hover:not(.occupied):not(.cell-aisle):not(.cell-driver):not(.cell-spacer) {
    border-color: var(--primary, #FF3B1F);
    background: #fff5f3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 59, 31, 0.15);
}
.seat-cell:hover:not(.occupied):not(.cell-aisle):not(.cell-driver):not(.cell-spacer) .seat-icon {
    color: var(--primary, #FF3B1F);
}

/* ── Selected ── */
.seat-cell.selected {
    background: var(--primary, #FF3B1F);
    border-color: var(--primary, #FF3B1F);
    color: #ffffff;
    transform: scale(1.05) translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 59, 31, 0.35);
}
.seat-cell.selected .seat-icon,
.seat-cell.selected .seat-label {
    color: #ffffff;
}

/* ── Occupied ── */
.seat-cell.occupied {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
}
.seat-cell.occupied .seat-icon {
    color: #cbd5e1;
}
.seat-cell.occupied::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(0, 0, 0, 0.04) 4px,
        rgba(0, 0, 0, 0.04) 8px
    );
}

/* ─────────────────────────────────────────────────────────────
   SPECIAL CELLS
───────────────────────────────────────────────────────────── */

/* Aisle — row label separator, not clickable */
.cell-aisle {
    background: transparent !important;
    border: none !important;
    cursor: default !important;
    color: #9ca3af;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
}
.aisle-label {
    font-size: 11px;
    color: #9ca3af;
}

/* Driver cell (2M Express front row) */
.cell-driver {
    background: #1e293b !important;
    border-color: #0f172a !important;
    color: #94a3b8;
    cursor: default !important;
    font-size: 9px;
    gap: 3px;
    pointer-events: none;
}
.cell-driver i {
    font-size: 14px;
    color: #64748b;
}
.cell-driver span {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

/* Spacer — invisible placeholder to keep grid alignment */
.cell-spacer {
    background: transparent !important;
    border: none !important;
    cursor: default !important;
    pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────
   LEGEND
───────────────────────────────────────────────────────────── */
.qb-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 12px;
    font-size: 11px;
    color: #6b7280;
    flex-wrap: wrap;
}
.qb-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.qb-legend-dot {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    border: 0.5px solid #d1d5db;
    flex-shrink: 0;
}
.qb-legend-dot--free     { background: #fff; }
.qb-legend-dot--selected { background: var(--primary, #FF3B1F); border-color: var(--primary, #FF3B1F); }
.qb-legend-dot--occupied { background: #f1f5f9; }

/* ─────────────────────────────────────────────────────────────
   CAPACITY COUNTER
───────────────────────────────────────────────────────────── */
.qb-seat-capacity {
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 6px;
}
.qb-seat-capacity span {
    font-weight: 700;
    color: var(--primary, #FF3B1F);
}
/* 🔒 Seat Locking Styles */
.seat-cell.locked,
.seat.locked {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%) !important;
  color: #fff !important;
  animation: pulse-lock 2s infinite;
  cursor: default;
  position: relative;
}

.seat-cell.locked::after,
.seat.locked::after {
  content: "🔒";
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.7rem;
  animation: bounce 1s ease infinite;
}

@keyframes pulse-lock {
  0% { box-shadow: 0 0 0 0 rgba(255, 59, 31, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(255, 59, 31, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 31, 0); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* Countdown Timer */
.qb-lock-timer .qb-summary-val {
  font-weight: 700;
  color: var(--primary);
  font-family: monospace;
  font-size: 1.1rem;
}

.qb-lock-timer .qb-summary-val.warning {
  color: #f59e0b;
  animation: flash-warning 1s infinite;
}

.qb-lock-timer .qb-summary-val.expired {
  color: #ef4444;
}

@keyframes flash-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Loading State */
.seat-cell.loading {
  opacity: 0.6;
  cursor: wait;
  position: relative;
}

.seat-cell.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border: 0.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  transform: translate(-50%, -50%);
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}