* {
    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;
    padding: 20px;
}

.container {
    max-width: 500px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1rem;
    opacity: 0.9;
}

.panel {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: slideUp 0.5s ease;
    overflow: hidden;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    text-align: center;
}

.panel-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.panel-body {
    padding: 20px;
}

/* Panel 1: Botones de corte */
.corte-btn {
    width: 100%;
    padding: 25px;
    margin: 10px 0;
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.corte-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.corte-btn .valor {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

.corte-btn .texto {
    font-size: 1rem;
    color: #666;
    margin-top: 5px;
}

.corte-btn[data-corte="10"] .valor { color: #2196F3; }
.corte-btn[data-corte="20"] .valor { color: #4CAF50; }
.corte-btn[data-corte="50"] .valor { color: #FF9800; }

/* Panel 2: Cámara */
.camera-container {
    position: relative;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
}

#video {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 4/3;
    object-fit: cover;
}

.guia-texto {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px;
    border-radius: 30px;
    text-align: center;
    font-weight: bold;
    border: 2px solid yellow;
    backdrop-filter: blur(5px);
}

.ejemplo-serie {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin: 15px 0;
    font-family: monospace;
    font-size: 1.3rem;
    border-left: 5px solid;
}

.ejemplo-serie[data-corte="10"] { border-color: #2196F3; }
.ejemplo-serie[data-corte="20"] { border-color: #4CAF50; }
.ejemplo-serie[data-corte="50"] { border-color: #FF9800; }

.button-group {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.btn {
    padding: 15px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-capture {
    flex: 2;
    background: #4CAF50;
    color: white;
}

.btn-switch {
    flex: 1;
    background: #2196F3;
    color: white;
}

.btn-volver {
    width: 100%;
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
    margin-top: 10px;
}

.btn-primary {
    background: #667eea;
    color: white;
    width: 100%;
}

.btn-volver-inicio {
    margin-top: 20px;
}

/* Panel 3: Resultados */
.resultado-card {
    text-align: center;
    padding: 20px;
    border-radius: 15px;
    margin: 15px 0;
}

.resultado-card.habilitado {
    background: #d4edda;
    border: 2px solid #c3e6cb;
}

.resultado-card.inhabilitado {
    background: #f8d7da;
    border: 2px solid #f5c6cb;
}

.resultado-icono {
    font-size: 4rem;
    margin-bottom: 10px;
}

.resultado-card h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.info-group {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.info-row:last-child {
    border-bottom: none;
}

.label {
    font-weight: 600;
    color: #666;
}

.value {
    font-weight: 700;
    font-family: monospace;
    font-size: 1.2rem;
}

.mensaje {
    font-size: 1rem;
    margin-top: 10px;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error toast */
.error-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #dc3545;
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
    z-index: 10000;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    .button-group {
        flex-direction: column;
    }
    
    .btn-switch {
        flex: none;
    }
}

/* Asegurar que los botones sean siempre clicables en móvil */
button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    touch-action: manipulation; /* Evita gestos del navegador */
    cursor: pointer;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Forzar visibilidad de los paneles */
.panel {
    display: block;
}

.panel.hidden {
    display: none !important;
}

/* Ajustes para pantallas táctiles */
.corte-btn {
    min-height: 100px; /* Área táctil más grande */
}