/* ==========================================================================
   Librerías Hidalgo - Sistema de Facturación
   [GUÍA] Estilos de la guía de llenado y de los campos obligatorios/opcionales.

   Contiene:
     1. Botones de ayuda (encabezado, tarjetas y "?" junto a cada campo)
     2. Marcas de campo obligatorio y selector "Solo obligatorios / Todos"
     3. Ventana de ayuda (modal de Bootstrap) con las imágenes de ejemplo
     4. Zonas resaltadas dentro de las imágenes SVG (assets/img/guia)
     5. Tema del recorrido guiado (Driver.js, assets/css/driver.css)

   Usa las variables definidas en facturacion.css, por eso se carga después.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Botones de ayuda
   -------------------------------------------------------------------------- */
.lh-header__acciones {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Botón "Ayuda" del encabezado */
.lh-header__ayuda {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1rem;
    border: 0;
    border-radius: 999px;
    background: var(--lh-bg);
    box-shadow: var(--lh-raised-sm);
    color: var(--lh-primary);
    font-size: 0.85rem;
    font-weight: 700;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.lh-header__ayuda:hover {
    transform: translateY(-1px);
    box-shadow: 6px 6px 13px var(--lh-shadow-dark), -6px -6px 13px var(--lh-shadow-light);
}

.lh-header__ayuda:active {
    transform: none;
    box-shadow: var(--lh-inset);
}

/* Encabezado de tarjeta con enlace "¿Dónde encuentro estos datos?" */
.lh-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.lh-link-ayuda {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border: 0;
    border-radius: 999px;
    background: var(--lh-bg);
    box-shadow: var(--lh-inset);
    color: var(--lh-primary);
    font-size: 0.82rem;
    font-weight: 700;
}

.lh-link-ayuda:hover {
    color: var(--lh-primary-bright);
}

/* Etiqueta + botón "?" */
.lh-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}

.lh-label .form-label {
    margin-bottom: 0 !important;
}

.lh-ayuda-campo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--lh-bg);
    box-shadow: 2px 2px 5px var(--lh-shadow-dark), -2px -2px 5px var(--lh-shadow-light);
    color: var(--lh-primary);
    transition: color 0.2s ease, box-shadow 0.2s ease;
}

.lh-ayuda-campo .lh-icon {
    width: 14px;
    height: 14px;
}

.lh-ayuda-campo:hover {
    color: var(--lh-primary-bright);
}

.lh-ayuda-campo:active {
    box-shadow: inset 2px 2px 4px var(--lh-shadow-dark), inset -2px -2px 4px var(--lh-shadow-light);
}

.lh-header__ayuda:focus-visible,
.lh-link-ayuda:focus-visible,
.lh-ayuda-campo:focus-visible,
.lh-modo__btn:focus-visible,
.lh-guia__cerrar:focus-visible,
.lh-guia__item:focus-visible {
    outline: 3px solid var(--lh-primary-bright);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   2. Campos obligatorios y selector de captura
   -------------------------------------------------------------------------- */
.lh-req {
    color: var(--lh-danger);
    font-weight: 800;
}

/* Aviso "Solo los campos con * son obligatorios" */
.lh-nota {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 1.75rem;
    padding: 0.8rem 1rem;
    border-radius: var(--lh-radius);
    box-shadow: var(--lh-inset);
    color: var(--lh-navy);
    font-size: 0.875rem;
}

.lh-nota .lh-icon {
    margin-top: 0.1rem;
    color: var(--lh-primary);
}

/* Selector "Solo obligatorios / Todos los datos" */
.lh-modo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.15rem;
    border-radius: var(--lh-radius-lg);
    background: var(--lh-bg);
    box-shadow: var(--lh-raised-sm);
}

.lh-modo__texto {
    flex: 1 1 260px;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.85rem;
    color: var(--lh-muted);
}

.lh-modo__texto strong {
    color: var(--lh-navy);
    font-size: 0.95rem;
}

.lh-modo__opciones {
    display: inline-flex;
    gap: 0.3rem;
    padding: 0.3rem;
    border-radius: 999px;
    box-shadow: var(--lh-inset);
}

.lh-modo__btn {
    padding: 0.5rem 1rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--lh-muted);
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    transition: box-shadow 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.lh-modo__btn.is-active {
    background: var(--lh-bg);
    box-shadow: var(--lh-raised-sm);
    color: var(--lh-primary);
}

/* Sección opcional: solo se oculta (los campos se siguen enviando) */
.lh-opcionales.is-collapsed {
    display: none;
}

