/* ============================================================
   ESE URDAIBAI — CSS Global
   Incluir en include_top.php:
   <link rel="stylesheet" href="ese_urdaibai.css">
   ============================================================ */

/* --- Google Font ------------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

/* --- Variables de marca ------------------------------------ */
:root {
    --ese-azul:          #009DC4;
    --ese-azul-oscuro:   #007a99;
    --ese-azul-suave:    #e6f6fa;
    --ese-texto:         #1a2535;
    --ese-texto-suave:   #5a6a7a;
    --ese-borde:         #dde6ec;
    --ese-fondo:         #f5f8fa;
    --ese-blanco:        #ffffff;
    --ese-verde:         #1aab5f;
    --ese-radio:         12px;
    --ese-sombra:        0 2px 12px rgba(0,157,196,0.10);
    --ese-sombra-hover:  0 6px 24px rgba(0,157,196,0.20);
    --ese-font:          'Nunito', 'Segoe UI', sans-serif;
}

/* --- Base --------------------------------------------- */
body {
    font-family: var(--ese-font) !important;
    background: linear-gradient(180deg, #ffffff 0%, var(--ese-azul-suave) 100%) !important;    color: var(--ese-texto);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ============================================================
   HEADER GLOBAL (include_top.php)
   ============================================================ */

/* Tabla wrapper del header */
body > table:first-of-type {
    max-width: 560px !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding: 10px 16px 0 !important;
}

body > table:first-of-type img {
    max-height: 56px;
    width: auto;
}

/* Botón ir arriba */
.ir-arriba {
    display: none;
    position: fixed;
    bottom: 22px;
    right: 18px;
    background: var(--ese-azul);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,157,196,0.40);
    z-index: 999;
    transition: background 0.18s, transform 0.18s;
}

.ir-arriba:hover {
    background: var(--ese-azul-oscuro);
    transform: translateY(-2px);
}

/* ============================================================
   BOTÓN ATRÁS
   print_backButton() genera:
     <table class="table-boton-atras">
       <tr><td>
         <a class="texto_principal smaller boton_atras">← Atrás</a>
       </td></tr>
     </table>
   ============================================================ */

table.table-boton-atras {
    display: block !important;
    width: 100% !important;
    max-width: 560px !important;
    margin: 12px auto 0 !important;
    padding: 0 16px !important;
    border: none !important;
    background: transparent !important;
}

table.table-boton-atras tr,
table.table-boton-atras td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

a.boton_atras {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 8px 18px !important;
    background: var(--ese-blanco) !important;
    color: var(--ese-azul) !important;
    border: 2px solid var(--ese-azul) !important;
    border-radius: 30px !important;
    font-family: var(--ese-font) !important;
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s !important;
    line-height: 1 !important;
    letter-spacing: 0.1px !important;
}

a.boton_atras:hover {
    background: var(--ese-azul) !important;
    color: var(--ese-blanco) !important;
    box-shadow: 0 4px 14px rgba(0,157,196,0.30) !important;
}

/* ============================================================
   FOOTER (include_bottom.php)
   ============================================================ */
.ese-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 32px 16px 40px;  /* AUMENTADO: arriba 32px, abajo 40px */
    font-size: 0.8rem;
    color: var(--ese-texto-suave);
    font-family: var(--ese-font);
    border-top: 1px solid var(--ese-borde);
    margin-top: 30px;  /* Separación del contenido anterior */
}

.ese-footer img {
    max-height: 26px;
    width: auto;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.ese-footer img:hover {
    opacity: 1;
}

/* Ajuste para la última tarjeta */
.ese-card:last-of-type {
    margin-bottom: 10px;
}
/* ============================================================
   CONTENEDOR PÁGINA
   ============================================================ */
.ese-page {
    max-width: 520px;
    margin: 0 auto;
    padding: 0 16px 56px;
}

/* ============================================================
   TÍTULO DE PÁGINA
   ============================================================ */
.ese-titulo-pagina {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--ese-texto);
    text-align: center;
    margin: 28px 0 22px;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

/* ============================================================
   SELECTOR DE AÑO
   ============================================================ */
.ese-year-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 26px;
}

.ese-year-tab a {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ese-azul);
    background: var(--ese-blanco);
    border: 2px solid var(--ese-azul);
    text-decoration: none;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.ese-year-tab a:hover,
