/* Importar Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* Variables de Diseño (Tema UNAM/Académico) */
:root {
    --font-heading: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;

    /* Colores */
    --color-primary: #0a1f33;       /* Azul marino profundo */
    --color-primary-light: #123354; /* Azul marino medio */
    --color-gold: #b3862b;          /* Oro académico */
    --color-gold-light: #e5b858;    /* Oro claro para detalles */
    --color-gold-dark: #8c661b;     /* Oro oscuro para textos o bordes */
    --color-accent: #0f766e;        /* Acento turquesa oscuro para elementos secundarios */
    
    --bg-main: #f8fafc;             /* Gris muy claro/azulino de fondo */
    --bg-card: #ffffff;             /* Fondo blanco para tarjetas */
    
    --text-main: #1e293b;           /* Gris oscuro para texto principal */
    --text-muted: #64748b;          /* Gris medio para textos secundarios */
    --text-white: #ffffff;
    
    --border-color: #cbd5e1;        /* Gris claro para bordes */
    --border-focus: #b3862b;        /* Oro al enfocar */
    
    --success: #15803d;             /* Verde para confirmaciones */
    --error: #b91c1c;               /* Rojo para errores */
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-body);
    font-size: 16px; /* Cumple holgadamente con el mínimo de 15px */
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-main);
    background-image: radial-gradient(at 0% 0%, rgba(10, 31, 51, 0.03) 0px, transparent 50%),
                      radial-gradient(at 50% 0%, rgba(179, 134, 43, 0.03) 0px, transparent 50%);
    background-attachment: fixed;
    padding: 40px 20px;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Encabezado */
header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 20px;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-gold) 100%);
    border-radius: 2px;
}

.logo-container {
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.badge-unam {
    background-color: var(--color-primary);
    color: var(--color-gold-light);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    padding: 4px 12px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid var(--color-gold);
    display: inline-block;
}

h1 {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    max-width: 700px;
    margin: 0 auto 8px auto;
}

.subtitle {
    font-size: 17px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Tarjetas y Formularios */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(226, 232, 240, 0.8);
    overflow: hidden;
    margin-bottom: 30px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.08);
}

.card-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: var(--text-white);
    padding: 24px 35px;
    border-bottom: 4px solid var(--color-gold);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 35px;
}

/* Secciones del Formulario */
.form-section {
    margin-bottom: 35px;
}

.form-section-title {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f1f5f9;
    display: flex;
    align-items: center;
}

.form-section-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 18px;
    background-color: var(--color-gold);
    margin-right: 10px;
    border-radius: 3px;
}

/* Grid del Formulario */
.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }

/* Grupos de Control */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    display: flex;
    justify-content: space-between;
}

.required-star {
    color: var(--error);
    margin-left: 2px;
}

.input-help {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 400;
}

/* Inputs, Selects y Textareas */
input[type="text"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 15px; /* Mínimo requerido de 15px */
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #f8fafc;
    color: var(--text-main);
    transition: var(--transition);
    outline: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(179, 134, 43, 0.15);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: var(--text-white);
    box-shadow: 0 4px 10px rgba(10, 31, 51, 0.25);
    border-bottom: 2px solid var(--color-gold);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(10, 31, 51, 0.35);
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
    background-color: #cbd5e1;
    color: #1e293b;
}

.btn-accent {
    background-color: var(--color-gold);
    color: var(--text-white);
    border-bottom: 2px solid var(--color-gold-dark);
}

.btn-accent:hover {
    background-color: var(--color-gold-light);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--error);
    color: var(--text-white);
}

.btn-danger:hover {
    background-color: #991b1b;
}

/* Alertas y Notificaciones */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 25px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #f0fdf4;
    color: var(--success);
    border-color: #bbf7d0;
}

.alert-danger {
    background-color: #fef2f2;
    color: var(--error);
    border-color: #fecaca;
}

/* Toast Notificaciones Temporales */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.toast {
    background-color: var(--bg-card);
    border-left: 5px solid var(--color-gold);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-sm);
    padding: 15px 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out forwards;
}

.toast-success {
    border-left-color: var(--success);
}

