/* ============================================
   estilos.css - Estilos comunes para el sistema UES Gestión Académica
   Fuentes: Rubik (títulos), Poppins (texto general)
   Colores principales:
   - Azul oscuro: #003087
   - Verde turquesa: #02B891
   - Celeste: #029CA6
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Rubik:wght@400;500;600;700&display=swap');

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Rubik', sans-serif;
    font-weight: 600;
    line-height: 1.3;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background-color: #003087;
    color: white;
    text-align: center;
    padding: 1rem;
    margin-top: auto;
    font-size: 0.9rem;
}

/* ============================================
   BARRA DE NAVEGACIÓN
   ============================================ */
.navbar {
    background: #003087;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar h1 {
    font-size: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar h1 img {
    width: 100px;
    height: auto;
}

.navbar h1 i {
    color: #02B891;
    font-size: 2rem;
}

.navbar .user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar .user-info span {
    font-size: 0.95rem;
}

.navbar a {
    color: white;
    text-decoration: none;
    background: rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background 0.3s;
    font-size: 0.95rem;
}

.navbar a:hover {
    background: rgba(255,255,255,0.3);
}

/* ============================================
   CONTENEDOR PRINCIPAL
   ============================================ */
.container {
    flex: 1;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    width: 100%;
}

/* ============================================
   TARJETAS GENERALES
   ============================================ */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    padding: 2rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header h2 {
    color: #333;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

h2 i, h3 i {
    margin-right: 8px;
}

h3 {
    color: #444;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.5rem;
}

/* ============================================
   BOTONES GENERALES
   ============================================ */
.btn {
    background: #003087;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.btn:hover {
    opacity: 0.9;
}

.btn-success {
    background: #02B891;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-danger {
    background: #dc3545;
}

.btn-info {
    background: #029CA6;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ============================================
   ALERTAS
   ============================================ */
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

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

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

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================
   TABLAS
   ============================================ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    /* Sin min-width fijo, se adapta al contenedor */
}

th, td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    line-height: 1.5;
    white-space: normal; /* Permitir salto de línea para evitar desbordamiento */
    word-break: break-word; /* Romper palabras largas si es necesario */
}

th {
    background: #f5f5f5;
    font-weight: 600;
}

tr:hover {
    background: #f9f9f9;
}

.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-start;
}

/* ============================================
   BUSCADOR Y FILTROS
   ============================================ */
.search-box, .filters-form {
    margin-bottom: 1.5rem;
}

.search-box {
    display: flex;
    gap: 0.5rem;
    max-width: 400px;
    width: 100%;
}

.search-box input {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: 30px;
    font-family: 'Poppins', sans-serif;
    min-width: 0;
}

.search-box button {
    padding: 0.6rem 1.2rem;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    flex: 1 1 200px;
    min-width: 150px;
}

.filter-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

/* ============================================
   PAGINACIÓN
   ============================================ */
.pagination {
    display: flex;
    gap: 0.5rem;
    margin-top: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.pagination a {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
}

.pagination a.active {
    background: #003087;
    color: white;
    border-color: transparent;
}

.pagination a:hover {
    background: #f0f0f0;
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: #555;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    line-height: 1.5;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #003087;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,48,135,0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 38px;
}

.checkbox-group input {
    width: auto;
    margin-right: 0.5rem;
}

hr {
    margin: 2rem 0;
    border: none;
    border-top: 2px solid #f0f0f0;
}

/* ============================================
   ENLACES DE RETROCESO
   ============================================ */
.btn-back {
    display: inline-block;
    margin-bottom: 1.5rem;
}

/* ============================================
   PESTAÑAS DE NAVEGACIÓN (Inicio, Mi Perfil)
   ============================================ */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
}

.tab-link {
    padding: 0.6rem 1.5rem;
    background: white;
    border-radius: 30px;
    color: #555;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid #ddd;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tab-link i {
    font-size: 1rem;
}

.tab-link.active {
    background: #003087;
    color: white;
    border-color: transparent;
}

.tab-link:hover {
    background: #f0f0f0;
}

.tab-link.active:hover {
    background: #003087;
}

/* ============================================
   PESTAÑAS DE DETALLE (Estudiante, Madre, Padre, Representante)
   ============================================ */
.tabs-detalle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.tab-detalle {
    padding: 0.5rem 1.5rem;
    background: white;
    border-radius: 30px;
    color: #555;
    font-weight: 500;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    text-align: center;
    min-width: 120px;
}

.tab-detalle.active {
    background: #003087;
    color: white;
    border-color: transparent;
}

.tab-detalle:hover {
    background: #f0f0f0;
}

