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

:root {
    --color-primary: #2d7a3e;
    --color-primary-dark: #1f5629;
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-danger: #dc3545;
    --color-info: #17a2b8;
    --color-light: #f8f9fa;
    --color-gray: #6c757d;
    --color-border: #dee2e6;
    --color-text: #333;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-light);
    color: var(--color-text);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    padding: 30px 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.logo {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.header h1 {
    font-size: 28px;
    font-weight: 300;
    margin: 0;
}

/* Secciones */
.section {
    background: white;
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 4px solid var(--color-primary);
}

.section h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--color-primary);
}

/* Formulario */
.form-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.input-field {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(45, 122, 62, 0.1);
}

/* Botones */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-dark);
    box-shadow: 0 4px 12px rgba(45, 122, 62, 0.3);
}

.btn-success {
    background-color: var(--color-success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #218838;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-warning {
    background-color: var(--color-warning);
    color: #333;
}

.btn-warning:hover:not(:disabled) {
    background-color: #e0a800;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.btn-danger {
    background-color: var(--color-danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #c82333;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.btn-info {
    background-color: var(--color-info);
    color: white;
    flex: 1;
}

.btn-info:hover:not(:disabled) {
    background-color: #138496;
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

/* Mensajes */
.mensaje {
    margin-top: 15px;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
    min-height: 20px;
}

.mensaje.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.mensaje.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Opciones de Captura */
.opciones-captura {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.opciones-captura .btn-info {
    flex: 1;
    min-width: 150px;
    padding: 20px;
    font-size: 18px;
    height: auto;
}

/* Video Container Estándar */
.video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
    aspect-ratio: 4/3;
}

.video-container video,
.video-container canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Sección Captura Grande (Pantalla Completa Móvil) */
.section-captura {
    background: white;
    padding: 0;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.header-captura {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
}

.header-captura h2 {
    font-size: 16px;
    margin-bottom: 5px;
    color: white;
}

/* Video Container Grande */
.video-container-grande {
    position: relative;
    width: 100%;
    background: #000;
    overflow: hidden;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container-grande video,
.video-container-grande canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Controles Captura Grande */
.controles-captura-grande {
    display: flex;
    gap: 10px;
    padding: 20px;
    background: #f8f9fa;
    flex-direction: column;
}

.btn-captura-grande {
    padding: 14px 28px;
    background-color: var(--color-warning);
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-captura-grande:hover {
    background-color: #ffb300;
    box-shadow: 0 3px 12px rgba(255, 193, 7, 0.4);
    transform: scale(1.01);
}

.btn-captura-grande:active {
    transform: scale(0.99);
}

.btn-danger-pequeno {
    padding: 12px 24px;
    background-color: var(--color-danger);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger-pequeno:hover {
    background-color: #c82333;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.info-captura {
    background-color: #e7f3ff;
    border-left: 4px solid var(--color-info);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.info-captura p {
    margin: 5px 0;
    font-size: 14px;
}

.info-captura .hint {
    color: var(--color-gray);
    font-style: italic;
}

#estadoCaptura {
    color: var(--color-info);
    font-weight: 500;
}

/* Controles */
.controles-captura,
.controles-preview {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.controles-captura .btn,
.controles-preview .btn {
    flex: 1;
    min-width: 150px;
}

/* Galería de Fotos */
.galeria-fotos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.foto-item {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.foto-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.foto-item .btn-eliminar {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
}

.foto-item .btn-eliminar:hover {
    background: rgba(220, 53, 69, 1);
}

.foto-item .numero {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(45, 122, 62, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

/* Progreso */
.progress-container {
    width: 100%;
    height: 30px;
    background-color: var(--color-border);
    border-radius: 6px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-success));
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

#textoProgreso {
    text-align: center;
    color: var(--color-gray);
    font-size: 14px;
}

/* Cajas de Resultado */
.exito-box,
.error-box {
    text-align: center;
    padding: 40px 20px;
}

.exito-icon,
.error-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.exito-box h2 {
    color: var(--color-success);
    margin-bottom: 15px;
}

.error-box h2 {
    color: var(--color-danger);
    margin-bottom: 15px;
}

.exito-box p,
.error-box p {
    color: var(--color-gray);
    margin-bottom: 25px;
    line-height: 1.6;
}

.exito-box .btn,
.error-box .btn {
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 12px;
    }

    .header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    .logo {
        font-size: 20px;
    }

    .header h1 {
        font-size: 22px;
    }

    .section {
        padding: 15px;
    }

    .form-group {
        flex-direction: column;
    }

    .input-field {
        min-width: 100%;
    }

    .btn {
        font-size: 14px;
        padding: 10px 16px;
    }

    .galeria-fotos {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .opciones-captura {
        flex-direction: column;
    }

    .opciones-captura .btn-info {
        min-width: 100%;
    }
}
