/* Variables Globales (basadas en styles.css pero refinadas para este módulo) */
:root {
    --primary-blue: #1565C0;
    --light-bg: #F5F7FA;
    --card-bg: #FFFFFF;
    --text-dark: #333333;
    --text-muted: #666666;
    --border-radius: 12px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
}

body {
    background-color: var(--light-bg);
}

/* --- Layout General --- */
.main-container {
    max-width: 800px;
    /* Ancho más contenido tipo "App" */
    margin: 0 auto;
    padding: 1rem;
}

/* --- Filtros y Selectores --- */
.filter-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.filter-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #fff;
    color: var(--text-dark);
}

/* --- Botones de Exportación (Estilo Tarjeta Grande) --- */
.export-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 480px) {
    .export-actions {
        grid-template-columns: 1fr;
    }
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--primary-blue);
    border-radius: var(--border-radius);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.export-btn:hover {
    background-color: #E3F2FD;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.export-icon-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.export-text {
    display: flex;
    flex-direction: column;
}

.export-title {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1rem;
}

.export-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Dashboard de Estadísticas (Resumen del Curso) --- */
.stats-container {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.stats-header {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    text-align: center;
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 320px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.stat-icon {
    font-size: 1.5rem;
    color: var(--primary-blue);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-dark);
}

/* --- Rendimiento de Actividades (Barras de Progreso) --- */
.performance-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.performance-item {
    margin-bottom: 1.25rem;
}

.performance-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.activity-name {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.activity-score {
    font-weight: 700;
    color: var(--text-dark);
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background-color: #E0E0E0;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--primary-blue);
    border-radius: 5px;
    transition: width 0.5s ease-out;
}

.view-all-btn {
    display: block;
    width: fit-content;
    margin: 1rem 0 0 auto;
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-weight: 500;
}

/* --- Perfil de Alumno (Tarjeta) --- */
.student-profile-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 480px) {
    .student-profile-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}

.profile-img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #eee;
}

.profile-info h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-dark);
}

.profile-id {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0.25rem 0;
}

.profile-average {
    font-weight: 700;
    color: var(--text-dark);
}

/* --- Gráficos de Barras Verticales (Progreso Semestre) --- */
.chart-container {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.bar-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 200px;
    padding-top: 2rem;
    overflow-x: auto;
    gap: 10px;
}

.bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    width: 60px;
}

.bar {
    width: 100%;
    background-color: #82B1FF;
    /* Azul claro */
    border-radius: 6px 6px 0 0;
    position: relative;
    transition: height 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bar-label {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.bar-value {
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
}

/* --- Donut Chart (Asistencia) --- */
.donut-chart-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.donut-chart-main {
    display: flex;
    align-items: center;
    gap: 2rem;
    width: 100%;
}

@media (max-width: 600px) {
    .donut-chart-main {
        flex-direction: column;
        gap: 1.5rem;
    }
}

.absent-dates-section {
    border-top: 1px solid #f0f0f0;
    padding-top: 1rem;
    width: 100%;
}

.absent-dates-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.absent-dates-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.absent-date-badge {
    background: #fff5f5;
    color: #c62828;
    border: 1px solid #ffcdd2;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}

.donut-ring {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

.donut-inner {
    width: 90px;
    height: 90px;
    background: white;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.donut-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.donut-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-dark);
}

.donut-legend {
    flex: 1;
}

.legend-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.legend-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.legend-label {
    color: var(--text-muted);
}

.legend-val {
    font-weight: 700;
    color: var(--text-dark);
}

/* --- Daily Attendance Grid --- */
.daily-attendance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.daily-stat-card {
    background: #ffffff;
    border: 1px solid #eef0f2;
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.daily-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-blue);
}

.daily-date {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    background: #f8fafc;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    width: 100%;
    text-align: center;
}

.daily-counts {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    justify-content: center;
}

.count-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.count-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
}

.count-val {
    font-size: 1.1rem;
    font-weight: 800;
}

.present .count-label {
    color: #4CAF50;
}

.present .count-val {
    color: #2E7D32;
}

.absent .count-label {
    color: #F44336;
}

.absent .count-val {
    color: #C62828;
}

/* --- Detalle Ausentes Section --- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.75rem;
}

.btn-close-section {
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.btn-close-section:hover {
    background: #e0e0e0;
    color: #333;
}

.absentee-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.absentee-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #fff5f5;
    border-radius: 8px;
    border-left: 4px solid #f44336;
}

.text-danger {
    color: #f44336;
}

/* --- Collapsible Card --- */
.card-collapsible {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.collapsible-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    background: #fafafa;
    transition: background 0.2s;
}

.collapsible-header:hover {
    background: #f0f0f0;
}

.collapsible-content {
    padding: 0 1.5rem;
    max-height: 0;
    transition: max-height 0.3s ease-out, padding 0.3s;
}

.card-collapsible.open .collapsible-content {
    max-height: 200px;
    padding: 1.5rem;
}

.card-collapsible.open .collapsible-header .material-icons-outlined {
    transform: rotate(180deg);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}

/* Better Card Spacing and visuals */
.card {
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.stats-header {
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.5rem;
}

/* --- Seguimiento Personalizado --- */
.btn-add-circle {
    background: var(--primary-blue);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-add-circle:hover {
    background: #0D47A1;
    transform: scale(1.1);
}

/* Sub-tabs */
.sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.sub-tab-button {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.sub-tab-button:hover {
    background: #f0f7ff;
    color: var(--primary-blue);
}

.sub-tab-button.active {
    background: #e3f2fd;
    color: var(--primary-blue);
}

.form-anotacion {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #e9ecef;
}

.form-anotacion textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    margin-bottom: 1rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.btn-primary-sm,
.btn-secondary-sm {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary-sm {
    background: var(--primary-blue);
    color: white;
    border: none;
}

.btn-primary-sm:hover {
    background: #0D47A1;
}

.btn-secondary-sm {
    background: white;
    color: var(--text-muted);
    border: 1px solid #dee2e6;
}

.btn-secondary-sm:hover {
    background: #f8f9fa;
}

.anotaciones-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.anotacion-card {
    background: #ffffff;
    border: 1px solid #edf2f7;
    border-radius: 12px;
    padding: 1.25rem;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.anotacion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.anotacion-fecha {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.btn-delete-anotacion {
    background: transparent;
    border: none;
    color: #cbd5e0;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-delete-anotacion:hover {
    color: #e53e3e;
    background: #fff5f5;
}

.anotacion-texto {
    font-size: 1rem;
    color: var(--text-dark);
    line-height: 1.5;
    white-space: pre-wrap;
    color: #2d3748;
}