/* ============================================================
   MICRO-INTERACTIONS — Efectos globales de UI
   Incluir en base.html después de sidebar.css
   ============================================================ */

/* ── 1. Botones: Press down ────────────────────────────────── */
.btn {
    transition: transform 0.1s ease, box-shadow 0.15s ease,
                background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:active:not(:disabled) {
    transform: scale(0.96);
}

/* ── 2. Botones: Icon rotate en hover ──────────────────────── */
.btn .bi-arrow-clockwise,
.btn .bi-arrow-repeat {
    transition: transform 0.3s ease;
}
.btn:hover .bi-arrow-clockwise,
.btn:hover .bi-arrow-repeat {
    transform: rotate(180deg);
}

/* ── 3. Filas de tabla: Background fade ────────────────────── */
.table tbody tr {
    transition: background-color 0.15s ease;
}
.table tbody tr:hover {
    background-color: var(--bg-hover, rgba(0, 0, 0, 0.025));
}

/* Dark mode */
[data-theme="dark"] .table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

/* ── 4. Links: Underline slide ─────────────────────────────── */
.content-wrapper a:not(.btn):not(.nav-link):not(.badge):not(.list-group-item) {
    position: relative;
    text-decoration: none;
}
.content-wrapper a:not(.btn):not(.nav-link):not(.badge):not(.list-group-item)::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 0;
    height: 1.5px;
    background-color: currentColor;
    transition: width 0.25s ease;
}
.content-wrapper a:not(.btn):not(.nav-link):not(.badge):not(.list-group-item):hover::after {
    width: 100%;
}

/* ── 5. Fade-in + slide-up al cargar ──────────────────────── */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeSlideUp 0.35s ease-out both;
}

/* Clases de delay para stagger manual */
.animate-delay-1 { animation-delay: 0.05s; }
.animate-delay-2 { animation-delay: 0.10s; }
.animate-delay-3 { animation-delay: 0.15s; }
.animate-delay-4 { animation-delay: 0.20s; }

/* Cards con animación al cargar la página */
.content-wrapper > .container-fluid > .row > .col-12 > .card,
.content-wrapper > .container-fluid > .row > [class*="col-"] > .card {
    animation: fadeSlideUp 0.4s ease-out both;
}

/* ── 6. Staggered animation en tarjetas Kanban ─────────────── */
.order-card {
    animation: fadeSlideUp 0.3s ease-out both;
    animation-delay: calc(0.04s * var(--i, 0));
}

/* ── 7. Counter increment (estilo visual del stat) ─────────── */
.stat-value {
    transition: transform 0.2s ease;
}
.stat-value.counting {
    transform: scale(1.08);
}

/* ── 8. Tab ink bar ────────────────────────────────────────── */
.nav-tabs {
    position: relative;
}
.nav-tabs .nav-link {
    position: relative;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.nav-tabs .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2.5px;
    background-color: var(--primary-color, #F39200);
    border-radius: 2px 2px 0 0;
    transition: width 0.25s ease, left 0.25s ease;
}
.nav-tabs .nav-link.active::after,
.nav-tabs .nav-link:hover::after {
    width: 100%;
    left: 0;
}
.nav-tabs .nav-link.active::after {
    background-color: var(--primary-color, #F39200);
}
.nav-tabs .nav-link:hover:not(.active)::after {
    background-color: var(--text-tertiary, #9ca3af);
    width: 60%;
    left: 20%;
}

/* ── 9. Toast slide-in ─────────────────────────────────────── */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(80px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast {
    animation: toastSlideIn 0.35s ease-out;
}

/* ── 10. Success checkmark animado ─────────────────────────── */
@keyframes checkStroke {
    to { stroke-dashoffset: 0; }
}
@keyframes checkScale {
    0%   { transform: scale(0); opacity: 0; }
    50%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.success-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.success-check svg {
    animation: checkScale 0.4s ease-out both;
}
.success-check svg .check-path {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: checkStroke 0.3s ease-out 0.25s forwards;
}

/* ── 11. Accesibilidad: respetar reduced motion ────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Extras: hover lift en stat-cards ──────────────────────── */
.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* ── Extras: badge pulse para notificaciones ───────────────── */
@keyframes badgePulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.nav-badge:not(:empty) {
    animation: badgePulse 2s ease-in-out infinite;
}
