/* ==========================================================================
   Librerías Hidalgo - Sistema de Facturación
   Hoja de estilos del rediseño visual.

   Basada en la estética de https://libreriashidalgo.mx/:
     - Estilo "neumórfico": superficies del mismo color que el fondo que se
       elevan o se hunden con dos sombras (una oscura y una clara).
     - Paleta azul institucional (#004B8D, #002d6b, #001e38, #0078e2).
     - Tipografía Geist, esquinas muy redondeadas y botones tipo píldora.

   Se carga DESPUÉS de bootstrap.min.css y solo sobrescribe estilos; no
   depende de ningún archivo fuera de esta carpeta (assets/).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tipografía local (Geist, la misma del sitio). Archivo en assets/fonts.
   -------------------------------------------------------------------------- */
@font-face {
    font-family: "Geist";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/geist-latin-wght-normal.woff2") format("woff2");
}

/* --------------------------------------------------------------------------
   2. Variables de diseño (tokens). Cambiar aquí ajusta todo el sistema.
   -------------------------------------------------------------------------- */
:root {
    /* Superficie y sombras neumórficas */
    --lh-bg: #f0f2f5;
    --lh-shadow-dark: #d0d3d8;
    --lh-shadow-light: #ffffff;

    /* Azules de marca */
    --lh-primary: #004b8d;
    --lh-primary-deep: #001e38;
    --lh-primary-bright: #0078e2;
    --lh-navy: #002d6b;

    /* Texto */
    --lh-text: #0f172a;
    --lh-muted: #596b80;

    /* Estados */
    --lh-success: #0f7a4a;
    --lh-success-soft: #e3f4ea;
    --lh-danger: #b42318;
    --lh-danger-soft: #fdecea;
    --lh-info-soft: #e6eef8;

    /* Formas */
    --lh-radius-xl: 28px;
    --lh-radius-lg: 22px;
    --lh-radius: 14px;

    /* Sombras reutilizables */
    --lh-raised: 9px 9px 18px var(--lh-shadow-dark), -9px -9px 18px var(--lh-shadow-light);
    --lh-raised-sm: 4px 4px 9px var(--lh-shadow-dark), -4px -4px 9px var(--lh-shadow-light);
    --lh-inset: inset 3px 3px 7px var(--lh-shadow-dark), inset -3px -3px 7px var(--lh-shadow-light);
    --lh-inset-lg: inset 5px 5px 11px var(--lh-shadow-dark), inset -5px -5px 11px var(--lh-shadow-light);

    /* Integración con las variables de Bootstrap 5.3 */
    --bs-body-font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --bs-body-bg: var(--lh-bg);
    --bs-body-color: var(--lh-text);
    --bs-primary: var(--lh-primary);
    --bs-primary-rgb: 0, 75, 141;
    --bs-link-color: var(--lh-primary);
    --bs-link-color-rgb: 0, 75, 141;
    --bs-border-radius: var(--lh-radius);
    --bs-font-monospace: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* --------------------------------------------------------------------------
   3. Base
   -------------------------------------------------------------------------- */
.lh-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--lh-bg);
    color: var(--lh-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.lh-container {
    flex: 1 0 auto;
    padding-bottom: 3rem;
}

.lh-mono {
    font-family: var(--bs-font-monospace);
    font-size: 0.9em;
    word-break: break-all;
}

.lh-icon {
    width: 1.15em;
    height: 1.15em;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   4. Encabezado (barra superior, como en el sitio)
   -------------------------------------------------------------------------- */
.lh-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--lh-bg);
    box-shadow: 0 4px 12px var(--lh-shadow-dark), 0 1px 3px var(--lh-shadow-light);
}

.lh-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 72px;
}

.lh-header__logo {
    height: 44px;
    width: auto;
}

.lh-header__tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    box-shadow: var(--lh-inset);
    color: var(--lh-primary);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   5. Encabezado de página (hero)
   -------------------------------------------------------------------------- */
.lh-hero {
    padding: 2.75rem 0 1.75rem;
}

