/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

/* Header móvil */
.mobile-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    max-width: 100%;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 2rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 12px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.logo-text h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 2px;
}

.logo-text p {
    font-size: 0.85rem;
    color: #7f8c8d;
    font-weight: 500;
}

/* Menú hamburguesa */
.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: #2c3e50;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Navegación móvil */
.mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-nav.active {
    max-height: 120px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    margin: 8px;
}

.nav-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.nav-item.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.nav-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.nav-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

/* Botón flotante (FAB) */
.fab-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
}

.fab {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    transition: all 0.3s ease;
    font-weight: 600;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

.fab-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.fab-text {
    font-size: 0.7rem;
    font-weight: 700;
}

/* Contenedor principal */
.app-container {
    margin-top: 90px;
    padding: 20px;
    padding-bottom: 100px;
    max-width: 100%;
    min-height: calc(100vh - 90px);
}

/* Secciones */
.app-section {
    display: none;
    animation: fadeIn 0.5s ease;
}

.app-section.active {
    display: block;
}

.section-header {
    text-align: center;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
}

.section-header p {
    color: #7f8c8d;
    font-size: 0.95rem;
}

/* Sección de cámara */
.camera-section {
    max-width: 100%;
    margin: 0 auto;
}

.camera-container {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    margin-bottom: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

#video {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scanner-frame {
    position: relative;
    width: 200px;
    height: 200px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
}

.corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #4CAF50;
}

.corner.top-left {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
    border-radius: 8px 0 0 0;
}

.corner.top-right {
    top: -3px;
    right: -3px;
    border-left: none;
    border-bottom: none;
    border-radius: 0 8px 0 0;
}

.corner.bottom-left {
    bottom: -3px;
    left: -3px;
    border-right: none;
    border-top: none;
    border-radius: 0 0 0 8px;
}

.corner.bottom-right {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 8px 0;
}

.scanner-text {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 30px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.scanner-status {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-top: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Controles principales */
.main-control {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 25px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-width: 140px;
    justify-content: center;
}

.start-button {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.start-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.stop-button {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.stop-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

/* Sección de check-in manual */
.manual-checkin-form {
    background: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-btn {
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.guest-result {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.guest-result:last-child {
    margin-bottom: 0;
}

.guest-info h4 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 4px;
}

.guest-info p {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.quick-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Estadísticas */
.stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.stat-card.attended {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(69, 160, 73, 0.1));
    border: 2px solid rgba(76, 175, 80, 0.3);
}

.stat-card.pending {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 160, 0, 0.1));
    border: 2px solid rgba(255, 193, 7, 0.3);
}

.stat-card.percentage {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 2px solid rgba(102, 126, 234, 0.3);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #7f8c8d;
    font-weight: 600;
}

/* Tarjetas de resultado */
.guest-card, .duplicate-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    max-width: 90%;
    width: 350px;
    animation: slideUp 0.5s ease;
}

.card-header, .alert-header {
    padding: 25px 20px 15px;
    text-align: center;
    border-radius: 20px 20px 0 0;
}

.card-header.success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.alert-header {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
}

.status-icon, .alert-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    display: block;
}

.status-text, .alert-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.card-content, .alert-content {
    padding: 20px;
}

.guest-name, .duplicate-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
    text-align: center;
}

.guest-details {
    color: #7f8c8d;
    margin-bottom: 15px;
}

.registration-time, .duplicate-time {
    font-size: 0.9rem;
    color: #95a5a6;
    text-align: center;
}

.card-actions, .alert-actions {
    padding: 15px 20px 25px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Botones de acción */
.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: center;
}

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

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

.action-btn.secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.action-btn.secondary:hover {
    background: #d5dbdb;
    transform: translateY(-2px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1002;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 90%;
    width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    font-size: 1.3rem;
    color: #2c3e50;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f8f9fa;
    color: #2c3e50;
}

.modal-form {
    padding: 20px 25px 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #d5dbdb;
    transform: translateY(-2px);
}

/* Sección de descarga de ticket */
.ticket-download-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.ticket-download-btn {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
    transition: all 0.3s ease;
    width: 100%;
    max-width: 200px;
}

.ticket-download-btn:hover {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    box-shadow: 0 6px 16px rgba(33, 150, 243, 0.4);
    transform: translateY(-2px);
}

/* Estado simple */
.simple-status {
    text-align: center;
    padding: 30px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    margin: 20px 0;
}

.simple-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.simple-text {
    font-size: 1.1rem;
    color: #7f8c8d;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translate(-50%, -40%) scale(0.9); 
    }
    to { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1); 
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Responsive para pantallas muy pequeñas */
@media (max-width: 380px) {
    .logo-text h1 {
        font-size: 1.2rem;
    }
    
    .logo-text p {
        font-size: 0.8rem;
    }
    
    .mobile-nav {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mobile-nav.active {
        max-height: 240px;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .fab {
        width: 60px;
        height: 60px;
        bottom: 20px;
        right: 20px;
    }
    
    .fab-icon {
        font-size: 1.3rem;
    }
    
    .fab-text {
        font-size: 0.65rem;
    }
}

/* Elementos ocultos */
#canvas,
#debug-info {
    display: none !important;
}