/* ==========================================================================
   MODAL DE ENCUESTAS INSTITUCIONALES — HREGB 2026
   Pop-up de invitación al llenado de las encuestas oficiales.
   Depende de los tokens de css/style2025.css (--primary, --radius-*, etc.)
   ========================================================================== */

.enc-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: var(--font-family-base, 'Inter', sans-serif);
}

.enc-overlay.is-open {
    display: flex;
}

.enc-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 27, 51, 0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: encFade 0.28s ease-out both;
}

.enc-modal {
    position: relative;
    width: 100%;
    max-width: 760px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    border-radius: calc(var(--radius-lg, 16px) + 4px);
    box-shadow: 0 30px 70px rgba(0, 27, 51, 0.35), 0 4px 12px rgba(0, 0, 0, 0.08);
    animation: encPopIn 0.36s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ---------- Cabecera ---------- */
.enc-header {
    position: relative;
    flex-shrink: 0;
    padding: 22px 30px 18px;
    background: linear-gradient(135deg, var(--primary-dark, #002d56) 0%, var(--primary, #0056ac) 55%, var(--primary-light, #0096cb) 100%);
    border-radius: calc(var(--radius-lg, 16px) + 4px) calc(var(--radius-lg, 16px) + 4px) 0 0;
    color: #fff;
    overflow: hidden;
}

/* Halo decorativo */
.enc-header::after {
    content: "";
    position: absolute;
    top: -70px;
    right: -50px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
}

.enc-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.enc-logo {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 12px;
    background: #fff;
    padding: 5px;
    object-fit: contain;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.enc-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-size: var(--font-size-2xs, 0.6875rem);
    font-weight: var(--font-weight-semibold, 600);
    letter-spacing: var(--tracking-wider, 0.05em);
    text-transform: uppercase;
}

.enc-eyebrow .enc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7dffb0;
    box-shadow: 0 0 0 0 rgba(125, 255, 176, 0.7);
    animation: encPulse 2s infinite;
}

.enc-title {
    margin: 0 0 8px;
    font-size: var(--font-size-2xl, 1.5rem);
    font-weight: var(--font-weight-extrabold, 800);
    line-height: var(--line-height-tight, 1.2);
    letter-spacing: var(--tracking-tight, -0.01em);
    color: #fff;
}

.enc-subtitle {
    margin: 0;
    max-width: 56ch;
    font-size: var(--font-size-md, 1rem);
    line-height: var(--line-height-relaxed, 1.65);
    color: rgba(255, 255, 255, 0.9);
}

.enc-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition-smooth, all 0.25s ease);
}

.enc-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.enc-close:focus-visible {
    outline: 3px solid var(--hegb-focus, #ffbf47);
    outline-offset: 2px;
}

/* ---------- Cuerpo (única zona desplazable) ---------- */
.enc-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px 30px;
}

.enc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-bottom: 16px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #dbe4ee;
}

.enc-meta-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: var(--font-size-sm, 0.8125rem);
    color: var(--text-secondary, #475569);
}

.enc-meta-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--primary, #0056ac);
}

.enc-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.enc-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 18px 18px 17px;
    border: 1.5px solid #e2e9f2;
    border-radius: var(--radius-lg, 16px);
    background: #fff;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: var(--transition-smooth, all 0.25s ease);
}

/* Franja superior de color por tipo de encuesta */
.enc-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--enc-accent, var(--primary, #0056ac));
}

