/**
 * Estilos para el selector de puestos (Modal y Trigger)
 * Casaplan Motorplan - Compra Programada
 *
 * @author Alan Vergara
 * @since 2026-10-29
 */

/* --- Botón Seleccionar Puesto --- */
.btn-select-seat {
    background-color: #ffffff;
    color: var(--tl-color-theme-primary, #b20000);
    border: 1.5px solid var(--tl-color-theme-primary, #b20000);
    border-radius: 10px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    transition: all 0.25s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-select-seat:hover,
.btn-select-seat:focus {
    background-color: var(--tl-color-theme-primary, #b20000);
    color: #ffffff;
    border-color: var(--tl-color-theme-primary, #b20000);
    box-shadow: 0 4px 12px rgba(178, 0, 0, 0.2);
}

.btn-select-seat svg {
    transition: transform 0.2s ease;
}

.btn-select-seat:hover svg {
    transform: scale(1.1);
}

.btn-seat-selected-active {
    background-color: rgba(178, 0, 0, 0.08);
    border-color: var(--tl-color-theme-primary, #b20000);
    color: var(--tl-color-theme-primary, #b20000);
}

/* --- Modal de Selección de Puesto (Dimensiones Punto Medio y Estáticas) --- */
#seatSelectionModal {
    z-index: 1060;
    overscroll-behavior: contain;
}

.seat-modal-dialog {
    max-width: 560px;
    margin: 1.5rem auto;
}

.seat-modal-content {
    background-color: #ffffff;
    border-radius: 18px;
    border: none;
    box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.22);
    position: relative;
    overflow: hidden;
    overscroll-behavior: contain;
}

.seat-modal-close,
#seatSelectionModal .btn-close,
#btnCloseSeatModal {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1065 !important;
    cursor: pointer !important;
    opacity: 0.65;
    transition: opacity 0.2s ease, transform 0.2s ease;
    padding: 0.5rem;
    pointer-events: auto !important;
}

.seat-modal-close:hover,
#seatSelectionModal .btn-close:hover,
#btnCloseSeatModal:hover {
    opacity: 1;
    transform: scale(1.1);
}

.seat-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #333333;
    letter-spacing: -0.2px;
}

.seat-group-select-wrapper {
    position: relative;
    display: inline-block;
    max-width: 260px; /* reemplaza el style inline que tenía la vista */
}

.seat-group-select {
    background-color: #f8fafc;
    color: #334155;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 6px 32px 6px 14px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23334155' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: all 0.2s ease-in-out;
}

.seat-group-select:hover {
    background-color: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

.seat-group-select:focus {
    background-color: #ffffff;
    color: #0f172a;
    border-color: var(--tl-color-theme-primary, #b20000);
    box-shadow: 0 0 0 0.2rem rgba(178, 0, 0, 0.15);
    outline: 0;
}

/* Contenedor de puestos con scroll estático y contención de scroll (evita mover la página principal) */
.seat-grid-scroll {
    height: 220px;
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    overscroll-behavior: contain !important;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}

/* Scrollbar nativo consistente con la identidad de Casaplan */
.seat-grid-scroll::-webkit-scrollbar {
    width: 7px;
}

.seat-grid-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
}

.seat-grid-scroll::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.seat-grid-scroll::-webkit-scrollbar-thumb:hover {
    background-color: var(--tl-color-theme-primary, #b20000);
}

/* SimpleBar: Barra siempre visible, elegante en gris neutro y roja al interactuar */
#seatGridScroll .simplebar-content-wrapper {
    overscroll-behavior: contain;
}

#seatGridScroll .simplebar-track.simplebar-vertical {
    width: 7px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    right: 2px;
}

#seatGridScroll .simplebar-scrollbar {
    width: 7px;
}

#seatGridScroll .simplebar-scrollbar:before {
    background-color: #cbd5e1 !important;
    opacity: 1 !important;
    border-radius: 6px;
    left: 1px;
    right: 1px;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

#seatGridScroll .simplebar-scrollbar.simplebar-visible:before {
    background-color: #cbd5e1 !important;
    opacity: 1 !important;
}

#seatGridScroll .simplebar-scrollbar:hover:before,
#seatGridScroll .simplebar-scrollbar:active:before,
#seatGridScroll .simplebar-track.simplebar-vertical:hover .simplebar-scrollbar:before {
    background-color: var(--tl-color-theme-primary, #b20000) !important;
    opacity: 1 !important;
}

/* Cuadrícula dinámica compacta */
.seat-grid {
    display: grid;
    grid-template-columns: repeat(var(--seat-columns, 6), 1fr);
    gap: 5px 5px;
    max-width: 285px;
}