.lh-opcionales__info {
    margin: -0.25rem 0 1rem;
    color: var(--lh-muted);
    font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   3. Ventana de ayuda (modal)
   -------------------------------------------------------------------------- */
.lh-guia .modal-content {
    border: 0;
    border-radius: var(--lh-radius-xl);
    background: var(--lh-bg);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.lh-guia .modal-header {
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem 1.75rem 1rem;
    border-bottom: 0;
    box-shadow: 0 3px 8px var(--lh-shadow-dark);
}

.lh-guia .modal-header .lh-eyebrow {
    margin-bottom: 0.5rem;
}

.lh-guia .modal-body {
    padding: 1.5rem 1.75rem 2rem;
}

.lh-guia__cerrar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    margin-left: auto;
    border: 0;
    border-radius: 50%;
    background: var(--lh-bg);
    box-shadow: var(--lh-raised-sm);
    color: var(--lh-navy);
}

.lh-guia__cerrar:active {
    box-shadow: var(--lh-inset);
}

/* Invitación al recorrido guiado */
.lh-guia__tour {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: var(--lh-radius-lg);
    box-shadow: var(--lh-inset-lg);
}

.lh-guia__tour div {
    flex: 1 1 280px;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    color: var(--lh-muted);
    font-size: 0.875rem;
}

.lh-guia__tour strong {
    color: var(--lh-navy);
    font-size: 1rem;
}

/* Pestañas (Ticket / Constancia / Otros datos) */
.lh-guia__tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    margin: 0 0 1.5rem;
    padding: 0.4rem;
    list-style: none;
    border-radius: 18px;
    box-shadow: var(--lh-inset-lg);
}

.lh-guia__tabs li {
    flex: 1;
}

.lh-guia__tabs .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    height: 100%;
    padding: 0.6rem 0.75rem;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--lh-muted);
    font-size: 0.875rem;
    font-weight: 700;
    text-align: center;
}

.lh-guia__tabs .nav-link.active {
    background: var(--lh-bg);
    box-shadow: var(--lh-raised-sm);
    color: var(--lh-navy);
}

/* Imagen de ejemplo */
.lh-guia__doc {
    margin: 0;
    padding: 1rem;
    border-radius: var(--lh-radius-lg);
    box-shadow: var(--lh-inset-lg);
    text-align: center;
}

.lh-guia__doc .guia-doc-svg {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
}

.lh-guia__doc--ticket .guia-doc-svg {
    max-width: 420px;
}

.lh-guia__doc figcaption {
    margin-top: 0.75rem;
    color: var(--lh-muted);
    font-size: 0.8rem;
}

.lh-guia__doc figcaption a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 700;
    text-decoration: none;
}

@media (min-width: 992px) {
    /* La imagen se queda visible mientras se recorre la lista */
    .lh-guia__doc {
        position: sticky;
        top: 0;
    }
}

/* Lista numerada que explica cada dato */
.lh-guia__lista {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin: 0 0 1.25rem;
    padding: 0;
    list-style: none;
}

.lh-guia__item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: var(--lh-radius-lg);
    background: var(--lh-bg);
    box-shadow: var(--lh-raised-sm);
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.lh-guia__item.is-active {
    box-shadow: var(--lh-inset), 0 0 0 2px var(--lh-primary-bright);
}

.lh-guia__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--lh-primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
}

.lh-guia__num--opcional {
    background: var(--lh-bg);
    box-shadow: inset 0 0 0 2px #64748b;
    color: #475569;
}

.lh-guia__item h3 {
    margin: 0.15rem 0 0.25rem;
    color: var(--lh-navy);
    font-size: 0.98rem;
    font-weight: 800;
}

.lh-guia__item p,
.lh-guia__item ul {
    margin: 0 0 0.35rem;
    color: var(--lh-text);
    font-size: 0.86rem;
}

.lh-guia__item p:last-child,
.lh-guia__item ul:last-child {
    margin-bottom: 0;
}

.lh-guia__item ul {
    padding-left: 1.1rem;
}

.lh-guia__item code,
.lh-tour__snip {
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 0 0 1px var(--lh-shadow-dark);
    color: var(--lh-navy);
    font-family: var(--bs-font-monospace);
    font-size: 0.82rem;
    white-space: nowrap;
}