.enc-card:hover,
.enc-card:focus-visible {
    transform: translateY(-4px);
    border-color: var(--enc-accent, var(--primary, #0056ac));
    box-shadow: var(--shadow-hover, 0 15px 35px rgba(0, 45, 86, 0.12));
    outline: none;
}

.enc-card--usuario { --enc-accent: #0056ac; --enc-soft: #eaf2fb; }
.enc-card--laboral { --enc-accent: #1a7a4a; --enc-soft: #e9f5ee; }

.enc-card-icon {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border-radius: 14px;
    background: var(--enc-soft, #eaf2fb);
    color: var(--enc-accent);
}

.enc-card-icon svg {
    width: 24px;
    height: 24px;
}

.enc-card-tag {
    display: inline-block;
    align-self: flex-start;
    margin-bottom: 8px;
    padding: 3px 9px;
    border-radius: 6px;
    background: var(--enc-soft, #eaf2fb);
    color: var(--enc-accent);
    font-size: var(--font-size-2xs, 0.6875rem);
    font-weight: var(--font-weight-bold, 700);
    letter-spacing: var(--tracking-wide, 0.025em);
    text-transform: uppercase;
}

.enc-card-title {
    margin: 0 0 8px;
    font-size: var(--font-size-lg, 1.125rem);
    font-weight: var(--font-weight-bold, 700);
    line-height: var(--line-height-snug, 1.35);
    color: var(--text-main, #1e293b);
}

.enc-card-desc {
    margin: 0 0 16px;
    font-size: var(--font-size-base, 0.875rem);
    line-height: var(--line-height-relaxed, 1.65);
    color: var(--text-secondary, #475569);
    flex-grow: 1;
}

.enc-card-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: var(--radius-sm, 8px);
    background: var(--enc-accent);
    color: #fff;
    font-size: var(--font-size-base, 0.875rem);
    font-weight: var(--font-weight-semibold, 600);
    transition: var(--transition-smooth, all 0.25s ease);
}

.enc-card:hover .enc-card-cta {
    filter: brightness(1.08);
}

.enc-card-cta svg {
    width: 15px;
    height: 15px;
    transition: transform 0.25s ease;
}

.enc-card:hover .enc-card-cta svg {
    transform: translateX(3px);
}

/* ---------- Pie ---------- */
.enc-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    padding: 16px 30px 22px;
    border-top: 1px solid #eef2f7;
    background: #f8fafc;
    border-radius: 0 0 calc(var(--radius-lg, 16px) + 4px) calc(var(--radius-lg, 16px) + 4px);
}

.enc-note {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--text-muted, #64748b);
}

.enc-note svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: var(--hegb-accent, #1a7a4a);
}

.enc-actions {
    display: flex;
    gap: 10px;
}

.enc-btn {
    padding: 9px 15px;
    border: 1px solid #d5dfea;
    border-radius: var(--radius-sm, 8px);
    background: #fff;
    color: var(--text-secondary, #475569);
    font-family: inherit;
    font-size: var(--font-size-sm, 0.8125rem);
    font-weight: var(--font-weight-medium, 500);
    cursor: pointer;
    transition: var(--transition-smooth, all 0.25s ease);
}

.enc-btn:hover {
    border-color: var(--primary, #0056ac);
    color: var(--primary, #0056ac);
    background: var(--primary-tint, rgba(0, 86, 172, 0.05));
}

.enc-btn:focus-visible {
    outline: 3px solid var(--hegb-focus, #ffbf47);
    outline-offset: 2px;
}

.enc-btn--ghost {
    border-color: transparent;
    background: transparent;
}

/* ---------- Botón flotante para reabrir ---------- */
.enc-fab {
    position: fixed;
    left: 25px;
    bottom: 25px;
    z-index: 99998;
    display: none;
    align-items: center;
    gap: 9px;
    padding: 11px 17px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary, #0056ac), var(--primary-light, #0096cb));
    color: #fff;
    font-family: var(--font-family-base, 'Inter', sans-serif);
    font-size: var(--font-size-sm, 0.8125rem);
    font-weight: var(--font-weight-semibold, 600);
    box-shadow: 0 10px 26px rgba(0, 45, 86, 0.28);
    cursor: pointer;
    transition: var(--transition-smooth, all 0.25s ease);
}

.enc-fab.is-visible {
    display: inline-flex;
    animation: encFabIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.enc-fab:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(0, 45, 86, 0.36);
}

.enc-fab:focus-visible {
    outline: 3px solid var(--hegb-focus, #ffbf47);
    outline-offset: 3px;
}

.enc-fab svg {
    width: 17px;
    height: 17px;
}

/* ==========================================================================
   TARJETAS DE ENCUESTA EN "ENLACES DE INTERÉS"
   Variante de .enlace-card-premium (css/style2025.css) con acento permanente
   para que las encuestas resalten dentro del directorio de servicios.
   ========================================================================== */

.enlace-card--encuesta {
    --enc-accent: #0056ac;
    --enc-soft: #eaf2fb;
    border-color: color-mix(in srgb, var(--enc-accent) 22%, #fff);
    background: linear-gradient(145deg, #ffffff 0%, var(--enc-soft) 100%);
}

.enlace-card--encuesta-usuario { --enc-accent: #0056ac; --enc-soft: #f2f7fd; }
.enlace-card--encuesta-laboral { --enc-accent: #1a7a4a; --enc-soft: #f1f9f4; }

/* Franja lateral siempre visible (en el resto de tarjetas solo aparece al pasar el cursor) */
.enlace-card--encuesta::before {
    background: var(--enc-accent);
    opacity: 1;
}

.enlace-card--encuesta:hover {
    border-color: var(--enc-accent);
    background: linear-gradient(145deg, #ffffff 0%, var(--enc-soft) 100%);
}

.enlace-card--encuesta .enlace-icon-badge {
    background: var(--enc-soft);
    border-color: color-mix(in srgb, var(--enc-accent) 18%, #fff);
}

.enlace-card--encuesta:hover .enlace-icon-badge {
    background: var(--enc-soft);
}

.enlace-card--encuesta .enlace-title,
.enlace-card--encuesta:hover .enlace-title {
    color: var(--enc-accent);
}

/* Marca "Abierta" al inicio de la descripción, con punto pulsante */
.enlace-card--encuesta .enlace-estado {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: 4px;
    color: var(--enc-accent);
    font-weight: var(--font-weight-bold, 700);
}

.enlace-card--encuesta .enlace-estado::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--enc-accent);
    animation: encPulseAccent 2s infinite;
}

@keyframes encPulseAccent {
    0%   { opacity: 1; }
    50%  { opacity: 0.35; }
    100% { opacity: 1; }
}

/* ---------- Animaciones ---------- */
@keyframes encFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes encPopIn {
    from { opacity: 0; transform: translateY(26px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

@keyframes encPulse {
    0%   { box-shadow: 0 0 0 0 rgba(125, 255, 176, 0.65); }
    70%  { box-shadow: 0 0 0 9px rgba(125, 255, 176, 0); }
    100% { box-shadow: 0 0 0 0 rgba(125, 255, 176, 0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
    .enc-overlay { padding: 12px; align-items: flex-end; }
    .enc-modal { max-height: calc(100vh - 24px); }
    .enc-header { padding: 22px 20px 18px; }
    .enc-title { font-size: var(--font-size-xl, 1.25rem); }
    .enc-subtitle { font-size: var(--font-size-base, 0.875rem); }
    .enc-body { padding: 20px 18px; }
    .enc-cards { grid-template-columns: 1fr; }
    .enc-footer { padding: 14px 18px 18px; justify-content: center; text-align: center; }
    .enc-note { justify-content: center; }
    .enc-actions { width: 100%; justify-content: center; }
    .enc-fab { left: 14px; bottom: 88px; padding: 10px 14px; }
}

/* ---------- Accesibilidad: movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
    .enc-backdrop,
    .enc-modal,
    .enc-fab.is-visible { animation: none; }
    .enc-eyebrow .enc-dot { animation: none; }
    .enc-card:hover,
    .enc-fab:hover { transform: none; }
    .enc-close:hover { transform: none; }
}
