:root {
    --primary: #002845;
    --secondary: #0062ab;
    --success: #2ecc71;
    --danger: #ef4444;
    --white: #ffffff;
    --bg: #f8f9fc;
    --text: #334155;
    --text-light: #64748b;
    --border: #e2e8f0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    line-height: 1.5;
}

/* Header Estilo Validador */
header {
    background: var(--white);
    border-bottom: 3px solid var(--danger);
    padding: 15px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-links {
    display: flex;
    align-items: center;
    height: 100%;
}

.contact-link {
    color: #1a1a1a;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0 20px;
    height: 40px;
    display: flex;
    align-items: center;
    border-right: 1px solid #e2e8f0;
    transition: color 0.2s, background 0.2s;
}

.contact-link:last-child {
    border-right: none;
}

.contact-link:hover {
    color: var(--secondary);
    background: #f8fafc;
}

.nav-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-title img {
    height: 40px;
}

.container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Stats / Cards Superiores */
.card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat {
    background: var(--white);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    border-left: 5px solid var(--primary);
    transition: transform 0.2s;
}

.stat:hover {
    transform: translateY(-3px);
}

.stat label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-light);
    display: block;
    margin-bottom: 8px;
}

.stat h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary);
}

/* Panel Principal (Hero Adaptado) */
.main-panel {
    background: var(--white);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 40px;
    align-items: center;
}

.hero-content h1 {
    font-size: 2.25rem;
    color: var(--primary);
    margin: 0 0 20px 0;
    line-height: 1.2;
}

.hero-content p {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: 24px;
}

.hero-image {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Grid de Convocatorias (Estilo Action Boxes) */
.action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.action-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    position: relative;
    transition: 0.3s;
}

.action-box:hover {
    border-color: var(--secondary);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.action-box .img-thumb {
    height: 160px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    margin-bottom: 20px;
}

.action-box h4 {
    font-size: 0.85rem;
    color: var(--secondary);
    text-transform: uppercase;
    margin: 0 0 12px 0;
    letter-spacing: 0.05em;
}

.action-box h2 {
    font-size: 1.5rem;
    margin: 0 0 15px 0;
    color: var(--primary);
}

.action-box p {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

.btn-action {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    width: 100%;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: 0.2s;
}

/* --- Portal de Convocatorias Único --- */
.portal-section {
    margin-top: 40px;
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 25px;
}

.portal-header h2 {
    font-size: 1.8rem;
    color: var(--primary);
    margin: 0;
}

.filter-bar {
    display: flex;
    gap: 15px;
}

.filter-select {
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--text);
    outline: none;
    cursor: pointer;
}

.filter-select:focus {
    border-color: var(--secondary);
}

.convocatorias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 40px; /* Incrementado para mayor claridad */
    align-items: start;
}

/* --- Tarjetas Estilo Sistema Oficial --- */
.adp-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-top: 6px solid #489380;
    border-radius: 0;
    padding: 24px;
    display: flex;
    flex-direction: column;
    min-height: 450px; /* Asegura altura mínima sin solapar */
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.animate-in {
    animation: fadeIn 0.5s ease backwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.adp-card-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 15px;
}

.adp-card-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #000;
    line-height: 1.2;
    margin: 0 0 10px 0;
}

.adp-card-header .inst {
    font-size: 1.1rem;
    color: #333;
    margin: 0;
}

.adp-card-body {
    flex-grow: 1;
}

.adp-card-body p {
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.4;
}

.adp-card-body .min { margin-top: 15px; }

.cierre-box {
    margin-top: 20px;
    font-size: 0.95rem;
}

.cierre-box .label {
    display: block;
    font-weight: 700;
    color: #333;
}

.btn-postular {
    display: inline-block;
    align-self: center; /* Centrado en el contenedor flex */
    width: 80%; /* Ancho proporcional para que no toque los bordes */
    margin-top: auto;
    padding: 12px;
    background: #fff;
    color: #333;
    text-decoration: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-weight: 400;
    text-align: center;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.btn-postular:hover {
    background: #f8f9fa;
    border-color: #999;
}

/* Footer Estilo Institucional */
footer {
    background: #003366 !important; /* Forzado azul institucional */
    color: white !important;
    padding: 60px 0 30px;
    margin-top: 60px;
    clear: both;
}

footer h4 {
    color: white !important;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 25px;
    text-transform: uppercase;
}

footer ul {
    list-style: none;
    padding: 0;
}

footer ul li {
    margin-bottom: 12px;
}

footer ul li a {
    color: rgba(255,255,255,0.7) !important;
    text-decoration: none;
    font-size: 0.95rem;
    transition: 0.2s;
}

footer ul li a:hover {
    color: white !important;
    padding-left: 5px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 60px;
}

.footer-col h4 {
    border-bottom: 2px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

/* Estilos Footer Redes Sociales */
.redes-footer {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.redes-footer a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.redes-footer a:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

.final-bar {
    background: #0b2239;
    padding: 20px 0;
    width: 100%;
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
}

.final-bar .container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin: 0 auto;
}

.final-bar a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: color 0.2s;
}

.final-bar a:hover {
    color: white;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

footer {
    margin-top: auto; /* Empuja el footer hacia abajo si hay poco contenido */
    background: var(--primary);
    color: white;
    padding: 60px 0 40px;
}

.footer-bottom a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-bottom a:hover {
    color: white;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul li a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-col ul li a:hover {
    color: white;
}

/* --- Responsividad --- */

/* Tabletas y pantallas medianas (menos de 992px) */
@media (max-width: 992px) {
    .hero-grid, .card-stats, .action-grid, .footer-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-image {
        max-width: 500px;
        margin: 0 auto;
    }
    
    .main-panel {
        padding: 30px;
    }
}

/* Dispositivos móviles (menos de 768px) */
@media (max-width: 768px) {
    header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .nav-title {
        flex-direction: column;
        gap: 8px;
    }

    .nav-title img {
        height: 35px;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 5px;
    }

    .contact-link {
        padding: 0 10px;
        font-size: 0.85rem;
        height: 30px;
        border-right: 1px solid var(--border);
    }

    .contact-link:last-child {
        border-right: none;
    }

    .container {
        margin: 20px auto;
        padding: 0 15px;
    }

    .main-panel {
        padding: 20px;
    }

    .hero-content h1 {
        font-size: 1.75rem;
        margin-bottom: 15px;
    }

    .hero-content p {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .portal-section {
        padding: 20px;
        margin-top: 25px;
    }

    .portal-header {
        margin-bottom: 25px;
        padding-bottom: 15px;
    }

    .portal-header h2 {
        font-size: 1.5rem;
    }

    .convocatorias-grid {
        gap: 20px;
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
    }

    .adp-card {
        min-height: auto; /* Dejar que se auto-ajuste según contenido */
        padding: 20px;
    }

    .btn-postular {
        width: 100%;
    }

    .footer-grid {
        gap: 30px;
    }

    footer {
        padding: 40px 0 20px;
        text-align: center;
    }

    .redes-footer {
        justify-content: center;
    }
}

/* Pantallas muy pequeñas (menos de 576px) */
@media (max-width: 576px) {
    .final-bar .container {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}
