/*!
 * Theme Name: Default
 * Package : DashLite
 * Author: Softnio
 * Author URI: http://themeforest.net/user/softnio
 * Version	 :	1.0.0
 * Updated	 :	07.23.2020
**/

/* ============================================================================
   Ajustes móviles (skill mobile-app-ui-design). Reglas globales — theme.css
   está enlazado en todas las páginas via <link id="skin-default">.
   ========================================================================== */

/* 1) Tap targets ≥ 44×44 en pantallas táctiles.
   Los iconos de acción de las grillas (btn-sm btn-icon ~28-32px), la campanita
   del header y los toggles de DataTables quedaban por debajo del mínimo del
   skill. Solo en móvil para no alterar la densidad del escritorio. */
@media (max-width: 767.98px) {
    .btn-icon,
    .nk-quick-nav-icon,
    .dataTables_wrapper .dropdown-toggle,
    .btn-trigger {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Ítems del menú de acciones (ver / editar / eliminar) y del dropdown de
       usuario/notificaciones: cómodos al dedo. */
    .dataTables_wrapper .link-list-opt li a,
    .dropdown-menu .link-list li > a,
    .dropdown-menu .link-list .logout-link {
        min-height: 44px;
        align-items: center;
    }

    /* CTAs de texto (Facturar, Guardar, Nueva Venta…): el .btn por defecto queda
       ~36px de alto. Subimos el padding vertical para llegar a ≥44px sin tocar el
       display (así .btn-block del login sigue full-width). Excluimos .btn-sm y
       .btn-icon (acciones compactas / ya normalizadas) y .btn-lg (ya ≥44px). */
    .btn:not(.btn-sm):not(.btn-icon):not(.btn-lg) {
        padding-top: 0.72rem;
        padding-bottom: 0.72rem;
    }
}

/* 2) Cifras tabulares en importes grandes: evita que los números "bailen" al
   actualizarse (total del carrito, KPIs, montos de las tablas). */
.amount,
.nk-sale-data .amount,
#posTotal,
#cv_total {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* 3) Peak-end: micro-celebración al completar una venta. Confeti puro en CSS
   (sin dependencias); el JS del POS crea el contenedor .tdo-confetti. */
.tdo-confetti {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 20000;
    overflow: hidden;
}

.tdo-confetti span {
    position: absolute;
    top: -12vh;
    width: 9px;
    height: 14px;
    opacity: 0;
    border-radius: 2px;
    animation: tdo-confetti-fall 1300ms ease-in forwards;
}

@keyframes tdo-confetti-fall {
    0%   { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate3d(var(--dx, 0), 112vh, 0) rotate(720deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .tdo-confetti span { animation-duration: 1ms; opacity: 0; }
}

/* Paleta de DashLite ajustada a 4,5:1 (WCAG 2.1 AA). */
.nk-sidebar .nk-menu-link:not(:hover) .nk-menu-text { color: #a7b5cc; }
.nk-block-des, .nk-block-des p, .nk-block-des li, .text-soft, .text-soft li { color: #5f6f87 !important; }
.text-muted, .form-text { color: #5f6f87 !important; }
.nk-footer-copyright, .nk-footer-copyright .text-muted, .nk-footer-copyright .text-muted span { color: #5f6f87 !important; opacity: 1 !important; }
.medida-campo label { color: #5f6f87 !important; }
.btn-primary { background-color: #4f5fe8; border-color: #4f5fe8; }
.nav-tabs .nav-link.active, .nav-tabs .nav-link.active span { color: #4f5fe8; }
.campo-error { color: #b42318 !important; }
.campo-error a, #aviso_duplicado a, #qc_aviso a { color: #3343c4; text-decoration: underline; }
.btn-success { background-color: #0b7a5c; border-color: #0b7a5c; }
.badge.bg-success { background-color: #0b7a5c !important; border-color: #0b7a5c; }
.badge.bg-danger { background-color: #c9372c !important; border-color: #c9372c; }
.page-item.disabled .page-link { color: #5f6f87; }

/* Modern Web Guidance: color de acento nativo, View Transitions MPA y anti-zoom iOS. */
:root { accent-color: #4f5fe8; }

@media (prefers-reduced-motion: no-preference) {
    @view-transition {
        navigation: auto;
    }
}

@media (max-width: 767.98px) {
    .form-control,
    .form-select {
        font-size: max(1rem, 1em);
    }
}

/* ============================================================================
   Iconografía de dominio óptico (sprite /assets/images/icons-optica.svg).
   Uso: <svg class="tdo-icon" aria-hidden="true" focusable="false">
          <use th:href="@{/assets/images/icons-optica.svg#tdo-glasses}"></use></svg>
   Hereda el color del texto (stroke=currentColor), igual que un NioIcon.
   ========================================================================== */
.tdo-icon {
    width: 1.15em;
    height: 1.15em;
    display: inline-block;
    vertical-align: -0.15em;
    flex-shrink: 0;
}
/* Dentro del menú lateral ocupa el mismo hueco que el <em class="icon"> de NioIcon. */
.nk-menu-icon .tdo-icon { width: 1.125rem; height: 1.125rem; vertical-align: middle; }

/* Indicador compacto de los modales de confirmación (alta / guardado). Sustituye
   al icono de 120 px: jerarquía proporcional, el foco visual queda en el botón. */
.tdo-confirm-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #eef0ff;            /* indigo-tenue */
    color: #4f5fe8;                 /* indigo-mostrador */
    font-size: 28px;
}

/* Guía Rápida: iconos sin arcoíris decorativo (Regla del Color con Significado).
   Encabezados del acordeón en indigo-mostrador; contactos en pizarra-texto. */
.tdo-help-ico { color: #4f5fe8; }
.tdo-help-contact { color: #526484; }

/* ============================================================================
   Movimiento (presupuesto GPU-first, ver DESIGN.md › Movimiento).
   Solo transform, opacity y colores; 100–240 ms; nada anima propiedades de
   layout ni transiciona todas las propiedades. Todo tiene alternativa en reduced-motion.
   ========================================================================== */
:root {
    --tdo-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --tdo-dur-fast: 120ms;
    --tdo-dur-normal: 180ms;
    --tdo-dur-panel: 220ms;
    --tdo-dur-panel-out: 160ms;
}

/* Modal lateral: fuente única para productos, inventario, ventas, emisores y
   usuarios. Se desliza con transform (sin reflow). El estado abierto lo fija
   Bootstrap (.modal.show .modal-dialog { transform: none !important }). El
   ancho se ajusta por modal con --tdo-modal-right-w (ventas usa 550px). */
.modal.modal-right .modal-dialog {
    position: fixed;
    top: 0;
    right: 0;
    margin: 0;
    width: var(--tdo-modal-right-w, 500px);
    max-width: 100%;
    height: 100%;
    transform: translateX(100%);
    transition: transform var(--tdo-dur-panel-out) var(--tdo-ease-out);
}
.modal.modal-right.show .modal-dialog {
    transition-duration: var(--tdo-dur-panel);
}
.modal.modal-right .modal-content {
    height: 100%;
    overflow-y: auto;
    border-radius: 0;
    border-left: 1px solid #dee2e6;
}
.modal.modal-right .modal-header { border-bottom: 1px solid #dee2e6; padding: 15px 20px; }
.modal.modal-right .modal-body { padding: 15px 20px 80px; }
.modal.modal-right .modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 15px 20px;
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 1;
}
@media (max-width: 767px) {
    .modal.modal-right .modal-dialog { width: 100%; }
}

/* Feedback táctil al pulsar acciones principales. */
.btn-primary,
.btn-success {
    transition: color .15s ease-in-out, background-color .15s ease-in-out,
                border-color .15s ease-in-out, box-shadow .15s ease-in-out,
                transform 80ms ease-out;
}
.btn-primary:active,
.btn-success:active { transform: scale(0.98); }

/* Error de validación junto al campo: aparece con un fundido corto. */
.campo-error { animation: tdo-fade-down 140ms var(--tdo-ease-out); }
@keyframes tdo-fade-down {
    from { opacity: 0; transform: translateY(-3px); }
    to   { opacity: 1; transform: none; }
}

/* Tarjeta-enlace (acceso rápido del dashboard): sin hover lift, solo borde. */
.tdo-card-link { transition: border-color var(--tdo-dur-fast) ease-out; }
.tdo-card-link:hover,
.tdo-card-link:focus-visible { border-color: #4f5fe8; }

/* Cambio de icono (Copiar medida → check): fundido breve. */
.tdo-icon-swap { animation: tdo-fade-in var(--tdo-dur-fast) ease-out; }
@keyframes tdo-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Badge de notificaciones: un único pop cuando aumenta el conteo. */
.tdo-badge-pop { animation: tdo-pop var(--tdo-dur-normal) var(--tdo-ease-out); }
@keyframes tdo-pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* POS: destello de la fila agregada/actualizada y micro-pulso del total. */
.tdo-row-flash > td { animation: tdo-row-flash 350ms ease-out; }
@keyframes tdo-row-flash {
    from { background-color: #eef0ff; }   /* indigo-tenue */
    to   { background-color: transparent; }
}
.tdo-total-bump {
    display: inline-block;
    animation: tdo-bump 150ms var(--tdo-ease-out);
}
@keyframes tdo-bump {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.03); }
    100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    /* Sin desplazamiento ni escala; quedan los cambios de opacidad y color. */
    .modal.modal-right .modal-dialog { transform: none; transition: none; }
    .btn-primary:active,
    .btn-success:active { transform: none; }
    .campo-error { animation: tdo-fade-in 120ms ease-out; }
    .tdo-badge-pop,
    .tdo-total-bump { animation: none; }
}
