/* ============================================================
   1. RESET E BASE
   ============================================================ */
   * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f3f4f6;
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

/* ============================================================
   2. ANIMAÇÕES
   ============================================================ */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-slide-up {
    animation: slideUp 0.4s ease-out forwards;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.2); }
    50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.4); }
}
.pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ============================================================
   3. MAPA DE ASSENTOS (NOVO LAYOUT)
   ============================================================ */
/* Wrapper com rolagem horizontal - CORREÇÃO PRINCIPAL */
.seat-grid-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overflow-y: visible !important;
    width: 100%;
    padding: 4px 0 12px 0;
    scroll-behavior: smooth;
    -ms-overflow-style: -ms-autohiding-scrollbar; /* Esconde scrollbar no IE/Edge */
}

.seat-grid-wrapper::-webkit-scrollbar {
    height: 6px;
}
.seat-grid-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
.seat-grid-wrapper::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 10px;
}
.seat-grid-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a3a3a3;
}

.seat-grid {
    display: flex !important;
    flex-direction: column;
    align-items: stretch !important;
    gap: 3px;
    padding: 4px 10px;
    min-width: max-content !important;
    flex-wrap: nowrap !important;
}

.seat-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: nowrap !important;
}

.seat-side {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: nowrap;
    /* Largura fixa = fileira mais longa (14 assentos), garante alinhamento entre fileiras */
    width: 432px;
    min-width: 432px;
    flex-shrink: 0;
}

.seat-side-left {
    justify-content: flex-end;
}

.seat-side-right {
    justify-content: flex-start;
}

.seat-row-label {
    width: 22px;
    text-align: center;
    font-weight: 800;
    font-size: 11px;
    color: #111827;
    flex-shrink: 0;
}

/* Espaço vazio: flex-basis + min-width evitam colapso no WebKit mobile */
.seat-gap {
    box-sizing: border-box;
    flex: 0 0 28px;
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    height: 28px;
    pointer-events: none;
    visibility: hidden;
}

/* Assentos normais */
.seat {
    width: 28px;
    height: 28px;
    border-radius: 4px 4px 8px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 2px solid transparent;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    flex: 0 0 28px;
}

/* Estados */
.seat.available {
    background: #22c55e;
    border-color: #16a34a;
}
.seat.available:active {
    transform: scale(0.92);
}
.seat.unavailable {
    background: #d1d5db;
    border-color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
    color: #9ca3af;
}
.seat.selected {
    background: #eab308;
    border-color: #ca8a04;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.4);
}
.seat.reserved {
    background: #3b82f6;
    border-color: #2563eb;
}

/* Assentos especiais (cadeirantes) — mesmo tamanho dos normais para alinhar colunas */
.seat.especial {
    background: #3b82f6 !important;
    border-color: #2563eb !important;
    font-size: 11px;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
}
.seat.especial.available {
    background: #3b82f6 !important;
    border-color: #2563eb !important;
}
.seat.especial.unavailable {
    background: #93c5fd !important;
    border-color: #60a5fa !important;
}

.seat.especial-fixo {
    cursor: default;
    pointer-events: none;
    transform: none !important;
    box-shadow: none !important;
}

/* Linha de assentos especiais */
.especial-row {
    margin-bottom: 6px;
    border-bottom: 1px dashed #d1d5db;
    padding-bottom: 4px;
}

/* ============================================================
   4. TABS
   ============================================================ */
.tab-btn {
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}
.tab-btn span:last-child {
    transition: all 0.3s ease;
}
.tab-btn.active {
    color: #4f46e5;
}
.tab-btn.active span:last-child {
    background: #4f46e5;
}

/* ============================================================
   5. BOTÃO FLUTUANTE - PASSO 1
   ============================================================ */
#fab-confirm {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    width: 100%;
    max-width: 448px;
    padding: 0 1rem;
}
#confirm-seats-btn {
    transition: all 0.3s ease;
    touch-action: manipulation;
    width: 100%;
}
#confirm-seats-btn:active {
    transform: scale(0.96);
}
#confirm-seats-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(0.98);
}

/* ============================================================
   6. BOTÕES FIXOS - PASSO 2
   ============================================================ */
