:root {
    --color-naranja: #fe9e03;
    --color-amarillo: #ffd600;
    --color-azul: #0faceb;
    --color-verde: #dadf2d;
    --bg-gradient-start: #0faceb;
    --bg-gradient-end: #007bb5;
    --white: #ffffff;
    --gray-light: #f4f6f8;
    --text-dark: #333;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #a2c6d4 0%, #4f91b0 100%);
    height: 100vh;
    overflow: hidden; /* IMPORTANTE: Evita scroll en la página principal */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.watermark {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('../images/logo_new.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

.main-container {
    z-index: 1;
    width: 100%;
    height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Tarjeta de altura completa */
.card-full {
    background-color: var(--white);
    width: 100%;
    max-width: 600px;
    height: 90vh; /* Altura fija para forzar el scroll interno */
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column; /* Organiza header, body, footer verticalmente */
    overflow: hidden;
}

/* --- SECCIÓN 1: HEADER FIJO --- */
.card-header-fixed {
    padding: 20px 30px 10px 30px;
    border-bottom: 2px solid #eee;
    background-color: var(--white);
    flex-shrink: 0; /* No se encoge */
}

.card-header-fixed h2 {
    color: var(--color-azul);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.search-bar input {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    outline: none;
}
.search-bar input:focus { border-color: var(--color-azul); }

.btn-search {
    background-color: var(--color-azul);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}
.btn-clean {
    background-color: #eee;
    color: #555;
    border: none;
    padding: 0 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
}

/* Falsa cabecera de tabla para alineación */
.table-header-row {
    display: flex;
    font-weight: bold;
    color: #666;
    padding: 10px;
    background-color: var(--gray-light);
    border-radius: 6px;
}
.col-cedula { flex: 1; }
.col-estado { width: 150px; text-align: center; }

/* --- SECCIÓN 2: BODY CON SCROLL --- */
.card-body-scroll {
    flex-grow: 1; /* Ocupa todo el espacio disponible */
    overflow-y: auto; /* Aquí ocurre la magia del scroll */
    padding: 0 30px;
}

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

.data-table tr {
    border-bottom: 1px solid #eee;
}

.data-table td {
    padding: 12px 10px;
}

.data-table td:first-child { font-family: monospace; font-size: 1.1rem; color: #444; }
.data-table td:last-child { text-align: center; width: 150px; }

/* Estilos de Estados */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    display: inline-block;
}

.badge-habil {
    background-color: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

/* Estado Inhábil: Naranja distintivo */
.badge-inhabil {
    background-color: rgba(254, 158, 3, 0.15);
    color: #d35400; /* Naranja oscuro para texto */
    border: 1px solid var(--color-naranja);
}

.state-msg {
    text-align: center;
    padding: 30px;
    color: #888;
    font-style: italic;
}

/* --- SECCIÓN 3: FOOTER FIJO --- */
.card-footer-fixed {
    padding: 15px 30px;
    border-top: 1px solid #eee;
    background-color: var(--gray-light);
    flex-shrink: 0;
    text-align: center;
}

.pagination-controls button {
    padding: 8px 16px;
    border: 1px solid #ccc;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    margin: 0 5px;
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-controls button:hover:not(:disabled) {
    background-color: var(--color-azul);
    color: white;
    border-color: var(--color-azul);
}

#page-indicator {
    font-weight: bold;
    color: var(--color-azul);
    margin: 0 10px;
}

#txt-buscar, #modal-cedula, #modal-codigo {
    text-align: center;
}

.data-table tbody tr:nth-child(even) {
    background-color: #f8f9fa; /* Un gris casi blanco para mantener la sobriedad */
}

.data-table tbody tr:hover {
    background-color: rgba(15, 172, 235, 0.1); /* Un toque muy sutil del azul corporativo */
    cursor: default;
    transition: background-color 0.2s ease;
}

/* --- ESTILOS NUEVOS PARA MODAL Y BOTÓN --- */

/* Botón Postularme en el Header */
.btn-postular {
    background-color: #27ae60; /* Verde éxito */
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    margin-left: 10px;
    transition: background 0.3s;
    white-space: nowrap;
}
.btn-postular:hover { background-color: #219150; }

/* Overlay (Fondo oscuro) */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Fondo semitransparente */
    z-index: 1000; /* Por encima de todo */
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px); /* Efecto borroso bonito */
}

/* Caja de la Modal */
.modal-box {
    background-color: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    padding: 30px;
    position: relative;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-modal {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}
.close-modal:hover { color: #333; }

.modal-header h3 { color: #0faceb; margin-bottom: 5px; }
.modal-header p { color: #666; font-size: 0.9rem; margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 10px; }

.input-row { display: flex; gap: 10px; margin-bottom: 5px; }
.input-row input { flex: 1; padding: 10px; border: 1px solid #ccc; border-radius: 6px; }

/* Botones Modal */
.btn-primary-modal {
    background-color: #fe9e03; color: white; border: none; padding: 0 15px;
    border-radius: 6px; cursor: pointer; font-weight: bold; min-width: 120px;
}
.btn-primary-modal:disabled { background-color: #ccc; cursor: not-allowed; }

.btn-success-modal {
    width: 100%; 
    padding: 12px; 
    background-color: #0faceb; 
    color: white;
    border: none; 
    border-radius: 6px; 
    font-weight: bold; 
    cursor: pointer;
    font-size: 1rem;
}
.btn-success-modal:hover:not(:disabled) { background-color: #0d9bd4; }
.btn-success-modal:disabled { background-color: #ccc; cursor: not-allowed; }

/* Estados visuales */
.step-container { margin-top: 20px; padding-top: 20px; border-top: 1px dashed #eee; transition: opacity 0.3s; }
.disabled-step { opacity: 0.5; pointer-events: none; }
.active-step { opacity: 1; pointer-events: all; }

.msg-error { color: #ec1c24; font-size: 0.85rem; display: block; min-height: 20px; }
.msg-result { margin-top: 15px; padding: 10px; border-radius: 6px; text-align: center; font-weight: bold; font-size: 0.95rem; display: none; }
.msg-success-box { background-color: #d4efdf; color: #1e8449; border: 1px solid #a9dfbf; }
.msg-error-box { background-color: #fadbd8; color: #c0392b; border: 1px solid #e6b0aa; }

.btn-postular:disabled { background-color: #629d7b; cursor: not-allowed; }

/* --- RESPONSIVE: AJUSTES PARA CELULAR --- */
@media (max-width: 768px) {
    /* 1. Permitir que los elementos bajen si no caben */
    .search-bar {
        flex-wrap: wrap; 
    }

    /* 2. El botón "Postularme" ocupará toda la fila de abajo */
    .btn-postular {
        width: 100%;       /* Ancho completo */
        margin-left: 0;    /* Quitamos el margen izquierdo del escritorio */
        margin-top: 0px;  /* Agregamos espacio arriba para separarlo del buscador */
        order: 10;         /* Aseguramos que se vaya al final visualmente */
        text-align: center;
        height: 30px;
    }

    .btn-search {
        padding: 0 10px;
    }

    /* 3. Ajuste opcional para que el input no se vea aplastado */
    .search-bar input {
        min-width: 130px; /* Asegura un ancho mínimo legible */
    }
}