/* ============================================================
   PWA "Agregar a inicio" — panel admin (doctora/admin/operador)
   Prefijo: adm-a2hs-  ·  Calco de public/css/portal.css (.pt-a2hs-*)
   Colores 100% tokens del design system (var(--primary), etc.) —
   Regla 9 de CLAUDE.md. Botón topbar: .topbar-a2hs-btn.

   Piezas:
     · .topbar-a2hs-btn      botón persistente en la topbar admin.
     · .adm-a2hs-coach       aviso one-time (server-side gate, ver
                              partials/admin-a2hs.blade.php). Convive con
                              Novedades (#annModal, z-index 100000): este
                              overlay se mantiene MUY por debajo.
     · .adm-a2hs-overlay/    modal guía device-aware con demo animada.
       .adm-a2hs-modal

   Visibilidad por CLASES (.is-open / .is-shown), NUNCA por [hidden] salvo
   el estado inicial del botón topbar (oculto hasta que el JS confirme que
   aplica). Animaciones solo transform/opacity + prefers-reduced-motion.
   ============================================================ */

/* ── Botón "Agregar a inicio" en la topbar admin ──────────────────
   Mismo patrón de tamaño/radio que .topbar-icon-btn / .topbar-search-icon
   (40×40, radius 10px), con acento teal en reposo para invitar la acción
   (coherente con .pt-topbar-a2hs del portal). Oculto por defecto hasta que
   admin-a2hs.js confirme que el dispositivo aplica. */