#step-2 {
    padding-bottom: 120px;
}

.botao-fixo {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid #e5e7eb;
    padding: 0.75rem 1rem 1.5rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 1rem));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}
.botao-fixo .container-botoes {
    max-width: 448px;
    margin: 0 auto;
    display: flex;
    gap: 0.75rem;
}
.botao-fixo button {
    flex: 1;
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    transition: all 0.2s ease;
    touch-action: manipulation;
    cursor: pointer;
    text-align: center;
}
.botao-fixo button:active {
    transform: scale(0.96);
}
#back-to-seats-btn {
    background: #e5e7eb;
    color: #374151;
}
#back-to-seats-btn:hover {
    background: #d1d5db;
}
#pay-btn {
    background: linear-gradient(to right, #22c55e, #059669);
    color: white;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.3);
}
#pay-btn:hover {
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
}

/* ============================================================
   7. RESUMO DA RESERVA
   ============================================================ */
#resume-subtotal,
#resume-fee,
#resume-total {
    transition: all 0.3s ease;
}
#resume-fee {
    font-size: 0.95rem;
}
.border-dashed {
    border-style: dashed !important;
    border-color: #d1d5db !important;
}

/* ============================================================
   8. PASSO 3 - CONFIRMAÇÃO
   ============================================================ */
#step-3 .icone-confirmacao {
    width: 6rem;
    height: 6rem;
    border-radius: 9999px;
    background: #dcfce7;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 3rem;
}
#redirect-progress {
    height: 0.5rem;
    background: linear-gradient(to right, #4f46e5, #7c3aed);
    border-radius: 9999px;
    transition: width 1s ease;
    width: 0%;
}

/* ============================================================
   9. SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 4px;
}

/* ============================================================
   10. RESPONSIVIDADE
   ============================================================ */
/* Tablets — assentos ainda 28px; manter largura da fileira mais longa */
@media (max-width: 640px) {
    #step-2 { padding-bottom: 100px; }
    #step-2 .botao-fixo { padding: 0.5rem 0.75rem 1rem; }
    #step-2 .botao-fixo button { padding: 0.75rem 0.5rem; font-size: 0.9rem; border-radius: 0.75rem; }
    .seat-side { width: 432px; min-width: 432px; }
    .seat-grid-wrapper { padding: 2px 0 8px 0; }
}

/* Celulares médios */
@media (max-width: 480px) {
    .seat { width: 24px; height: 24px; flex: 0 0 24px; font-size: 7px; border-radius: 3px 3px 6px 6px; }
    .seat-gap { flex: 0 0 24px; width: 24px; min-width: 24px; max-width: 24px; height: 24px; }
    .seat.especial { width: 24px; height: 24px; flex: 0 0 24px; font-size: 10px; }
    .seat-row-label { width: 16px; font-size: 9px; }
    .seat-grid { gap: 2px; padding: 2px 6px; }
    .seat-side { width: 375px; min-width: 375px; }
    #step-2 { padding-bottom: 80px; }
    #step-2 .botao-fixo { padding: 0.4rem 0.5rem 0.8rem; }
    #step-2 .botao-fixo button { font-size: 0.8rem; padding: 0.6rem 0.4rem; border-radius: 0.5rem; }
    #fab-confirm { bottom: 1rem; padding: 0 0.75rem; }
    .seat-grid-wrapper { padding: 2px 0 6px 0; }
    .seat-grid-wrapper::-webkit-scrollbar { height: 4px; }
}

/* Celulares muito pequenos */
@media (max-width: 380px) {
    .seat { width: 20px; height: 20px; flex: 0 0 20px; font-size: 6px; border-radius: 2px 2px 4px 4px; }
    .seat-gap { flex: 0 0 20px; width: 20px; min-width: 20px; max-width: 20px; height: 20px; }
    .seat.especial { width: 20px; height: 20px; flex: 0 0 20px; font-size: 8px; }
    .seat-row-label { width: 14px; font-size: 8px; }
    .seat-side { width: 319px; min-width: 319px; }
    #step-2 .botao-fixo button { font-size: 0.7rem; padding: 0.5rem 0.3rem; }
}