.toast-error {
    border-left-color: var(--error);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Admin Dashboard Table */
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.search-wrapper {
    position: relative;
    max-width: 350px;
    width: 100%;
}

.search-input {
    padding-left: 40px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    box-shadow: var(--shadow-sm);
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1;
}

.stat-label {
    font-size: 15px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    text-align: left;
    background-color: var(--bg-card);
}

th {
    background-color: #f1f5f9;
    color: var(--color-primary);
    font-weight: 700;
    padding: 14px 18px;
    border-bottom: 2px solid #cbd5e1;
    white-space: nowrap;
}

td {
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

.actions-cell {
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

.btn-icon {
    padding: 8px 12px;
    font-size: 15px;
    border-radius: 4px;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 50px;
    font-size: 15px;
    color: var(--text-muted);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 20px;
}

.back-link:hover {
    color: var(--color-gold);
}

/* Responsividad */
@media (max-width: 768px) {
    body {
        padding: 20px 10px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .form-grid {
        gap: 15px;
    }
    
    .col-8, .col-6, .col-4, .col-3 {
        grid-column: span 12;
    }
    
    .admin-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-wrapper {
        max-width: 100%;
    }
}

/* ==========================================
   ESTILOS DE IMPRESIÓN (DISEÑO IDÉNTICO AL PDF)
   ========================================== */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
        padding: 0 !important;
        margin: 0 !important;
        font-family: 'Times New Roman', Times, serif, sans-serif !important;
        font-size: 12pt !important;
    }

    .no-print {
        display: none !important;
    }

    .print-document {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }

    /* Título del documento de impresión */
    .print-header {
        text-align: center;
        margin-bottom: 25px;
    }
    
    .print-title {
        font-family: Arial, sans-serif;
        font-size: 13pt;
        font-weight: bold;
        text-transform: uppercase;
        margin-bottom: 5px;
        line-height: 1.4;
    }

    .print-year {
        font-family: Arial, sans-serif;
        font-size: 13pt;
        font-weight: bold;
        margin-bottom: 20px;
    }

    /* Cajas y celdas estructuradas como el PDF original */
    .pdf-box {
        border: 1px solid #000000;
        margin-bottom: 18px;
        width: 100%;
        display: table;
        border-collapse: collapse;
    }

    .pdf-row {
        display: table-row;
    }

    .pdf-cell {
        display: table-cell;
        border: 1px solid #000000;
        padding: 12px 8px 6px 8px;
        vertical-align: bottom;
        position: relative;
    }

    .pdf-label {
        font-family: Arial, sans-serif;
        font-size: 8pt;
        font-weight: bold;
        text-transform: uppercase;
        display: block;
        margin-bottom: 4px;
        color: #000000;
    }

    .pdf-value {
        font-family: 'Times New Roman', Times, serif;
        font-size: 12pt;
        min-height: 20px;
        word-break: break-word;
        padding-bottom: 2px;
    }

    .pdf-section-title {
        font-family: Arial, sans-serif;
        font-size: 11pt;
        font-style: italic;
        font-weight: bold;
        margin-top: 15px;
        margin-bottom: 8px;
        text-transform: uppercase;
    }

    /* Estilos específicos de línea y espaciados para replicar el PDF */
    .pdf-underline-row {
        margin-top: 15px;
        margin-bottom: 15px;
        font-family: Arial, sans-serif;
        font-size: 10pt;
    }

    .pdf-underline-label {
        font-weight: bold;
        text-transform: uppercase;
    }

    .pdf-underline-value {
        display: inline-block;
        border-bottom: 1px solid #000000;
        min-width: 300px;
        padding-left: 8px;
        font-family: 'Times New Roman', Times, serif;
        font-size: 12pt;
    }

    /* Firmas */
    .pdf-signatures {
        margin-top: 70px;
        display: flex;
        justify-content: space-around;
        text-align: center;
    }

    .pdf-sig-line {
        border-top: 1.5px solid #000000;
        width: 250px;
        padding-top: 8px;
        font-family: Arial, sans-serif;
        font-size: 9pt;
        font-weight: bold;
        text-transform: uppercase;
    }
}