.ese-year-tab a.active {
    background: var(--ese-azul);
    color: var(--ese-blanco);
    box-shadow: 0 2px 10px rgba(0,157,196,0.28);
}

/* ============================================================
   CARD REFERENCIA
   ============================================================ */
.ese-card {
    background: var(--ese-blanco);
    border-radius: var(--ese-radio);
    box-shadow: var(--ese-sombra);
    margin-bottom: 14px;
    overflow: hidden;
    position: relative;
    transition: box-shadow 0.22s, transform 0.18s;
    border: 1px solid var(--ese-borde);
    animation: ese-fadein 0.28s ease both;
}

.ese-card:hover {
    box-shadow: var(--ese-sombra-hover);
    transform: translateY(-2px);
}

/* Barra de acento superior */
.ese-card::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, var(--ese-azul), #00c6ee);
}

.ese-card a.ese-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 16px 18px 14px;
}

/* --- Badge NUEVO ------------------------------------------ */
.ese-badge-nuevo {
    position: absolute;
    top: 16px;
    right: 14px;
    background: var(--ese-azul);
    color: #fff;
    font-size: 0.70rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0,157,196,0.35);
    animation: ese-pulse 2.2s infinite;
}

@keyframes ese-pulse {
    0%, 100% { box-shadow: 0 2px 6px rgba(0,157,196,0.35); }
    50%       { box-shadow: 0 2px 16px rgba(0,157,196,0.65); }
}

/* --- Header card ------------------------------------------ */
.ese-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-right: 0;
}

/* Cuando hay badge NUEVO reservamos espacio a la derecha */
.ese-card--has-badge .ese-card-header {
    padding-right: 64px;
}

.ese-nombre-contacto {
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--ese-texto);
    margin: 0 0 4px;
    line-height: 1.2;
}

.ese-nombre-contacto.no-visto { color: var(--ese-azul); }

.ese-referente {
    font-size: 0.83rem;
    color: var(--ese-texto-suave);
    margin: 0;
    font-weight: 600;
}

.ese-referente.no-visto {
    color: var(--ese-azul);
    font-weight: 700;
}

.ese-fecha-card {
    font-size: 0.78rem;
    color: var(--ese-texto-suave);
    white-space: nowrap;
    margin-top: 3px;
    font-weight: 600;
}

.ese-fecha-card.no-visto {
    color: var(--ese-azul);
    font-weight: 700;
}

/* --- Separador -------------------------------------------- */
.ese-card-divider {
    height: 1px;
    background: var(--ese-borde);
    margin: 0 0 12px;
}

/* --- Filas de datos --------------------------------------- */
.ese-dato-fila {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.87rem;
}

.ese-dato-fila + .ese-dato-fila {
    border-top: 1px solid var(--ese-fondo);
}

.ese-dato-etiqueta {
    color: var(--ese-texto-suave);
    font-weight: 600;
    font-size: 0.83rem;
    min-width: 90px;
}

.ese-dato-valor {
    color: var(--ese-texto);
    font-weight: 700;
    text-align: right;
}

.ese-dato-valor.no-visto { color: var(--ese-azul); }

.ese-sin-valorar {
    color: var(--ese-texto-suave);
    font-style: italic;
    font-weight: 500;
}

.ese-gnc-completado {
    color: var(--ese-verde);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ese-gnc-pendiente {
    color: var(--ese-texto-suave);
    font-style: italic;
    font-weight: 500;
}

.ese-gnc-fecha {
    font-size: 0.77rem;
    font-weight: 500;
    color: var(--ese-texto-suave);
}

.ese-gnc-fecha.no-visto {
    color: var(--ese-azul);
    font-weight: 700;
}

/* --- Footer card ------------------------------------------ */
.ese-card-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--ese-borde);
    text-align: center;
}

.ese-ver-detalles {
    font-size: 0.83rem;
    font-weight: 700;
    color: var(--ese-azul);
    letter-spacing: 0.2px;
}

.ese-ver-detalles::after { content: ' →'; }

/* --- Estado vacío ----------------------------------------- */
.ese-vacio {
    text-align: center;
    padding: 48px 24px;
    background: var(--ese-blanco);
    border-radius: var(--ese-radio);
    border: 2px dashed var(--ese-borde);
    color: var(--ese-texto-suave);
    font-size: 0.92rem;
    font-weight: 600;
}

