/* === Variables de diseño === */
:root {
    --primario:       #3b82f6;
    --primario-dark:  #2563eb;
    --fondo:          #f1f5f9;
    --tarjeta:        #ffffff;
    --borde:          #e2e8f0;
    --texto:          #1e293b;
    --texto-suave:    #64748b;
    --exito:          #16a34a;
    --peligro:        #dc2626;
    --radio:          8px;
    --sombra:         0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --fuente:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

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

/* === Body === */
body {
    font-family: var(--fuente);
    background-color: var(--fondo);
    color: var(--texto);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================================
   Header y navegación
   ============================================================ */
header {
    background: linear-gradient(90deg, #1e3a8a 0%, #3b82f6 100%);
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.35);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    padding: 10px 24px;
    align-items: center;
}

nav ul li a {
    display: block;
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.18s, color 0.18s;
}

nav ul li a:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

#aLogout a {
    color: #fca5a5;
}

#aLogout a:hover {
    background-color: rgba(239, 68, 68, 0.25);
    color: #fecaca;
}

/* ============================================================
   Contenido principal
   ============================================================ */
main {
    max-width: 900px;
    margin: 32px auto;
    padding: 0 20px;
}

main > h1 {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: 24px;
}

/* ============================================================
   Secciones 
   ============================================================ */
section {
    background-color: var(--tarjeta);
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    padding: 28px 32px;
    margin-bottom: 20px;
}

section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primario);
}

/* Los <br> del HTML se ocultan; el espaciado lo controla CSS */
section br {
    display: none;
}

/* ============================================================
   Etiquetas de formulario
   ============================================================ */
label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--texto-suave);
    margin-top: 16px;
    margin-bottom: 5px;
}

/* ============================================================
   Inputs y selects
   ============================================================ */
input,
select {
    display: block;
    width: 100%;
    max-width: 420px;
    padding: 9px 12px;
    border: 1px solid var(--borde);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: var(--fuente);
    color: var(--texto);
    background-color: #ffffff;
    transition: border-color 0.18s, box-shadow 0.18s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primario);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ============================================================
   Botones principales
   ============================================================ */
button {
    margin-top: 20px;
    padding: 9px 22px;
    background-color: var(--primario);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: var(--fuente);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.35);
    transition: background-color 0.18s, transform 0.1s;
}

button:hover:not(:disabled) {
    background-color: var(--primario-dark);
}

button:active {
    transform: scale(0.97);
}

button:disabled {
    background-color: #94a3b8;
    color: #e2e8f0;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: 0.65;
}

/* === Botones dentro de tablas === */
.botonesPostularse,
.botonesAprobar /*,
.botonesRechazar */{
    margin-top: 0;
    padding: 4px 12px;
    font-size: 0.82rem;
    box-shadow: none;
}

.botonesPostularse                { background-color: var(--primario); }
.botonesPostularse:hover          { background-color: var(--primario-dark); }

.botonesAprobar                   { background-color: var(--exito); }
.botonesAprobar:hover             { background-color: #15803d; }

/*.botonesRechazar                  { background-color: var(--peligro); }
.botonesRechazar:hover            { background-color: #b91c1c; } */

/* ============================================================
   Mensajes de feedback
   ============================================================ */
#pIngreso,
#pRegistro,
#msgOfertas,
#msgOfertasDes {
    margin-top: 14px;
    padding: 9px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    background-color: #eff6ff;
    color: var(--primario-dark);
    border: 1px solid #bfdbfe;
}

/* #pIngreso solo muestra "Datos incorrectos" — siempre es error */
#pIngreso {
    background-color: #fef2f2;
    color: var(--peligro);
    border-color: #fecaca;
}

/* Clases asignadas desde logica.js para colorear mensajes dinámicos */
.msg-exito {
    background-color: #f0fdf4 !important;
    color: var(--exito) !important;
    border-color: #bbf7d0 !important;
}

.msg-error {
    background-color: #fef2f2 !important;
    color: var(--peligro) !important;
    border-color: #fecaca !important;
}

#pIngreso:empty,
#pRegistro:empty,
#msgOfertas:empty,
#msgOfertasDes:empty {
    display: none;
}

/* ============================================================
   Tablas (ofertas, postulaciones, procesar)
   ============================================================ */
#divOfertas,
#divOfertasDes,
#divPostulaciones,
#divProcesar {
    margin-top: 14px;
    border: 1px solid var(--borde);
    border-radius: 6px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--texto-suave);
    background-color: #f8fafc;
    border-bottom: 2px solid var(--borde);
}

tbody tr {
    border-bottom: 1px solid var(--borde);
    transition: background-color 0.12s;
}

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

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

tbody td {
    padding: 10px 14px;
    vertical-align: middle;
}

/* ============================================================
   Filtro de búsqueda en sección Ofertas (label + select inline)
   ============================================================ */
#sectionOfertas > label {
    display: inline;
    text-transform: none;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--texto);
    margin-top: 0;
    margin-right: 8px;
}

#slcAreaOfe {
    display: inline-block;
    width: auto;
    max-width: none;
    margin-top: 0;
    vertical-align: middle;
}

/* ============================================================
   Sección Estadísticas — bloques de resumen (h3 + resultado)
   ============================================================ */
#sectionEstadisticas hr {
    border: none;
    border-top: 1px solid var(--borde);
    margin: 24px 0;
}

/* Cada bloque "rótulo + resultado" como tarjeta */
#sectionEstadisticas div:has(> h3) {
    background-color: #f8fafc;
    border: 1px solid var(--borde);
    border-left: 4px solid var(--primario);
    border-radius: var(--radio);
    padding: 14px 18px;
    margin-bottom: 14px;
}

#sectionEstadisticas div:has(> h3):last-child {
    margin-bottom: 0;
}

/* h3 como rótulo: pequeño, en mayúsculas y atenuado */
#sectionEstadisticas h3 {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--texto-suave);
    margin-bottom: 6px;
}

/* Párrafo de resultado: grande y destacado */
#sectionEstadisticas h3 + p {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--primario-dark);
}

/* Marcador de posición mientras no hay valor calculado */
#sectionEstadisticas h3 + p:empty::before {
    content: "—";
    color: var(--texto-suave);
}
