:root {
    --inatec-blue: #004b93;
    --inatec-orange: #ff7900;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--inatec-blue);
    color: white;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 2.5rem;
    color: #ffffff;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    padding-bottom: 1rem;
}

.sidebar nav ul {
    list-style: none;
}

.sidebar nav ul li {
    margin-bottom: 0.5rem;
}

.sidebar nav ul li a {
    color: white;
    text-decoration: none;
    padding: 0.8rem 1rem;
    display: block;
    border-radius: 8px;
    transition: var(--transition);
}

.sidebar nav ul li a:hover, .sidebar nav ul li a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--inatec-orange);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

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

.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background-color: #003a73;
}

.btn-secondary {
    background-color: var(--inatec-orange);
    color: white;
}

.btn-secondary:hover {
    background-color: #e66d00;
}

/* Cards & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); /* Más pequeñas para que quepan todas */
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 0.8rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    text-align: center;
}

.stat-card h3 {
    font-size: 0.75rem; /* Texto un poco más pequeño */
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-card .value {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--inatec-blue);
}

/* Charts Area */
.charts-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr; /* El de estados un poco más ancho */
    gap: 1.5rem;
}

.chart-container {
    background: var(--card-bg);
    padding: 1.2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    height: 320px; /* Altura fija para consistencia */
    display: flex;
    flex-direction: column;
}

.chart-container canvas {
    max-height: 220px !important;
    width: 100% !important; /* Que ocupe todo el ancho */
    margin: auto;
}

/* Tables */
.table-container {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

/* Badges & Status */
.badge {
    padding: 0.4rem 0.9rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white !important;
}

.badge-matriculado { background-color: #27ae60; }
.badge-entregado { background-color: #17a2b8; }
.badge-impreso { background-color: #007bff; }
.badge-pendiente { background-color: #f1c40f; color: #2d3436 !important; } /* Amarillo con texto oscuro para contraste */
.badge-no-matriculado { background-color: #95a5a6; }
.badge-retirado { background-color: #e74c3c; }
.badge-info { background-color: var(--inatec-blue); }
.auth-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--inatec-blue) 0%, #003a73 100%);
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--inatec-blue);
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--inatec-blue);
}

.error-msg {
    background: #ffe0e0;
    color: #d63031;
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
}

.mobile-nav {
    display: none;
}

/* --- SISTEMA RESPONSIVO PRO --- */

/* Ajustes Base para Móviles */
@media (max-width: 992px) {
    .sidebar {
        width: 70px; /* Sidebar colapsado por defecto en tablets */
        padding: 1rem 0.5rem;
        transition: width 0.3s ease;
        position: relative;
        z-index: 1000;
    }
    
    .sidebar:hover {
        width: 260px; /* Se expande al pasar el mouse */
    }

    .sidebar h2 span {
        display: none; /* Ocultar texto del logo */
    }
    
    .sidebar:hover h2 span {
        display: inline;
    }

    .sidebar nav ul li a span {
        display: none;
    }

    .sidebar:hover nav ul li a span {
        display: inline;
        margin-left: 10px;
    }

    .sidebar nav ul li a {
        text-align: center;
        padding: 0.8rem;
    }

    .sidebar:hover nav ul li a {
        text-align: left;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column; /* Sidebar arriba en móviles */
    }

    .sidebar {
        width: 100% !important;
        height: auto;
        padding: 0.5rem 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        position: sticky;
        top: 0;
    }

    .sidebar h2 {
        margin-bottom: 0;
        font-size: 1rem;
    }

    .sidebar h2 span {
        display: inline;
    }

    .sidebar nav {
        display: none; /* Se activará con un toggle si es necesario, por ahora menu horizontal simple */
    }

    /* Menú horizontal simple para móvil */
    .mobile-nav {
        display: flex;
        gap: 1rem;
        overflow-x: auto;
        padding: 0.5rem 0;
        width: 100%;
        background: var(--inatec-blue);
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    .mobile-nav a {
        color: white;
        text-decoration: none;
        font-size: 0.8rem;
        white-space: nowrap;
        padding: 0.5rem 1rem;
        border-radius: 20px;
        background: rgba(255,255,255,0.1);
    }

    .main-content {
        padding: 1rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columnas en móvil */
    }

    .charts-grid {
        grid-template-columns: 1fr; /* 1 columna para gráficos */
    }

    .chart-container {
        height: auto;
        min-height: 250px;
    }

    /* Ajuste de tablas en móvil */
    .table-container {
        margin-left: -1rem;
        margin-right: -1rem;
        border-radius: 0;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.6rem;
    }

    .btn {
        width: 100%; /* Botones ocupan todo el ancho en móvil */
        text-align: center;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr; /* 1 columna en teléfonos pequeños */
    }
    
    .sidebar h2 span {
        font-size: 0.8rem;
    }
}