/* --- Animación entrada ------------------------------------ */
@keyframes ese-fadein {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ese-card:nth-child(1)  { animation-delay: 0.03s; }
.ese-card:nth-child(2)  { animation-delay: 0.08s; }
.ese-card:nth-child(3)  { animation-delay: 0.13s; }
.ese-card:nth-child(4)  { animation-delay: 0.18s; }
.ese-card:nth-child(5)  { animation-delay: 0.23s; }
.ese-card:nth-child(6)  { animation-delay: 0.28s; }
.ese-card:nth-child(7)  { animation-delay: 0.33s; }
.ese-card:nth-child(8)  { animation-delay: 0.38s; }
.ese-card:nth-child(9)  { animation-delay: 0.43s; }
.ese-card:nth-child(10) { animation-delay: 0.48s; }

/* ============================================================
   SECCIÓN TÍTULO (h2 dentro de página)
   ============================================================ */
.ese-subtitulo {
    text-align: center;
    font-size: 0.90rem;
    color: var(--ese-texto-suave);
    margin: -14px 0 22px;
    font-weight: 600;
}

.ese-seccion-titulo {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--ese-azul);
    margin: 28px 0 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--ese-azul-suave);
    letter-spacing: -0.2px;
}

/* ============================================================
   CARD SIMPLE (sin acento superior, sin hover fuerte)
   ============================================================ */
.ese-card--simple {
    padding: 14px 16px;
    animation: none;
}

.ese-card--simple::before {
    display: none;
}

/* ============================================================
   LINK WRAP (card entera clickable desde fuera)
   ============================================================ */
a.ese-card-link-wrap {
    display: block;
    text-decoration: none;
    color: inherit;
    margin-bottom: 14px;
}

a.ese-card-link-wrap .ese-card {
    margin-bottom: 0;
    transition: box-shadow 0.22s, transform 0.18s;
}

a.ese-card-link-wrap:hover .ese-card {
    box-shadow: var(--ese-sombra-hover);
    transform: translateY(-2px);
}

/* ============================================================
   BOLD helper
   ============================================================ */
.ese-bold { font-weight: 800 !important; }

/* ============================================================
   BOTÓN
   ============================================================ */
.ese-btn {
    display: inline-block;
    padding: 9px 20px;
    background: var(--ese-azul);
    color: var(--ese-blanco);
    border: none;
    border-radius: 30px;
    font-family: var(--ese-font);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.18s, box-shadow 0.18s;
    box-shadow: 0 2px 8px rgba(0,157,196,0.20);
    -webkit-appearance: none;
    appearance: none;
}

.ese-btn:hover {
    background: var(--ese-azul-oscuro);
    box-shadow: 0 4px 14px rgba(0,157,196,0.35);
}

.ese-btn--full {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

.ese-btn-icon {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    color: var(--ese-azul);
    border: 2px solid var(--ese-azul);
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.18s;
}

.ese-btn-icon:hover {
    background: var(--ese-azul-suave);
}

/* ============================================================
   INPUTS
   ============================================================ */
.ese-input {
    padding: 8px 12px;
    border: 1.5px solid var(--ese-borde);
    border-radius: 8px;
    font-family: var(--ese-font);
    font-size: 0.88rem;
    color: var(--ese-texto);
    background: var(--ese-blanco);
    outline: none;
    transition: border-color 0.18s;
}

.ese-input:focus {
    border-color: var(--ese-azul);
}

.ese-input--full {
    width: 100%;
    box-sizing: border-box;
}

.ese-input--fecha { width: 44px; text-align: center; }
.ese-input--ano   { width: 62px; text-align: center; }
.ese-input--search { flex: 1; min-width: 0; }

.ese-fecha-sep {
    font-weight: 700;
    color: var(--ese-texto-suave);
    padding: 0 2px;
}

/* ============================================================
   FORM CARD (formularios centrados)
   ============================================================ */
.ese-form-card {
    background: var(--ese-blanco);
    border-radius: var(--ese-radio);
    border: 1px solid var(--ese-borde);
    box-shadow: var(--ese-sombra);
    padding: 24px 20px;
    margin-bottom: 20px;
}

.ese-campo {
    margin-bottom: 16px;
}

.ese-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ese-texto-suave);
    margin-bottom: 6px;
}

/* ============================================================
   AVISOS / ALERTAS
   ============================================================ */
.ese-aviso {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 14px;
}

.ese-aviso--ok {
    background: #e6f9f0;
    color: var(--ese-verde);
    border: 1px solid #b3ecd1;
}

