* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 40px;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #4a5568;
    line-height: 1.2;
}

header p {
    font-size: 1.2em;
    color: #718096;
    margin-bottom: 20px;
    line-height: 1.4;
}

.admin-link {
    display: inline-block;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.admin-link:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.main-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    overflow-x: auto;
}

.hidden {
    display: none !important;
}

/* Selección de invitados */
.guest-selection h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #4a5568;
    font-size: 2em;
}

.guests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.guest-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.guest-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.guest-card.selected {
    border-color: #48bb78;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.guest-card.occupied {
    background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
    cursor: not-allowed;
    opacity: 0.6;
}

.guest-card h3 {
    font-size: 1.3em;
    margin-bottom: 10px;
}

.guest-card .status {
    font-size: 0.9em;
    opacity: 0.9;
}

/* Captura de foto */
.photo-capture {
    text-align: center;
}

.photo-capture h2 {
    margin-bottom: 30px;
    color: #4a5568;
    font-size: 1.8em;
}

.camera-container {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    padding: 0 10px;
}

#video {
    width: 100%;
    max-width: 300px;
    height: auto;
    aspect-ratio: 4/3;
    border-radius: 15px;
    border: 3px solid #667eea;
}

.captured-photo img {
    width: 100%;
    max-width: 300px;
    height: auto;
    aspect-ratio: 4/3;
    border-radius: 15px;
    border: 3px solid #48bb78;
    object-fit: cover;
}

.photo-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 0 10px;
}

/* Vista previa de la mesa */
.table-preview {
    text-align: center;
    margin-bottom: 40px;
}

.table-preview h2 {
    margin-bottom: 30px;
    color: #4a5568;
}

.preview-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.preview-table {
    background: #8b4513;
    border-radius: 50px;
    padding: 30px;
    min-width: 600px;
    min-height: 200px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.preview-description {
    color: #718096;
    font-size: 1.1em;
    margin-bottom: 20px;
}

.preview-description span {
    font-weight: bold;
    color: #4a5568;
}

/* Table Preview */
.table-preview {
    text-align: center;
    margin: 2rem 0;
}

.table-preview h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.table-preview p {
    color: #7f8c8d;
    margin-bottom: 2rem;
}

#previewTable {
    position: relative;
    max-width: 600px;
    margin: 0 auto 2rem;
    padding: 60px;
}

/* Ajustar tamaño de mesa según número de asientos */
#previewTable[data-seats="4"] .table-surface,
#previewTable[data-seats="4"] .table-surface-main {
    width: 60%;
    min-width: 250px;
}

#previewTable[data-seats="6"] .table-surface,
#previewTable[data-seats="6"] .table-surface-main {
    width: 70%;
    min-width: 280px;
}

#previewTable[data-seats="8"] .table-surface,
#previewTable[data-seats="8"] .table-surface-main {
    width: 80%;
    min-width: 320px;
}

.table-surface {
    width: 100%;
    min-width: 300px;
    height: 150px;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    position: relative;
}

/* Mesa y asientos */
.seating-area {
    margin: 2rem 0;
    text-align: center;
}

.seating-area h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #4a5568;
}

.table-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.table {
    background: #8b4513;
    border-radius: 50px;
    padding: 30px;
    min-width: 600px;
    min-height: 200px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#table {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    padding: 60px;
}

/* Ajustar tamaño de mesa según número de asientos */
#table[data-seats="4"] .table-surface-main {
    width: 60%;
    min-width: 250px;
}

#table[data-seats="6"] .table-surface-main {
    width: 70%;
    min-width: 280px;
}

#table[data-seats="8"] .table-surface-main {
    width: 80%;
    min-width: 320px;
}

/* Estilos para acceso al admin */
.admin-access {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 1000;
}

.admin-btn {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.admin-btn:hover {
    opacity: 0.8;
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

/* Modal de PIN */
.pin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.pin-modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 300px;
}

.pin-modal-content h3 {
    margin-bottom: 20px;
    color: #333;
}

#pinInput {
    width: 100%;
    padding: 12px;
    font-size: 18px;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 5px;
    margin-bottom: 20px;
    letter-spacing: 5px;
}