.lh-eyebrow {
    display: inline-block;
    margin-bottom: 0.85rem;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    background: var(--lh-bg);
    box-shadow: var(--lh-raised-sm);
    color: var(--lh-primary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lh-hero__title {
    margin-bottom: 0.5rem;
    color: var(--lh-navy);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.lh-hero__lead {
    max-width: 40rem;
    margin: 0 auto;
    color: var(--lh-muted);
    font-size: 1.05rem;
}

/* --------------------------------------------------------------------------
   6. Indicador de pasos (1 Ticket -> 2 Datos fiscales -> 3 Factura)
   -------------------------------------------------------------------------- */
.lh-steps {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    max-width: 640px;
    margin: 0 auto 2.25rem;
    padding: 0.5rem;
    list-style: none;
    border-radius: 999px;
    box-shadow: var(--lh-inset-lg);
}

.lh-steps__item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.55rem 0.75rem;
    border-radius: 999px;
    color: var(--lh-muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
}

.lh-steps__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--lh-bg);
    box-shadow: var(--lh-raised-sm);
    font-size: 0.8rem;
    font-weight: 700;
}

.lh-steps__item.is-current {
    background: var(--lh-bg);
    box-shadow: var(--lh-raised-sm);
    color: var(--lh-navy);
}

.lh-steps__item.is-current .lh-steps__num {
    background: var(--lh-primary);
    box-shadow: inset 2px 2px 4px var(--lh-primary-deep), inset -2px -2px 4px var(--lh-primary-bright);
    color: #fff;
}

.lh-steps__item.is-done {
    color: var(--lh-primary);
}

.lh-steps__item.is-done .lh-steps__num {
    color: var(--lh-primary);
}

/* --------------------------------------------------------------------------
   7. Tarjetas (superficies elevadas)
   -------------------------------------------------------------------------- */
.lh-card {
    height: 100%;
    padding: 2rem;
    border-radius: var(--lh-radius-xl);
    background: var(--lh-bg);
    box-shadow: var(--lh-raised);
}

.lh-card__title {
    margin-bottom: 0.35rem;
    color: var(--lh-navy);
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.lh-card__subtitle {
    margin-bottom: 1.75rem;
    color: var(--lh-muted);
}

/* Tarjeta lateral con el resumen del ticket: se queda fija al hacer scroll */
@media (min-width: 992px) {
    .lh-summary {
        position: sticky;
        top: 96px;
        height: auto;
    }
}

/* Etiqueta pequeña ("Ticket encontrado") */
.lh-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    box-shadow: var(--lh-inset);
    font-size: 0.78rem;
    font-weight: 700;
}

.lh-chip--ok {
    color: var(--lh-success);
}

/* --------------------------------------------------------------------------
   8. Lista de datos (Documento, Total, Sucursal, Factura, UUID...)
   -------------------------------------------------------------------------- */
.lh-data {
    margin: 1.25rem 0 1.5rem;
    padding: 0.35rem 1.15rem;
    border-radius: var(--lh-radius-lg);
    box-shadow: var(--lh-inset-lg);
    text-align: left;
}

.lh-data__row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    padding: 0.8rem 0;
}

.lh-data__row + .lh-data__row {
    border-top: 1px solid var(--lh-shadow-dark);
    box-shadow: inset 0 1px 0 var(--lh-shadow-light);
}