.ese-aviso--error {
    background: #fdeaea;
    color: #c0392b;
    border: 1px solid #f5b7b7;
}

/* ============================================================
   FILTRO FECHAS (estadisticas)
   ============================================================ */
.ese-filtro-card {
    background: var(--ese-blanco);
    border-radius: var(--ese-radio);
    border: 1px solid var(--ese-borde);
    box-shadow: var(--ese-sombra);
    padding: 18px 20px;
    margin-bottom: 24px;
}

.ese-filtro-fila {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 10px;
}

.ese-filtro-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ese-texto-suave);
    min-width: 60px;
}

.ese-fecha-inputs {
    display: flex;
    align-items: center;
    gap: 2px;
}

.ese-filtro-accion {
    text-align: right;
    margin-top: 4px;
}



/* ============================================================
   BUSCADOR (asociados)
   ============================================================ */
.ese-buscador {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ese-buscador .ese-input--search {
    flex: 1 1 160px;
    min-width: 0;
}

.ese-buscador .ese-btn {
    flex-shrink: 0;
}

.ese-buscador .ese-btn-icon {
    flex-shrink: 0;
}

/* ============================================================
   TARJETAS DE ASOCIADOS - CORRECCIÓN
   ============================================================ */
.ese-card-link-wrap {
    display: block;
    text-decoration: none;
    color: inherit;
    margin-bottom: 16px;
    width: 100%;
}

.ese-card {
    width: 100%;
    box-sizing: border-box;
}

.ese-card-link {
    width: 100%;
    box-sizing: border-box;
}

/* Para el contenedor flex de cada tarjeta */
.ese-card-link > div {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: nowrap; /* Evita que se rompa */
}

/* Para la parte de información (nombre + empresa) */
.ese-card-link > div > div:nth-child(2) {
    flex: 1;
    min-width: 0; /* Permite que el texto se recorte con ellipsis si es necesario */
    white-space: normal;
    word-wrap: break-word;
}

/* Para el texto de acción (VER PERFIL →) */
.ese-card-link > div > div:last-child {
    flex-shrink: 0;
    white-space: nowrap; /* Evita que se rompa en múltiples líneas */
}

/* Si el nombre es muy largo, que no rompa el layout */
.ese-nombre-contacto {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* La empresa también con ellipsis si es muy larga */
.ese-referente {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   SELECTOR DE IDIOMA
   ============================================================ */
.ese-lang-selector {
    display: flex;
    gap: 12px;
    margin: 0;
    padding: 0;
}

.ese-lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    background: var(--ese-blanco);
    color: var(--ese-azul);
    border: 2px solid var(--ese-azul);
    border-radius: 40px;
    font-family: var(--ese-font);
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    min-width: 70px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.ese-lang-btn:hover {
    background: var(--ese-azul-suave);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,157,196,0.25);
}

.ese-lang-btn.ese-lang-active {
    background: var(--ese-azul);
    color: var(--ese-blanco);
    border-color: var(--ese-azul-oscuro);
    box-shadow: 0 4px 12px rgba(0,157,196,0.35);
}

/* ============================================================
   BOTÓN PDF ESPECÍFICO PARA ASOCIADOS
   ============================================================ */
.ese-btn-pdf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--ese-azul);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: var(--ese-font);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.18s, transform 0.18s;
    box-shadow: 0 2px 6px rgba(0,157,196,0.3);
}

.ese-btn-pdf:hover {
    background: var(--ese-azul-oscuro);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,157,196,0.4);
}

.ese-btn-pdf img, 
.ese-btn-pdf svg {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1); /* Si el icono es negro, lo vuelve blanco */
}
/* ============================================================
   BADGE PEQUEÑO EN ESQUINA
   ============================================================ */
.ese-badge-corner {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ff4d4d;
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 30px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    box-shadow: 0 3px 8px rgba(255,77,77,0.3);
    z-index: 2;
    line-height: 1.2;
}
/* ============================================================
   NIVEL DE INTERÉS (referencia.php)
   ============================================================ */
.ese-nivel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    border: 2px solid var(--ese-borde);
    background: var(--ese-blanco);
    color: var(--ese-texto-suave);
    transition: all 0.15s ease;
    user-select: none;
}

.ese-nivel-btn--active {
    border-color: var(--ese-azul);
    background: var(--ese-azul-suave);
    color: var(--ese-azul);
}