/* ========================================== */
/* ESTILOS GLOBALES Y BASE                    */
/* ========================================== */
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    /* Fondo con el degradado azul suave y relajante */
    background: linear-gradient(135deg, #e6f0fa 0%, #b3d1ff 100%);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    box-sizing: border-box;
}

textarea {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    margin-bottom: 15px;
    box-sizing: border-box;
}

/* ========================================== */
/* SECCIÓN 1: PORTADA Y CENTRADO DEL INICIO   */
/* ========================================== */

/* Este contenedor ocupa todo el alto de la pantalla inicial 
   y fuerza a que la tarjeta interior quede perfectamente centrada */
.wrapper-portada {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* Usa el 100% del alto de la ventana del navegador */
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

/* Tarjeta principal estilizada */
.portada-container {
    position: relative;
    text-align: center;
    background: #ffffff;
    padding: 60px 40px 45px 40px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 64, 128, 0.1);
    max-width: 550px;
    width: 90%;
    box-sizing: border-box;
    border-top: 6px solid #0056b3;
}

.escudo-esquina {
    position: absolute;
    top: 15px;
    left: 20px;
    width: 55px;
    height: auto;
    filter: drop-shadow(0px 2px 4px rgba(0,0,0,0.1));
}

.institucion-nombre {
    color: #666;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 10px 0 5px 0;
}

.portada-container h1 {
    color: #004080;
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 35px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.btn-principal {
    padding: 15px 40px;
    background: linear-gradient(135deg, #004080 0%, #0056b3 100%);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 50px;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 64, 128, 0.25);
    transition: all 0.3s ease;
}

.btn-principal:hover {
    background: linear-gradient(135deg, #0056b3 0%, #0073e6 100%);
    box-shadow: 0 6px 20px rgba(0, 64, 128, 0.35);
    transform: translateY(-2px);
}

/* --- VENTANA FLOTANTE (MODAL) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 40, 80, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 999;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: white;
    padding: 35px 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    width: 90%;
    max-width: 380px;
    text-align: center;
    position: relative;
}

.modal-box h3 {
    margin: 0 0 10px 0;
    color: #004080;
    font-size: 22px;
    font-weight: 700;
}

.modal-box input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
    text-align: center;
}

.modal-box input:focus {
    border-color: #004080;
    outline: none;
}

.btn-entrar {
    padding: 12px 25px;
    background: #28a745;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-weight: bold;
    width: 100%;
    font-size: 16px;
    transition: background 0.2s;
    margin-top: 10px;
}

.btn-entrar:hover {
    background: #218838;
}

.btn-cerrar {
    position: absolute;
    top: 12px;
    right: 18px;
    font-size: 24px;
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
}

.btn-cerrar:hover {
    color: #333;
}

/* ========================================== */
/* SECCIÓN 2: FORMULARIO Y OFICIO (CÓDIGO 2)  */
/* ========================================== */

.container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 900px;
    margin: 40px auto; /* Deja márgenes elegantes arriba y abajo al hacer scroll */
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.container input {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    margin-bottom: 15px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* SOLUCIÓN DIRECTA: Todos los botones normales del contenedor comparten este estilo */
.container button {
    padding: 10px 20px;
    background: #004080;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    font-weight: bold;
    font-size: 14px;
    transition: background 0.2s, transform 0.1s;
}

.container button:hover {
    background: #0066cc;
}

.container button:active {
    transform: scale(0.98);
}

.oficio {
    border: 1px solid #ccc;
    padding: 40px 50px;
    margin-top: 20px;
    background: white;
    color: #000000;
    line-height: 1.6;
    transition: all 0.3s ease;
}

.oficio-vista-previa {
    max-width: 650px; 
    margin: 20px auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: 2px solid #004080;
}

.historial {
    margin-top: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table, th, td {
    border: 1px solid #ccc;
}

th, td {
    padding: 10px;
    text-align: left;
}

/* Forzamos que solo el botón verde de "Abrir" dentro de la tabla mantenga su estilo mini */
.container table button.btn-abrir-tabla {
    background: #28a745;
    padding: 6px 12px;
    font-size: 13px;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.container table button.btn-abrir-tabla:hover {
    background: #218838;
}