#pinInput:focus {
    outline: none;
    border-color: #8B4513;
}

.pin-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.pin-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

#pinSubmit {
    background: #8B4513;
    color: white;
}

#pinSubmit:hover {
    background: #A0522D;
}

#pinCancel {
    background: #ccc;
    color: #333;
}

#pinCancel:hover {
    background: #bbb;
}

.pin-error {
    color: #d32f2f;
    font-size: 14px;
    margin-top: 10px;
}

.table-surface-main {
    width: 100%;
    min-width: 280px;
    height: 150px;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    position: relative;
    margin: 0 auto;
}

.table-row {
    position: absolute;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.table-row.top {
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
}

.table-row.president {
    top: 50%;
    right: -30px;
    transform: translateY(-50%);
    flex-direction: column;
}

.table-row.bottom {
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
}

.preview-table .table-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-table .table-row.top {
    justify-content: space-around;
}

.preview-table .table-row.bottom {
    justify-content: space-around;
}

.preview-table .table-row.president {
    justify-content: center;
    margin: 10px 0;
}

.seat {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    position: relative;
    border: 3px solid transparent;
    flex-shrink: 0;
}

.seat.available {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.seat.available:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

.seat.occupied {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    cursor: not-allowed;
    background-size: cover;
    background-position: center;
}

.seat.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #ffd700;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); }
    100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

.seat-photo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Estilos para asientos de acompañantes */
.seat.companion-seat {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    position: relative;
}

.companion-seat-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.companion-initial {
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    z-index: 2;
}

.main-guest-photo {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    bottom: -2px;
    right: -2px;
    border: 2px solid white;
    z-index: 3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-item .seat {
    width: 30px;
    height: 30px;
    cursor: default;
}

/* Gestión de acompañantes */
.companion-management {
    text-align: center;
}

.companion-management h2 {
    margin-bottom: 20px;
    color: #4a5568;
    font-size: 1.8em;
    line-height: 1.3;
}

.companion-management p {
    margin-bottom: 30px;
    color: #718096;
    font-size: 1.1em;
    line-height: 1.5;
    padding: 0 10px;
}

.companion-form {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 0 10px;
}

.form-input {
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-size: 1em;
    min-width: 250px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    min-height: 44px;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Confirmación */
.confirmation {
    text-align: center;
}

.confirmation h2 {
    margin-bottom: 30px;
    color: #48bb78;
    font-size: 2.5em;
    line-height: 1.2;
}

.confirmation-details {
    background: #f7fafc;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    border-left: 5px solid #48bb78;
    margin: 0 10px 30px 10px;
    text-align: left;
}

.confirmation-details h3 {
    color: #4a5568;
    margin-bottom: 15px;
}

.confirmation-details p {
    color: #718096;
    margin-bottom: 10px;
    font-size: 1.1em;
}

/* Botones */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    user-select: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(160, 174, 192, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    header {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    header p {
        font-size: 1em;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .table-surface-main {
        min-width: 250px;
        height: 120px;
    }
    
    .table-row {
        gap: 8px;
    }
    
    .seat {
        width: 45px;
        height: 45px;
        font-size: 0.9em;
    }
    
    .main-guest-photo {
        width: 16px;
        height: 16px;
    }
    
    .guests-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .guest-card {
        padding: 15px;
    }
    
    .photo-controls .btn {
         padding: 10px 15px;
         font-size: 0.9em;
     }
     
     .companion-form {
         flex-direction: column;
         align-items: center;
         gap: 10px;
     }
     
     .form-input {
         min-width: 200px;
         width: 100%;
         max-width: 300px;
     }
     
     .confirmation h2 {
         font-size: 2em;
     }
     
     .confirmation-details {
         padding: 20px;
         margin: 0 5px 20px 5px;
     }
     
     .companion-management h2 {
         font-size: 1.5em;
     }
     
     .companion-management p {
         font-size: 1em;
         padding: 0 5px;
     }
    
    .legend {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .legend-item .seat {
        width: 25px;
        height: 25px;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2.2em;
    }
    
    .main-content {
        padding: 30px;
    }
    
    .table {
        min-width: 90vw;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .guests-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .companion-form {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .form-input {
        min-width: 220px;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .guests-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}