/* assets/css/style.css */
:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --secondary: #10B981;
    --dark: #111827;
    --darker: #0B0F19;
    --light: #F9FAFB;
    --gray: #6B7280;
    --gray-bg: #E5E7EB;

    --seat-available: #ffffff;
    --seat-available-border: #D1D5DB;
    --seat-selected: var(--primary);
    --seat-reserved: #EF4444;

    --font: 'Inter', sans-serif;
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font);
}

body {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: var(--dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    /* Evitar bounce scroll en iOS */
    overscroll-behavior-y: none;
}

/* Glassmorphism Classes */
.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius);
}

.hidden {
    display: none !important;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    background: var(--gray);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.7;
}

.w-full {
    width: 100%;
}

/* Welcome Screen */
.welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);
}

.welcome-content {
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    animation: fadeInUp 0.6s ease-out;
}

.welcome-content h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--darker);
    margin-bottom: 12px;
}

.welcome-content p {
    color: var(--gray);
    margin-bottom: 24px;
    line-height: 1.5;
}

.raffle-info {
    background: rgba(255, 255, 255, 0.5);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-weight: 600;
    font-size: 0.9rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* App Container */
.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-header {
    height: 45px;
    padding: 0 15px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    overflow: hidden;
}

.header-col-left {
    flex: 0 0 auto;
}

.header-col-center {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-col-right {
    flex: 0 0 auto;
}

.header-main-title {
    font-size: 0.95rem;
    color: var(--darker);
}

.btn-compact {
    padding: 4px 10px !important;
    font-size: 0.8rem !important;
    background: var(--gray) !important;
    box-shadow: none !important;
    height: 30px;
}

.compact-legend {
    gap: 8px !important;
    font-size: 0.75rem !important;
}

.compact-legend .box {
    width: 12px !important;
    height: 12px !important;
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--gray);
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend .box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: inline-block;
}

.legend .box.available {
    background: var(--seat-available);
    border: 2px solid var(--seat-available-border);
}

.legend .box.selected {
    background: var(--seat-selected);
}

.legend .box.reserved {
    background: var(--seat-reserved);
}

/* Seat Map Wrapper with Zoom support */
.seat-map-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    /* For zooming */
    background: #e5e7eb;
    touch-action: none;
    /* Let JS handle gestures */
}

.zoom-instructions {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 5px;
    pointer-events: none;
    opacity: 0.8;
}

.seat-map-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    transition: transform 0.1s ease-out;
    padding: 20px;
}

/* Grid Layout for exactly 300 seats */
/* Por defecto en móvil usaremos un mix o lo ajustamos dinámicamente con CSS Grid */
.seat-grid {
    display: grid;
    /* Por ejemplo 15 columnas x 20 filas = 300 */
    grid-template-columns: repeat(15, minmax(30px, 1fr));
    gap: 8px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Seat Styles */
.seat {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--seat-available);
    border: 2px solid var(--seat-available-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray);
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s, background 0.2s, border-color 0.2s;
}

/* En PC se puede hacer hover */
@media (hover: hover) {
    .seat.available:hover {
        border-color: var(--primary);
        transform: scale(1.1);
    }
}

.seat.selected {
    background: var(--seat-selected);
    border-color: var(--seat-selected);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.4);
}

.seat.reserved {
    background: var(--seat-reserved);
    border-color: var(--seat-reserved);
    color: white;
    cursor: not-allowed;
    opacity: 0.8;
}

/* Footer Fijo */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 15px 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 15px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.selection-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    color: var(--gray);
}

.selection-info strong {
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 800;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    width: 100%;
    max-width: 400px;
    padding: 30px;
    position: relative;
    background: white;
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.btn-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--gray);
    cursor: pointer;
    transition: color 0.2s;
}

.btn-close:hover {
    color: var(--dark);
}

.modal h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--darker);
}

.modal-instruction {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark);
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--gray-bg);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
}

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--darker);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: dropDown 0.3s ease-out forwards;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.error {
    background: var(--seat-reserved);
}

.toast.success {
    background: var(--secondary);
}

@keyframes dropDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Media Queries */
@media (max-width: 600px) {
    .app-header {
        flex-direction: column;
        height: auto;
        padding: 10px;
        gap: 5px;
    }

    .header-col-center {
        order: -1;
        margin-bottom: 5px;
    }

    .header-main-title {
        font-size: 0.85rem;
    }
}

@media (min-width: 768px) {
    .app-footer {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        max-width: 600px;
        margin: 0 auto 20px auto;
        border-radius: var(--border-radius);
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
    }
}