/* Recuadro de cada puesto con paddings reducidos ajustados al contenido */
.seat-item {
    background-color: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 2px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-height: 40px;
    height: 40px;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    outline: none;
    overflow: hidden;
    position: relative;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.seat-item:focus-visible {
    outline: 2px solid var(--tl-color-theme-primary, #b20000);
    outline-offset: 2px;
}

.seat-item .seat-icon {
    flex-shrink: 0;
    width: 13px;
    height: 13px;
    margin-bottom: 2px;
    transition: transform 0.18s ease, color 0.18s ease, fill 0.18s ease;
}

.seat-item-number {
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: color 0.18s ease;
}

/* 1. Estado Disponible */
.seat-item.seat-status-available {
    background-color: #ffffff;
    border-color: #cbd5e1;
    color: #1e293b;
}

.seat-item.seat-status-available .seat-icon {
    color: #000000;
    fill: #000000;
}

.seat-item.seat-status-available .seat-item-number {
    color: #1e293b;
}

.seat-item.seat-status-available:hover {
    background-color: #fff8f8;
    border-color: var(--tl-color-theme-primary, #b20000);
    transform: translateY(-1.5px);
    box-shadow: 0 4px 10px rgba(178, 0, 0, 0.12);
}

.seat-item.seat-status-available:hover .seat-icon {
    color: var(--tl-color-theme-primary, #b20000);
    fill: var(--tl-color-theme-primary, #b20000);
    transform: scale(1.1);
}

.seat-item.seat-status-available:hover .seat-item-number {
    color: var(--tl-color-theme-primary, #b20000);
}

/* 2. Estado Ocupado */
.seat-item.seat-status-occupied {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.72;
    box-shadow: none;
}

.seat-item.seat-status-occupied .seat-icon {
    color: #cbd5e1;
    fill: #cbd5e1;
}

.seat-item.seat-status-occupied .seat-item-number {
    color: #94a3b8;
}

/* 3. Estado Seleccionado */
.seat-item.seat-status-selected {
    background-color: var(--tl-color-theme-primary, #b20000);
    border-color: var(--tl-color-theme-primary, #b20000);
    color: #ffffff;
    transform: translateY(-1.5px) scale(1.02);
    box-shadow: 0 5px 14px rgba(178, 0, 0, 0.3);
}

.seat-item.seat-status-selected .seat-icon {
    color: #ffffff;
    fill: #ffffff;
}

.seat-item.seat-status-selected .seat-item-number {
    color: #ffffff;
    font-weight: 800;
}

.seat-item.seat-status-selected:hover {
    background-color: #990000;
    border-color: #990000;
    box-shadow: 0 7px 16px rgba(178, 0, 0, 0.35);
}

/* Resumen de la selección (columna derecha): grupo y puesto bien visibles */
.seat-summary {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--tl-color-theme-primary, #b20000);
    border-radius: 10px;
    user-select: none;
}

.seat-summary-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
}

.seat-summary-group {
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
}

.seat-summary-seat {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.15;
    color: #4d4d4d; /* el rojo de marca se reserva para acciones: usarlo con mesura */
}

.seat-summary-empty {
    font-size: 0.88rem;
    color: #64748b;
}

/* Leyenda de colores: compacta y más pequeña que el resumen */
.seat-legend-list {
    padding-left: 2px;
}

.seat-legend-item {
    user-select: none;
}

.seat-legend-box {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.seat-legend-box .seat-icon {
    width: 10px;
    height: 10px;
}

.seat-legend-box.seat-box-selected {
    background-color: var(--tl-color-theme-primary, #b20000);
    border: 1.5px solid var(--tl-color-theme-primary, #b20000);
    color: #ffffff;
}

.seat-legend-box.seat-box-available {
    background-color: #ffffff;
    border: 1.5px solid #cbd5e1;
    color: #000000;
}

.seat-legend-box.seat-box-occupied {
    background-color: #f8fafc;
    border: 1.5px solid #e2e8f0;
    color: #cbd5e1;
}

.seat-legend-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.2;
}

/* Botón Confirmar */
.btn-seat-confirm {
    background-color: var(--tl-color-theme-primary, #b20000);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 8px 28px;
    border-radius: 10px;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(178, 0, 0, 0.22);
}

.btn-seat-confirm:hover,
.btn-seat-confirm:focus {
    background-color: #990000;
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(178, 0, 0, 0.32);
    transform: translateY(-1px);
}

.btn-seat-confirm:disabled {
    background-color: #dee2e6;
    color: #8c98a4;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-seat-confirm:active:not(:disabled) {
    transform: translateY(0);
}

@media (max-width: 576px) {
    .seat-modal-dialog {
        max-width: 95%;
        margin: 1rem auto;
    }
    .seat-grid {
        max-width: 100%;
        gap: 6px 5px;
    }
    .seat-summary-seat {
        font-size: 1.35rem;
    }
    .btn-seat-confirm {
        width: 100%;
    }
}

/* Transiciones suaves para la vista del cotizador y pantalla de éxito */
#summaryCol {
    transition: opacity 0.35s ease-in-out, transform 0.35s ease-in-out;
}

#summaryCol.fade-out {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}

#wizardCol {
    transition: flex 0.35s ease-in-out, max-width 0.35s ease-in-out;
}

/* ============================================================
   Admisión en línea: panel en la página (seat-panel), sin modal.
   Izquierda grupo, selección y confirmar; derecha puestos libres.
   ============================================================ */
.seat-panel-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.seat-panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

.seat-panel-subtitle {
    font-size: 1rem;
    font-weight: 700;
    color: #334155;
}

/* La cuadrícula ocupa todo el ancho y ajusta las columnas al espacio disponible */
.seat-panel .seat-grid {
    max-width: none;
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    gap: 8px;
}

.seat-panel .seat-item {
    min-height: 46px;
}
