/**
 * CSS: Análisis de Calificaciones Parciales
 * Archivo: assets/css/parciales-shortcode.css
 * Versión: 1.0.0
 */

/* ========================================
   CONTENEDOR PRINCIPAL
   ======================================== */
.escolares-parciales-container {
    margin: 0 auto;
    padding: 20px;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ========================================
   HEADER
   ======================================== */
.parciales-header {
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    gap: 20px;
    align-items: center;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.header-logo img {
    max-width: 100%;
    height: auto;
}

.header-texto h1 {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 28px;
    text-align: center;
    color: #2c3e50;
}

.header-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.header-lista label {
    font-weight: 600;
    font-size: 14px;
    color: #34495e;
}

.header-lista select {
    padding: 8px 12px;
    border: 2px solid #3498db;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.header-lista select:hover {
    border-color: #2980b9;
}

.header-lista select:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ========================================
   RENGLÓN 1 - FILTROS E INFO
   ======================================== */
.parciales-renglon-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.renglon1-seccion1,
.renglon1-seccion2 {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.renglon1-seccion1 h3,
.renglon1-seccion2 h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

/* Filtros */
.filtros-group {
    display: flex;
    flex-direction: row;  /* ← Cambiar a row */
    gap: 10px;            /* ← Reducir gap */
    flex-wrap: wrap;      /* ← Permitir wrap si no caben */
}

.filtro-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;              /* ← Todos mismo ancho */
    min-width: 150px;     /* ← Ancho mínimo para que no se vean muy pequeños */
}

.filtro-item label {
    font-weight: 600;
    font-size: 12px;      /* ← Reducir tamaño de fuente */
    color: #34495e;
}

.filtro-item select {
    padding: 5px;         /* ← Reducir padding */
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 12px;      /* ← Reducir tamaño de fuente */
    background: #fff;
    transition: all 0.3s ease;
    width: 100%;          /* ← Asegurar que ocupen todo el ancho disponible */
}

/* Cuadros Informativos - EN UNA SOLA LÍNEA */
.info-genero,
.info-acreditacion {
    display: flex;
    gap: 8px;              /* ← Reducir gap */
    margin-bottom: 0;      /* ← Eliminar margin-bottom */
}

/* Hacer que ambos contenedores se vean como uno solo */
.info-genero {
    margin-bottom: 8px;    /* ← Solo espacio pequeño entre filas */
}

.info-box {
    flex: 1;
    padding: 5px;          /* ← Reducir padding de 15px a 5px */
    border-radius: 6px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;       /* ← Reducir font de 16px a 14px */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;         /* ← Agregar flex */
    align-items: center;   /* ← Centrar verticalmente */
    justify-content: center; /* ← Centrar horizontalmente */
    gap: 5px;              /* ← Espacio entre label y valor */
}

/* TRUCO: Poner todos los cuadros en una sola línea */
/* Cuadros Informativos - TODOS EN UNA LÍNEA SIN ESPACIOS */
.renglon1-seccion2 {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Hacer que los contenedores intermedios NO ocupen espacio */
.info-genero,
.info-acreditacion {
    display: contents; /* Los contenedores son invisibles */
}

.info-box {
    flex: 1;
    min-width: 80px;      /* Ancho mínimo para cada cuadro */
    padding: 5px;
    border-radius: 6px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* Los contenedores internos ahora solo agrupan los elementos */
.info-genero,
.info-acreditacion {
    display: contents; /* ← Esto hace que los hijos se comporten como si no hubiera contenedor */
}

.info-hombres {
    background: #B3D9FF;
    color: #1565C0;
}

.info-mujeres {
    background: #FFB3D9;
    color: #C2185B;
}

.info-total {
    background: #FFD9B3;
    color: #E65100;
}

.info-acreditados {
    background: #B3FFD9;
    color: #2E7D32;
}

.info-reprobados {
    background: #FFB3B3;
    color: #C62828;
}

.info-label {
    margin-right: 8px;
}

/* ========================================
   RENGLÓN 2 - GRÁFICAS
   ======================================== */
.parciales-renglon-2 {
    display: grid;
    grid-template-columns: 65% 35%;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;                    /* ← AGREGAR: Ancho al 70% */
    margin-left: auto;             /* ← AGREGAR: Centrar */
    margin-right: auto;            /* ← AGREGAR: Centrar */
}

.renglon2-seccion1,
.renglon2-seccion2 {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.renglon2-seccion1 h3,
.renglon2-seccion2 h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #2c3e50;
    text-align: center;
}

.renglon2-seccion1 canvas {
    max-height: 300px;             /* ← CAMBIAR: De 400px a 300px (3/4) */
}

.renglon2-seccion2 canvas {
    max-height: 300px;             /* ← CAMBIAR: Para que sea proporcional */
    max-width: 300px;              /* ← AGREGAR: Limitar ancho */
    margin: 0 auto;                /* ← AGREGAR: Centrar */
    display: block;                /* ← AGREGAR: Para que margin funcione */
}

.grafica-pie {
    text-align: center;
    margin-top: 10px;
    font-size: 13px;
    color: #7f8c8d;
    font-style: italic;
}

/* ========================================
   RENGLÓN 3 - CALIFICACIONES
   ======================================== */
.parciales-renglon-3 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.renglon3-seccion1,
.renglon3-seccion2 {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.renglon3-seccion1 h3,
.renglon3-seccion2 h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.renglon3-seccion1 canvas {
    height: 300px !important;
}

/* Estadísticas */
.estadisticas-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.estadistica-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: #ecf0f1;
    border-radius: 4px;
    border-left: 4px solid #3498db;
}

.estadistica-label {
    font-weight: 600;
    color: #34495e;
    font-size: 14px;
}

.estadistica-valor {
    font-weight: 700;
    color: #2c3e50;
    font-size: 16px;
}

/* ========================================
   RENGLÓN 4 - TABLA DE REPROBACIÓN
   ======================================== */
.parciales-renglon-4 {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.parciales-renglon-4 h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.tabla-reprobacion-wrapper {
    overflow-x: auto;
}

.tabla-reprobacion {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tabla-reprobacion thead {
    background: #3498db;
    color: #fff;
}

.tabla-reprobacion th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.tabla-reprobacion tbody tr {
    border-bottom: 1px solid #ecf0f1;
    transition: background 0.2s ease;
}

.tabla-reprobacion tbody tr:hover {
    background: #f8f9fa;
}

.tabla-reprobacion td {
    padding: 12px;
}

.tabla-reprobacion td.text-center {
    text-align: center;
}

.tabla-vacia {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 30px !important;
}

.comentarios-preview {
    display: inline-block;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-editar-observaciones {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-editar-observaciones:hover {
    background: #ecf0f1;
    transform: scale(1.1);
}

/* ========================================
   MODAL DE OBSERVACIONES
   ======================================== */
.modal-observaciones {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #ecf0f1;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #7f8c8d;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

.modal-body {
    padding: 20px;
}

.modal-body textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.modal-body textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #ecf0f1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-secondary {
    background: #95a5a6;
    color: #fff;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-primary {
    background: #3498db;
    color: #fff;
}

.btn-primary:hover {
    background: #2980b9;
}

/* ========================================
   LOADING OVERLAY
   ======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #ecf0f1;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1200px) {
    .parciales-header {
        grid-template-columns: 150px 1fr 180px;
    }
}

@media (max-width: 992px) {
    .parciales-renglon-1,
    .parciales-renglon-2,
    .parciales-renglon-3 {
        grid-template-columns: 1fr;
    }
    
    .parciales-header {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .header-logo {
        margin: 0 auto;
    }
    
    .header-lista {
        max-width: 300px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .escolares-parciales-container {
        padding: 10px;
    }
    
    .info-genero,
    .info-acreditacion {
        flex-direction: column;
    }
    
    .tabla-reprobacion {
        font-size: 12px;
    }
    
    .tabla-reprobacion th,
    .tabla-reprobacion td {
        padding: 8px;
    }
    .header-logo {
        display: none;
    }
}