.tab-detalle.active:hover {
    background: #003087;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Colores diferenciados para subtítulos en vista detalle */
.sub-estudiante {
    color: #003087;
}

.sub-madre {
    color: #02B891;
}

.sub-padre {
    color: #029CA6;
}

.sub-representante {
    color: #6c757d;
}

/* Botones de acción en vista detalle (izquierda) */
.action-buttons-left {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0 0;
    justify-content: flex-start;
}

/* Grid de dos columnas para detalles */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

.grid-2 p {
    margin-bottom: 0.8rem;
    line-height: 1.7;
}

/* ============================================
   BADGES (para estados)
   ============================================ */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-secondary {
    background: #6c757d;
    color: white;
}

/* ============================================
   TEXTO PEQUEÑO
   ============================================ */
small {
    font-size: 0.85rem;
    color: #666;
}

/* ============================================
   TARJETAS DE ADMIN (DASHBOARD)
   ============================================ */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.admin-card {
    color: white;
    text-decoration: none;
    padding: 2rem 1rem;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.admin-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.admin-card i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.admin-card span {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
}

/* Colores específicos para cada tarjeta */
.card-estudiantes {
    background: #003087;
}

.card-matriculas {
    background: #02B891;
}

.card-usuarios {
    background: #029CA6;
}

.card-imprimir {
    background: #6c757d;
}

/* ============================================
   DASHBOARD DEL REPRESENTANTE
   ============================================ */
.representante-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.representante-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    padding: 1.5rem;
    transition: transform 0.2s;
}

.representante-card:hover {
    transform: translateY(-5px);
}

.representante-card h3 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

/* ============================================
   BOTONES DE ORDENAMIENTO
   ============================================ */
.order-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.order-buttons span {
    font-weight: 500;
    color: #555;
}

.order-buttons .btn.active {
    background: #003087;
    color: white;
    border-color: transparent;
}

/* ============================================
   PÁGINA DE LOGIN
   ============================================ */
body {
    background: url('imgs/Fondo2-UES.jpg') no-repeat center center fixed;
    background-size: cover;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(5px);
}

/* ============================================
   MEDIA QUERIES PARA DISPOSITIVOS MÓVILES
   ============================================ */

/* Pantallas medianas (tablets) */
@media (max-width: 992px) {
    .container {
        padding: 0 1.5rem;
    }

    .card-header h2 {
        font-size: 1.6rem;
    }

    .admin-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .representante-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Pantallas pequeñas (móviles) */
@media (max-width: 768px) {
    /* Navbar */
    .navbar {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
    }

    .navbar h1 {
        font-size: 1.3rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .navbar .user-info {
        flex-direction: column;
        width: 100%;
    }

    .navbar .user-info span {
        font-size: 0.9rem;
    }

    .navbar a {
        width: 100%;
        justify-content: center;
    }

    /* Contenedor */
    .container {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    /* Tarjetas */
    .card {
        padding: 1.5rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-header h2 {
        font-size: 1.4rem;
    }

    /* Botones */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .btn-sm {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }

    /* Tablas */
    /* En móviles, permitir scroll horizontal si es necesario */
    .table-responsive {
        overflow-x: auto;
    }

    th, td {
        padding: 0.6rem;
        font-size: 0.9rem;
        white-space: normal;
    }

    .actions {
        flex-direction: column;
        gap: 0.3rem;
    }

    /* Buscador y filtros */
    .search-box {
        max-width: 100%;
    }

    .filters-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group label {
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
    }

    .filter-group input,
    .filter-group select {
        font-size: 0.9rem;
        padding: 0.3rem;
        line-height: 1.2;
    }

    .filter-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-buttons .btn {
        width: 100%;
    }

    /* Paginación */
    .pagination {
        gap: 0.3rem;
    }

    .pagination a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    /* Formularios */
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.5rem;
        font-size: 0.95rem;
    }

    .checkbox-group {
        min-height: auto;
    }

    /* Pestañas */
    .tabs, .tabs-detalle {
        justify-content: center;
        gap: 0.3rem;
    }

    .tab-link, .tab-detalle {
        padding: 0.4rem 1rem;
        font-size: 0.9rem;
        min-width: auto;
    }

    .tab-detalle {
        min-width: 100px;
    }

    /* Grid-2 */
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Botones de acción */
    .action-buttons-left {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Dashboard admin */
    .admin-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .admin-card {
        padding: 1.5rem 0.5rem;
    }

    .admin-card i {
        font-size: 2.5rem;
    }

    .admin-card span {
        font-size: 1.1rem;
    }

    /* Dashboard representante */
    .representante-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Login */
    .login-card {
        padding: 1.5rem;
    }
	.filter-group {
		  flex: 1 1 50px;
		}
}

/* Pantallas muy pequeñas (teléfonos en modo retrato) */
@media (max-width: 480px) {
    .navbar h1 {
        font-size: 1.1rem;
    }

    .navbar h1 img {
        width: 70px;
    }

    .card-header h2 {
        font-size: 1.2rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    th, td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .btn-sm {
        padding: 0.2rem 0.5rem;
    }

    .search-box input {
        padding: 0.5rem;
    }

    .search-box button {
        padding: 0.5rem 1rem;
    }

    .filter-group input,
    .filter-group select {
        padding: 0.2rem;
        font-size: 0.85rem;
        line-height: 1.2;
    }

    .filter-group label {
        font-size: 0.8rem;
        margin-bottom: 0.1rem;
    }

    .filter-buttons .btn {
        font-size: 0.85rem;
        padding: 0.5rem;
    }

    .pagination a {
        padding: 0.3rem 0.6rem;
        font-size: 0.85rem;
    }

    .tab-link, .tab-detalle {
        padding: 0.3rem 0.8rem;
        font-size: 0.85rem;
    }

    .login-card {
        padding: 1rem;
    }

    .login-card h1 {
        font-size: 1.3rem;
    }
	.filter-group {
		  flex: 1 1 50px;
		}
}