/* =========================================
   VARIABLES Y CONFIGURACIÓN GLOBAL
   ========================================= */
:root {
    --verde-pistacho: #93C572;
    --verde-pistacho-dark: #7FB05F;
    --azul-capturar: #5D9CEC;
    --azul-capturar-hover: #4A89DC;
    --ambar-actualizar: #D9A05B;
    --ambar-actualizar-hover: #C28D4D;
    --blanco-puro: #ffffff;
    --gris-fondo: #f0f4f0;
}

body {
    background-color: var(--gris-fondo);
    padding: 20px;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Tarjeta Principal */
.main-card {
    background: var(--blanco-puro);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border-top: 8px solid var(--verde-pistacho);
}

.text-header {
    color: #4A6E30;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =========================================
   TABLA DE ESTUDIANTES
   ========================================= */
.table thead th {
    background-color: var(--verde-pistacho) !important;
    color: white !important;
    text-align: center !important;
    vertical-align: middle;
    border: none;
    padding: 12px;
}

.text-center-td { text-align: center; vertical-align: middle; }
.text-uppercase { text-transform: uppercase; }

/* Miniaturas de fotos en la tabla */
.img-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 1px 1px 4px rgba(0,0,0,0.1);
}
.img-thumb:hover {
    transform: scale(1.1);
    border-color: var(--verde-pistacho);
}

/* =========================================
   BOTONES DE ACCIÓN
   ========================================= */
.btn-capturar-nuevo {
    background-color: var(--azul-capturar);
    color: white;
    border: none;
    font-weight: 600;
}
.btn-capturar-nuevo:hover {
    background-color: var(--azul-capturar-hover);
    color: white;
}

.btn-actualizar-existente {
    background-color: var(--ambar-actualizar);
    color: white;
    border: none;
    font-weight: 600;
}
.btn-actualizar-existente:hover {
    background-color: var(--ambar-actualizar-hover);
    color: white;
}

/* =========================================
   SISTEMA DE CÁMARA (MODAL)
   ========================================= */
.camara-box {
    width: 320px;
    height: 320px;
    margin: 0 auto 15px;
    border: 5px solid var(--verde-pistacho);
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    position: relative;
}

video, #fotoPreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* El transform scaleX lo maneja JS para evitar conflictos */
}

/* Guía de Encuadre (Óvalo y Líneas) */
.guia-encuadre {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 25;
    pointer-events: none; /* No interfiere con los clics */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Óvalo para el rostro */
.guia-encuadre::before {
    content: "";
    width: 55%;
    height: 70%;
    border: 2px dashed rgba(147, 197, 114, 0.6); /* Verde suave */
    border-radius: 50% 50% 45% 45%;
    position: absolute;
    top: 15%;
}

/* Línea de guía para los ojos */
.guia-encuadre::after {
    content: "";
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
    position: absolute;
    top: 42%;
}

/* Indicadores y botones sobre el video */
#camaraActual {
    z-index: 30;
    font-size: 0.7rem;
    padding: 6px 10px;
    opacity: 0.9;
}

#btnCambiarCamara {
    z-index: 30;
    font-weight: 600;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* =========================================
   DISEÑO DE MODALES
   ========================================= */
.modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    border-bottom: none;
}

.modal-title {
    margin: 0 auto;
    text-align: center;
    width: 100%;
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-header .btn-close {
    position: absolute;
    right: 1rem;
    margin: 0;
}

.modal-content {
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* =========================================
   RESPONSIVE (MÓVILES)
   ========================================= */
@media (max-width: 576px) {
    body { padding: 10px; }

    .main-card { padding: 15px; }

    .modal-dialog-centered {
        display: flex;
        align-items: center;
        min-height: calc(100% - 1rem);
    }

    .camara-box {
        width: 280px;
        height: 280px;
    }

    .btn-lg {
        font-size: 0.9rem;
        padding: 12px;
    }
}