/* ============================================================
   Tutorial guiado del sitio público
   Motor: public/js/tutorial.js · Pasos: public/js/tutorial-<pagina>.js

   Todo va prefijado con .tut-* para no chocar con el sitio.
   Colores de FEDINOR: #99b715 como fondo lleva texto oscuro;
   como texto o borde sobre blanco, el verde oscuro #4f700f.
   ============================================================ */

.tut-capa,
.tut-foco,
.tut-globo,
.tut-globo *,
.tut-globo *::before,
.tut-globo *::after { box-sizing: border-box; }

/* Capa que tapa la página (recibe los clics) con la sombra en SVG:
   el hueco del elemento resaltado lo dibuja tutorial.js. */
.tut-capa {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
}

.tut-sombra {
    display: block;
    width: 100%;
    height: 100%;
    fill: rgba(16, 22, 12, .62);
}

/* Anillo verde alrededor del elemento resaltado. */
.tut-foco {
    position: fixed;
    z-index: 2147483001;
    border-radius: 14px;
    pointer-events: none;
    box-shadow: 0 0 0 4px #99b715, 0 0 0 9px rgba(153, 183, 21, .28);
}

.tut-foco[hidden] { display: none; }

/* ===== GLOBO ===== */
.tut-globo {
    position: fixed;
    z-index: 2147483002;
    width: min(360px, calc(100vw - 32px));
    padding: 16px 20px 16px;
    border-radius: 16px;
    background: #fff;
    color: #1a1f23;
    box-shadow: 0 16px 48px rgba(16, 22, 12, .30);
    font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    text-align: left;
    outline: none;
}

.tut-globo.tut-entra { animation: tut-entra .22s ease; }

@keyframes tut-entra {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tut-globo-centro {
    left: 50%;
    top: 50%;
    width: min(420px, calc(100vw - 32px));
    transform: translate(-50%, -50%);
}

/* En el celular el globo va pegado abajo, como una hoja. */
.tut-globo-hoja {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-radius: 18px 18px 0 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

/* ===== FLECHA (apunta al elemento resaltado) ===== */
.tut-flecha {
    position: absolute;
    display: none;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    background: #fff;
    transform: rotate(45deg);
}

.tut-globo[data-lado="abajo"] .tut-flecha { display: block; top: 0; }
.tut-globo[data-lado="arriba"] .tut-flecha { display: block; top: 100%; }
.tut-globo[data-lado="derecha"] .tut-flecha { display: block; left: 0; }
.tut-globo[data-lado="izquierda"] .tut-flecha { display: block; left: 100%; }

/* ===== CONTENIDO ===== */
.tut-cabeza {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tut-etiqueta {
    margin: 0;
    padding: 3px 10px;
    border-radius: 999px;
    background: #f4f8e6;
    color: #4f700f;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .02em;
}

.tut-salir {
    min-height: 36px;
    padding: 4px 8px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: #4f5a65;
    font: inherit;
    font-size: .88rem;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.tut-salir:hover { color: #1a1f23; }

.tut-barra {
    height: 4px;
    margin: 12px 0 4px;
    border-radius: 999px;
    background: #eef2e3;
    overflow: hidden;
}

.tut-barra-relleno {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: #99b715;
    transition: width .25s ease;
}

.tut-titulo {
    margin: 10px 0 6px;
    color: #1a1f23;
    font-family: inherit;
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.3;
}

.tut-texto p {
    margin: 0 0 8px;
    color: #4f5a65;
    font-size: .95rem;
}

.tut-pie {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.tut-contador {
    margin: 0;
    color: #4f5a65;
    font-size: .85rem;
}

.tut-botones { display: flex; gap: 8px; }

.tut-btn {
    min-height: 44px;
    padding: 8px 18px;
    border-radius: 999px;
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease;
}

.tut-btn-primario {
    border: 0;
    background: #99b715;
    color: #1a1f23;
}

.tut-btn-primario:hover { background: #8aa513; }

.tut-btn-secundario {
    border: 1.5px solid #679114;
    background: #fff;
    color: #4f700f;
}

.tut-btn-secundario:hover { background: #f4f8e6; }

.tut-btn:disabled {
    opacity: .4;
    cursor: default;
}

.tut-globo button:focus-visible {
    outline: 3px solid #1a1f23;
    outline-offset: 2px;
}

/* ===== BOTONES QUE ABREN EL TUTORIAL (en la página) ===== */
.tut-disparador {
    gap: 8px;
    background: none;
    font-family: inherit;
    line-height: inherit;
    cursor: pointer;
}

.tut-disparador::before {
    content: "?";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #99b715;
    color: #1a1f23;
    font-size: .8rem;
    font-weight: 700;
    line-height: 1;
}

.tut-enlace {
    display: inline-block;
    margin-top: 4px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: #4f700f;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

/* Punto que late mientras la persona no ha visto el tutorial. */
.tut-nuevo::after {
    content: "";
    width: 8px;
    height: 8px;
    margin-left: 2px;
    border-radius: 50%;
    background: #e8590c;
    animation: tut-late 1.6s ease-in-out infinite;
}

.tut-enlace.tut-nuevo::after { display: inline-block; margin-left: 8px; vertical-align: middle; }

@keyframes tut-late {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: .55; }
}

@media (max-width: 639px) {
    .tut-pie { flex-wrap: wrap; }
    .tut-botones { flex: 1 1 auto; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
    .tut-barra-relleno,
    .tut-btn { transition: none; }
    .tut-globo.tut-entra,
    .tut-nuevo::after { animation: none; }
}

@media print {
    .tut-capa,
    .tut-foco,
    .tut-globo { display: none !important; }
}