.lh-data dt {
    color: var(--lh-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lh-data dd {
    margin: 0;
    color: var(--lh-text);
    font-weight: 700;
    text-align: right;
}

.lh-data__total {
    color: var(--lh-primary) !important;
    font-size: 1.35rem;
}

/* Variante apilada (para valores largos como el UUID) */
.lh-data__row--stack {
    flex-direction: column;
    align-items: flex-start;
}

.lh-data__row--stack dd {
    text-align: left;
}

/* --------------------------------------------------------------------------
   9. Formularios
   -------------------------------------------------------------------------- */
.lh-fieldset {
    margin-bottom: 1.75rem;
}

.lh-fieldset legend {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    color: var(--lh-primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Línea "grabada" a la derecha del título de cada sección */
.lh-fieldset legend::after {
    content: "";
    flex: 1;
    height: 2px;
    box-shadow: 0 1px 0 var(--lh-shadow-light), 0 -1px 0 var(--lh-shadow-dark);
}

.lh-body .form-label {
    margin-bottom: 0.4rem;
    color: var(--lh-text);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Campos hundidos (inset), como los inputs del sitio */
.lh-body .form-control,
.lh-body .form-select,
.lh-body .input-group-text {
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    background-color: var(--lh-bg);
    box-shadow: var(--lh-inset);
    color: var(--lh-text);
    transition: box-shadow 0.2s ease;
}

.lh-body .form-control::placeholder {
    color: #94a3b8;
}

.lh-body .form-control:focus,
.lh-body .form-select:focus {
    background-color: var(--lh-bg);
    box-shadow: inset 4px 4px 9px var(--lh-shadow-dark), inset -4px -4px 9px var(--lh-shadow-light), 0 0 0 2px var(--lh-primary);
    color: var(--lh-text);
    outline: none;
}

/* Campos de solo lectura (por ejemplo, RFC genérico XAXX010101000) */
.lh-body .form-control[readonly] {
    color: var(--lh-muted);
    cursor: not-allowed;
}

/* Campo de RFC: solo se muestra en mayúsculas (el valor enviado no cambia) */
.lh-uppercase {
    text-transform: uppercase;
}

/* Grupo "$ + total" */
.lh-body .input-group-text {
    padding-inline: 1rem;
    color: var(--lh-primary);
    font-weight: 700;
}

.lh-body .input-group > .input-group-text {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: inset 3px 3px 7px var(--lh-shadow-dark);
}

.lh-body .input-group > .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.lh-help {
    margin-top: 0.4rem;
    color: var(--lh-muted);
    font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   10. Botones
   -------------------------------------------------------------------------- */
.lh-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

/* Muestra el primer botón del HTML a la derecha sin cambiar el orden real
   (el primer botón es el que usa el navegador al presionar Enter) */
.lh-actions--reverse {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.lh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 48px;
    padding: 0.6rem 1.6rem;
    border: 0;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    transition: box-shadow 0.2s ease, transform 0.15s ease, background-color 0.2s ease;
}

.lh-btn:hover {
    transform: translateY(-1px);
}

.lh-btn:active {
    transform: translateY(0);
}

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

/* Botón principal: el azul "presionado" de los botones del sitio */
.lh-btn-primary,
.lh-btn-primary:disabled {
    background: var(--lh-primary);
    color: #fff;
    box-shadow:
        inset 4px 4px 8px var(--lh-primary-deep),
        inset -4px -4px 8px var(--lh-primary-bright),
        var(--lh-raised-sm);
}

.lh-btn-primary:hover,
.lh-btn-primary:focus {
    background: #0a5aa3;
    color: #fff;
}

.lh-btn-primary:active {
    background: var(--lh-primary) !important;
    color: #fff !important;
    box-shadow: inset 6px 6px 10px var(--lh-primary-deep), inset -3px -3px 8px var(--lh-primary-bright) !important;
}

/* Botón secundario (Regresar): superficie neutra elevada */
.lh-btn-ghost,
.lh-btn-ghost:disabled {
    background: var(--lh-bg);
    color: var(--lh-navy);
    box-shadow: var(--lh-raised-sm);
}

.lh-btn-ghost:hover,
.lh-btn-ghost:focus {
    background: var(--lh-bg);
    color: var(--lh-primary);
    box-shadow: 6px 6px 13px var(--lh-shadow-dark), -6px -6px 13px var(--lh-shadow-light);
}

.lh-btn-ghost:active {
    background: var(--lh-bg) !important;
    color: var(--lh-primary) !important;
    box-shadow: var(--lh-inset) !important;
}

/* Estado "Procesando..." (lo activa assets/js/facturacion.js) */
.lh-btn.is-loading {
    opacity: 1;
    pointer-events: none;
}

.lh-btn.is-loading::before {
    content: "";
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: lh-spin 0.7s linear infinite;
}

.lh-btn.is-loading .lh-icon {
    display: none;
}

@keyframes lh-spin {
    to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   11. Mensajes (resultado, avisos y errores)
   -------------------------------------------------------------------------- */
.lh-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.9rem 1.1rem;
    border-radius: var(--lh-radius);
    box-shadow: var(--lh-inset);
    font-size: 0.9rem;
    font-weight: 600;
}

.lh-alert .lh-icon {
    margin-top: 0.1rem;
}

.lh-alert--info {
    color: var(--lh-navy);
}

.lh-result {
    text-align: center;
}

.lh-result__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    margin-bottom: 1.25rem;
    border-radius: 50%;
    background: var(--lh-bg);
    box-shadow: var(--lh-raised);
}

.lh-result__icon .lh-icon {
    width: 34px;
    height: 34px;
    stroke-width: 2.5;
}

.lh-result__icon--ok {
    color: var(--lh-success);
}

.lh-result__icon--error {
    color: var(--lh-danger);
}

.lh-result__icon--info {
    color: var(--lh-primary);
}

.lh-result__title {
    margin-bottom: 0.5rem;
    color: var(--lh-navy);
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.35;
}

.lh-result__text {
    margin-bottom: 1.5rem;
    color: var(--lh-muted);
}

/* --------------------------------------------------------------------------
   12. Pie de página
   -------------------------------------------------------------------------- */
.lh-footer {
    flex-shrink: 0;
    padding: 1.4rem 0;
    background: var(--lh-bg);
    box-shadow: 0 -4px 12px var(--lh-shadow-dark), 0 -1px 3px var(--lh-shadow-light);
    color: var(--lh-muted);
    font-size: 0.85rem;
    text-align: center;
}

/* --------------------------------------------------------------------------
   13. Ajustes para pantallas pequeñas (celulares)
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .lh-header__inner {
        min-height: 60px;
    }

    .lh-header__logo {
        height: 34px;
    }

    .lh-header__tag {
        padding: 0.35rem 0.75rem;
        font-size: 0.7rem;
    }

    .lh-hero {
        padding: 1.75rem 0 1.25rem;
    }

    .lh-steps {
        gap: 0.25rem;
        padding: 0.35rem;
        border-radius: 24px;
    }

    .lh-steps__item {
        flex-direction: column;
        gap: 0.3rem;
        padding: 0.5rem 0.25rem;
        border-radius: 18px;
        font-size: 0.72rem;
    }

    .lh-card {
        padding: 1.5rem 1.15rem;
        border-radius: var(--lh-radius-lg);
    }

    .lh-actions .lh-btn {
        flex: 1 1 100%;
    }
}

/* Respeta la preferencia del usuario de reducir animaciones */
@media (prefers-reduced-motion: reduce) {
    .lh-btn,
    .lh-body .form-control,
    .lh-body .form-select {
        transition: none;
    }

    .lh-btn:hover {
        transform: none;
    }
}