.topbar-a2hs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid transparent;
    background: var(--topbar-hover-bg, var(--primary-bg, rgba(25, 156, 130, .06)));
    color: var(--text-topbar, var(--primary-dark, #116d5b));
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .12s ease;
}
.topbar-a2hs-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.topbar-a2hs-btn:hover { background: var(--primary, #199c82); color: #fff; border-color: var(--primary, #199c82); transform: translateY(-1px); }
.topbar-a2hs-btn:active { transform: translateY(0); }
.topbar-a2hs-btn:focus-visible { outline: 2px solid var(--primary, #199c82); outline-offset: 2px; }
/* [hidden] debe ganarle a display:inline-flex. */
.topbar-a2hs-btn[hidden] { display: none !important; }

/* ── Coachmark one-time (server-side gate) ─────────────────────────
   Autocontenido (el admin no tiene el equivalente de .pt-notice-* del
   portal). z-index bien por debajo de .ann-modal (100000, Novedades) como
   defensa adicional al guard en JS que ya evita mostrarla si hay novedad
   pendiente. */
.adm-a2hs-coach {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, .45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.adm-a2hs-coach.is-shown { display: flex; animation: admA2hsOverlayIn .25s ease-out both; }
.adm-a2hs-coach.is-shown .adm-a2hs-coach__card { animation: admA2hsCardIn .35s cubic-bezier(.34, 1.56, .64, 1) both; }
.adm-a2hs-coach.is-closing { animation: admA2hsOverlayOut .22s ease-in both; pointer-events: none; }
.adm-a2hs-coach.is-closing .adm-a2hs-coach__card { animation: admA2hsCardOut .2s ease-in both; }

.adm-a2hs-coach__card {
    position: relative;
    width: min(400px, 100%);
    max-height: calc(100dvh - 2.5rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-card, #fff);
    border-radius: var(--radius-lg, 14px);
    padding: 1.75rem 1.5rem 1.4rem;
    text-align: center;
    box-shadow: var(--shadow-lg, 0 12px 32px rgba(0, 0, 0, .08));
}
.adm-a2hs-coach__ic {
    width: 56px;
    height: 56px;
    margin: 0 auto .9rem;
    border-radius: var(--radius-lg, 14px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary, #199c82);
    background: var(--primary-bg, rgba(25, 156, 130, .08));
}
.adm-a2hs-coach__ic svg { width: 26px; height: 26px; }
.adm-a2hs-coach__eyebrow {
    margin: 0 0 .3rem;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--primary, #199c82);
}
.adm-a2hs-coach__title {
    margin: 0 0 .55rem;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.3;
    color: var(--text-primary, #0f172a);
}
.adm-a2hs-coach__text {
    margin: 0 0 1.1rem;
    font-size: .86rem;
    line-height: 1.55;
    color: var(--text-secondary, #475569);
}
.adm-a2hs-coach__actions {
    display: flex;
    gap: .6rem;
}
.adm-a2hs-coach__btn {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .7rem 1rem;
    border-radius: var(--radius, 10px);
    font-size: .86rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: 1.5px solid transparent;
    white-space: nowrap;
    min-width: 0;
    transition: transform .15s ease, background-color .15s ease, color .15s ease;
}
.adm-a2hs-coach__btn--primary { color: #fff; background: var(--primary, #199c82); }
.adm-a2hs-coach__btn--primary:hover { background: var(--primary-dark, #116d5b); transform: translateY(-1px); }
.adm-a2hs-coach__btn--ghost { color: var(--text-secondary, #475569); background: var(--border-light, #f1f5f9); }
.adm-a2hs-coach__btn--ghost:hover { background: var(--border, #e2e8f0); }

@keyframes admA2hsOverlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes admA2hsOverlayOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes admA2hsCardIn { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes admA2hsCardOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(6px) scale(.97); } }

/* ── Demo animada del gesto (dentro del modal) ────────────────────
   Maqueta de teléfono/navegador con una secuencia en bucle (6s) que enseña
   el gesto por dispositivo. Solo transform/opacity. En prefers-reduced-motion
   se congela en el estado "abierto + resaltado". */
.adm-a2hs-demo { display: flex; justify-content: center; margin: .1rem 0 1.25rem; }
.adm-a2hs-phone {
    position: relative;
    width: 156px;
    height: 236px;
    border-radius: 26px;
    background: #0f172a;
    padding: 7px;
    box-shadow: 0 16px 30px -14px rgba(15, 23, 42, .5), inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.adm-a2hs-phone__scr {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(180deg, #f8fafc, #eef2f6);
    overflow: hidden;
}
.adm-a2hs-faux { padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.adm-a2hs-demo--android .adm-a2hs-faux { padding-top: 40px; }
.adm-a2hs-faux i { height: 9px; border-radius: 5px; background: #e2e8f0; display: block; }
.adm-a2hs-faux i.s { width: 60%; }
/* Botón "caliente" (compartir / menú / instalar): pulso de atención */
.adm-a2hs-hot { display: inline-flex; align-items: center; justify-content: center; color: var(--primary-dark, #116d5b); }
.adm-a2hs-hot svg { width: 18px; height: 18px; }
.adm-a2hs-hot--share, .adm-a2hs-hot--menu, .adm-a2hs-hot--install { animation: admA2hsHot 6s ease infinite; }
@keyframes admA2hsHot { 0%, 6% { transform: scale(1); } 10% { transform: scale(1.28); } 15%, 100% { transform: scale(1); } }
/* Barra inferior de Safari (iOS) */
.adm-a2hs-safari {
    position: absolute; left: 0; right: 0; bottom: 0; height: 32px;
    display: flex; align-items: center; justify-content: space-around;
    background: rgba(248, 250, 252, .94); border-top: 1px solid #e2e8f0;
}
.adm-a2hs-safari .d { width: 13px; height: 13px; border-radius: 50%; background: #cbd5e1; }
/* Barra superior (Android) */
.adm-a2hs-atop {
    position: absolute; top: 0; left: 0; right: 0; height: 30px;
    display: flex; align-items: center; gap: 6px; padding: 0 8px;
    background: #fff; border-bottom: 1px solid #e2e8f0;
}
.adm-a2hs-atop .u { flex: 1; height: 12px; border-radius: 6px; background: #eef2f6; }
/* Hoja de compartir (iOS) que sube */
.adm-a2hs-sheet {
    position: absolute; left: 6px; right: 6px; bottom: 36px;
    background: #fff; border-radius: 14px; padding: 6px;
    border: 1px solid #eef2f6; box-shadow: 0 8px 20px rgba(15, 23, 42, .18);
    transform: translateY(120%); opacity: 0;
    animation: admA2hsSheet 6s ease infinite;
}
@keyframes admA2hsSheet {
    0%, 26% { transform: translateY(120%); opacity: 0; }
    34%, 86% { transform: translateY(0); opacity: 1; }
    94%, 100% { transform: translateY(120%); opacity: 0; }
}
/* Menú desplegable (Android) */
.adm-a2hs-menu {
    position: absolute; top: 30px; right: 6px; width: 120px;
    background: #fff; border-radius: 10px; padding: 5px;
    border: 1px solid #eef2f6; box-shadow: 0 10px 22px rgba(15, 23, 42, .2);
    transform-origin: top right; transform: scale(.4); opacity: 0;
    animation: admA2hsPop 6s ease infinite;
}
@keyframes admA2hsPop {
    0%, 26% { transform: scale(.4); opacity: 0; }
    34%, 86% { transform: scale(1); opacity: 1; }
    94%, 100% { transform: scale(.4); opacity: 0; }
}
/* Filas de la hoja/menú */
.adm-a2hs-row {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    padding: 7px 8px; border-radius: 8px;
    font-size: 9.5px; font-weight: 700; color: #64748b;
}
.adm-a2hs-row svg { width: 13px; height: 13px; color: var(--primary-dark, #116d5b); flex: 0 0 auto; }
.adm-a2hs-row--target { color: var(--text-primary, #0f172a); animation: admA2hsTarget 6s ease infinite; }
@keyframes admA2hsTarget {
    0%, 50% { background: transparent; box-shadow: none; }
    56%, 84% { background: var(--primary-bg, rgba(25, 156, 130, .08)); box-shadow: inset 0 0 0 1.5px var(--primary, #199c82); }
    90%, 100% { background: transparent; box-shadow: none; }
}
/* Navegador de escritorio */
.adm-a2hs-browser {
    position: relative; width: 264px; height: 172px; border-radius: 12px;
    background: #fff; border: 1px solid #e2e8f0; overflow: hidden;
    box-shadow: 0 16px 30px -14px rgba(15, 23, 42, .4);
}
.adm-a2hs-browser__bar { height: 30px; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: #f1f5f9; border-bottom: 1px solid #e2e8f0; }
.adm-a2hs-browser__bar .dots { display: flex; gap: 4px; }
.adm-a2hs-browser__bar .dots i { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.adm-a2hs-omnibox { flex: 1; height: 18px; border-radius: 9px; background: #fff; border: 1px solid #e2e8f0; display: flex; align-items: center; padding: 0 6px; gap: 4px; }
.adm-a2hs-omnibox .lock { width: 7px; height: 7px; border-radius: 2px; background: #cbd5e1; margin-right: auto; }
.adm-a2hs-browser__body { position: relative; height: calc(100% - 30px); background: linear-gradient(180deg, #f8fafc, #eef2f6); }
.adm-a2hs-install-pop {
    position: absolute; top: 8px; right: 8px;
    background: #fff; border: 1px solid var(--primary-light, #e6f7f3); border-radius: 8px;
    padding: 6px 8px; font-size: 10px; font-weight: 800; color: var(--text-primary, #0f172a);
    display: flex; align-items: center; gap: 5px; box-shadow: 0 8px 18px rgba(15, 23, 42, .15);
    transform-origin: top right; transform: scale(.85); opacity: 0;
    animation: admA2hsPop 6s ease infinite;
}
.adm-a2hs-install-pop svg { width: 12px; height: 12px; color: var(--primary-dark, #116d5b); }
/* Pulsos de toque */
.adm-a2hs-tap {
    position: absolute; width: 26px; height: 26px; border-radius: 50%;
    background: radial-gradient(circle, rgba(25, 156, 130, .55), rgba(25, 156, 130, 0) 70%);
    transform: translate(-50%, -50%) scale(0); opacity: 0; pointer-events: none;
}
.adm-a2hs-tap--1 { animation: admA2hsTap1 6s ease infinite; }
.adm-a2hs-tap--2 { animation: admA2hsTap2 6s ease infinite; }
@keyframes admA2hsTap1 {
    0%, 6% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    10% { transform: translate(-50%, -50%) scale(1); opacity: .75; }
    20%, 100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}
@keyframes admA2hsTap2 {
    0%, 58% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    63% { transform: translate(-50%, -50%) scale(1); opacity: .75; }
    74%, 100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}
/* Posiciones de los toques por escena */
.adm-a2hs-demo--ios     .adm-a2hs-tap--1 { left: 78px; top: 212px; }
.adm-a2hs-demo--ios     .adm-a2hs-tap--2 { left: 78px; top: 150px; }
.adm-a2hs-demo--android .adm-a2hs-tap--1 { left: 140px; top: 15px; }
.adm-a2hs-demo--android .adm-a2hs-tap--2 { left: 96px; top: 62px; }
.adm-a2hs-demo--desktop .adm-a2hs-tap--1 { left: 236px; top: 21px; }
/* Menos movimiento: congelar en "abierto + resaltado", sin pulsos */
@media (prefers-reduced-motion: reduce) {
    .adm-a2hs-hot--share, .adm-a2hs-hot--menu, .adm-a2hs-hot--install { animation: none; }
    .adm-a2hs-sheet, .adm-a2hs-menu, .adm-a2hs-install-pop { animation: none; transform: none; opacity: 1; }
    .adm-a2hs-row--target { animation: none; background: var(--primary-bg, rgba(25, 156, 130, .08)); box-shadow: inset 0 0 0 1.5px var(--primary, #199c82); }
    .adm-a2hs-tap { display: none; }
    .adm-a2hs-coach.is-shown, .adm-a2hs-coach.is-shown .adm-a2hs-coach__card { animation: none; }
}

/* ── Modal guía (device-aware) ────────────────────────────────── */
.adm-a2hs-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    background: rgba(15, 23, 42, .55);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}
.adm-a2hs-overlay.is-open { opacity: 1; pointer-events: auto; }
.adm-a2hs-modal {
    position: relative;
    box-sizing: border-box;
    background: var(--bg-card, #fff);
    border-radius: var(--radius-lg, 14px);
    padding: 2rem 1.75rem 1.75rem;
    max-width: 440px;
    width: 100%;
    max-height: calc(100vh - 2.5rem);
    max-height: calc(100dvh - 2.5rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-lg, 0 12px 32px rgba(0, 0, 0, .08));
    transform: scale(.94) translateY(12px);
    transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);
}
.adm-a2hs-overlay.is-open .adm-a2hs-modal { transform: scale(1) translateY(0); }
.adm-a2hs-close {
    position: absolute;
    top: .85rem;
    right: .85rem;
    width: 34px;
    height: 34px;
    border: none;
    background: var(--border-light, #f1f5f9);
    color: var(--text-secondary, #475569);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .18s ease, color .18s ease;
}
.adm-a2hs-close:hover { background: var(--border, #e2e8f0); color: var(--text-primary, #0f172a); }
.adm-a2hs-close svg { width: 17px; height: 17px; }

.adm-a2hs-hero { text-align: center; margin-bottom: 1.4rem; }
.adm-a2hs-hero__ic {
    width: 62px;
    height: 62px;
    border-radius: var(--radius-lg, 14px);
    margin: 0 auto .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--primary, #199c82), var(--primary-dark, #116d5b));
    box-shadow: 0 12px 26px -10px rgba(var(--primary-rgb, 25, 156, 130), .5);
}
.adm-a2hs-hero__ic svg { width: 30px; height: 30px; color: #fff; }
/* Acento por plataforma (el JS pone data-platform en el modal) */
.adm-a2hs-modal[data-platform="ios"]     .adm-a2hs-hero__ic { background: linear-gradient(160deg, #334155, #0f172a); }
.adm-a2hs-modal[data-platform="android"] .adm-a2hs-hero__ic { background: linear-gradient(160deg, #16a34a, #15803d); }
.adm-a2hs-eyebrow {
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--primary-dark, #116d5b);
    margin-bottom: .35rem;
}
.adm-a2hs-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary, #0f172a);
    letter-spacing: -.02em;
    line-height: 1.25;
    margin: 0 0 .4rem;
    text-wrap: balance;
}
.adm-a2hs-lede {
    font-size: .86rem;
    color: var(--text-secondary, #475569);
    line-height: 1.55;
    font-weight: 500;
    margin: 0;
}

/* Pasos device-aware (los rellena el JS) */
.adm-a2hs-steps { display: flex; flex-direction: column; gap: .7rem; margin: 0 0 1.25rem; }
.adm-a2hs-step {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .75rem .85rem;
    background: var(--primary-bg, rgba(25, 156, 130, .06));
    border: 1px solid var(--primary-light, #e6f7f3);
    border-radius: var(--radius, 10px);
}
.adm-a2hs-step__n {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary, #199c82);
    color: #fff;
    font-size: .78rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}
.adm-a2hs-step__body { flex: 1 1 auto; min-width: 0; padding-top: .1rem; }
.adm-a2hs-step__t {
    font-size: .86rem;
    font-weight: 600;
    color: var(--text-secondary, #475569);
    line-height: 1.45;
}
.adm-a2hs-step__t strong { color: var(--text-primary, #0f172a); font-weight: 800; }
/* Glifo inline (compartir / menú / +) dentro del texto del paso */
.adm-a2hs-glyph {
    display: inline-flex;
    vertical-align: -.28em;
    width: 1.35em;
    height: 1.35em;
    margin: 0 .12em;
    color: var(--primary-dark, #116d5b);
}
.adm-a2hs-glyph svg { width: 100%; height: 100%; }

/* Nota (in-app / iOS no-Safari): aviso ámbar, no pasos numerados */
.adm-a2hs-note {
    display: flex;
    gap: .7rem;
    padding: .85rem .95rem;
    background: var(--warning-bg, rgba(245, 158, 11, .08));
    border: 1px solid #fde68a;
    border-radius: var(--radius, 10px);
    margin: 0 0 1.25rem;
}
.adm-a2hs-note__ic { flex: 0 0 auto; color: var(--warning, #f59e0b); }
.adm-a2hs-note__ic svg { width: 20px; height: 20px; }
.adm-a2hs-note__t { font-size: .84rem; color: #92400e; line-height: 1.5; font-weight: 600; }
.adm-a2hs-note__t strong { font-weight: 800; }
/* Variante "ya está agregada" / éxito: verde */
.adm-a2hs-note--ok { background: var(--primary-bg, rgba(25, 156, 130, .06)); border-color: var(--primary-light, #e6f7f3); }
.adm-a2hs-note--ok .adm-a2hs-note__ic { color: var(--success, #22c55e); }
.adm-a2hs-note--ok .adm-a2hs-note__t { color: var(--success-ink); }

/* Botón nativo (Android con prompt) */
.adm-a2hs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: .85rem 1rem;
    border-radius: var(--radius, 10px);
    font-size: .92rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: transform .15s ease, background-color .15s ease;
}
.adm-a2hs-btn svg { width: 18px; height: 18px; }
.adm-a2hs-btn--primary { color: #fff; background: var(--primary, #199c82); }
.adm-a2hs-btn--primary:hover { background: var(--primary-dark, #116d5b); transform: translateY(-1px); }
.adm-a2hs-native { width: 100%; }
.adm-a2hs-foot { margin-top: .25rem; }
.adm-a2hs-hint {
    text-align: center;
    font-size: .76rem;
    color: var(--text-muted, #94a3b8);
    font-weight: 500;
    margin: .85rem 0 0;
}

@media (max-width: 480px) {
    .adm-a2hs-modal { padding: 1.75rem 1.15rem 1.4rem; border-radius: var(--radius-lg, 14px); }
    .adm-a2hs-title { font-size: 1.1rem; }
    .adm-a2hs-coach__actions { flex-direction: column; }
}

/* Menos movimiento: sin bounce, solo aparición */
@media (prefers-reduced-motion: reduce) {
    .adm-a2hs-modal { transition: opacity .2s ease; transform: none; }
    .adm-a2hs-overlay { transition: opacity .2s ease; }
    .adm-a2hs-overlay.is-open .adm-a2hs-modal { transform: none; }
}