.lh-guia__opcional {
    display: inline-block;
    margin-left: 0.25rem;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    box-shadow: var(--lh-inset);
    color: var(--lh-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
}

/* Tabla de equivalencias del domicilio */
.lh-guia__equivalencias {
    width: 100%;
    margin-top: 0.4rem;
    font-size: 0.8rem;
}

.lh-guia__equivalencias th,
.lh-guia__equivalencias td {
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid var(--lh-shadow-dark);
    vertical-align: top;
}

.lh-guia__equivalencias th {
    color: var(--lh-muted);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.lh-guia__equivalencias tr:last-child td {
    border-bottom: 0;
}

/* --------------------------------------------------------------------------
   4. Zonas resaltadas dentro de los SVG
   -------------------------------------------------------------------------- */
.guia-marca {
    transition: opacity 0.25s ease;
}

.guia-marca__area {
    transition: fill-opacity 0.25s ease, stroke-width 0.25s ease;
}

/* Cuando hay una zona activa, las demás se atenúan */
.guia-doc-svg.has-active .guia-marca:not(.is-active) {
    opacity: 0.3;
}

.guia-marca.is-active .guia-marca__area {
    fill-opacity: 0.25;
    stroke-width: 3;
    animation: lh-guia-pulso 1.4s ease-in-out infinite;
}

@keyframes lh-guia-pulso {
    50% { fill-opacity: 0.12; }
}

/* --------------------------------------------------------------------------
   5. Recorrido guiado (Driver.js)
   -------------------------------------------------------------------------- */
.driver-popover.lh-tour {
    min-width: 270px;
    max-width: 340px;
    padding: 1.15rem 1.25rem 1rem;
    border-radius: 20px;
    background-color: var(--lh-bg);
    box-shadow: 10px 10px 24px rgba(15, 23, 42, 0.25), -4px -4px 12px rgba(255, 255, 255, 0.6);
    color: var(--lh-text);
    font-family: var(--bs-body-font-family);
}

.driver-popover.lh-tour .driver-popover-title {
    margin-bottom: 0.4rem;
    padding-right: 1.5rem;
    color: var(--lh-navy);
    font-family: var(--bs-body-font-family);
    font-size: 1.05rem;
    font-weight: 800;
}

.driver-popover.lh-tour .driver-popover-description {
    color: var(--lh-text);
    font-family: var(--bs-body-font-family);
    font-size: 0.9rem;
    line-height: 1.5;
}

.driver-popover.lh-tour .driver-popover-description p {
    margin: 0 0 0.5rem;
}

.driver-popover.lh-tour .driver-popover-description p:last-child {
    margin-bottom: 0;
}

.driver-popover.lh-tour .lh-tour__snip {
    display: inline-block;
    margin: 0.15rem 0 0.35rem;
    padding: 0.3rem 0.6rem;
}

.driver-popover.lh-tour .lh-tour__snip mark {
    padding: 0 0.15rem;
    border-radius: 3px;
    background: rgba(0, 120, 226, 0.18);
    color: var(--lh-navy);
    font-weight: 700;
}

.driver-popover.lh-tour .driver-popover-progress-text {
    color: var(--lh-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.driver-popover.lh-tour .driver-popover-footer {
    margin-top: 1rem;
}

.driver-popover.lh-tour .driver-popover-footer-btn {
    padding: 0.4rem 0.95rem;
    border: 0;
    border-radius: 999px;
    background: var(--lh-bg);
    box-shadow: var(--lh-raised-sm);
    color: var(--lh-navy);
    font-family: var(--bs-body-font-family);
    font-size: 0.82rem;
    font-weight: 700;
    text-shadow: none;
}

.driver-popover.lh-tour .driver-popover-next-btn {
    background: var(--lh-primary);
    box-shadow: inset 3px 3px 6px var(--lh-primary-deep), inset -3px -3px 6px var(--lh-primary-bright);
    color: #fff;
}

.driver-popover.lh-tour .driver-popover-footer-btn:focus-visible {
    outline: 3px solid var(--lh-primary-bright);
    outline-offset: 2px;
}

.driver-popover.lh-tour .driver-popover-close-btn {
    top: 0.4rem;
    right: 0.4rem;
    width: 32px;
    height: 32px;
    color: var(--lh-muted);
    font-size: 1.4rem;
}

/* La flecha del globo toma el color de fondo del tema */
.driver-popover.lh-tour .driver-popover-arrow-side-left { border-left-color: var(--lh-bg); }
.driver-popover.lh-tour .driver-popover-arrow-side-right { border-right-color: var(--lh-bg); }
.driver-popover.lh-tour .driver-popover-arrow-side-top { border-top-color: var(--lh-bg); }
.driver-popover.lh-tour .driver-popover-arrow-side-bottom { border-bottom-color: var(--lh-bg); }

/* --------------------------------------------------------------------------
   6. Pantallas pequeñas
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .lh-header__ayuda {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .lh-guia .modal-header,
    .lh-guia .modal-body {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .lh-guia__tabs .nav-link {
        flex-direction: column;
        gap: 0.2rem;
        padding: 0.5rem 0.3rem;
        font-size: 0.75rem;
    }

    .lh-modo__opciones {
        width: 100%;
    }

    .lh-modo__btn {
        flex: 1;
        padding-inline: 0.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .guia-marca.is-active .guia-marca__area {
        animation: none;
    }
}
