/* Animations
   Animations and micro-interactions */

/* =====================================================
   PROFESSIONAL ANIMATIONS & MICRO-INTERACTIONS
   ===================================================== */

/* ── Core Keyframes ── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position:  600px 0; }
}

/* ── Page Content Entrance ──
   Driven by the 'page-animate-in' class added via JS on every navigation
   (see window.animatePageEnter in main.js) */
.content-body > *.page-animate-in {
    animation: fadeInUp 0.22s ease-out both;
}

/* ── Card Hover Lift ── */
.card {
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Stat / dashboard cards get a slightly stronger lift */
.stat-card {
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.stat-card:hover {
    box-shadow: 0 8px 20px rgba(var(--primary-color-rgb), 0.12);
    transform: translateY(-3px);
}

/* ── Button Hover Lift ── */
.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled),
.btn-danger:hover:not(:disabled),
.btn-warning:hover:not(:disabled),
.btn-dark:hover:not(:disabled),
.btn-info:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(0) !important;
}

/* ── Header Button Hover Lift ── */
.hdr-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* ── Nav Link – Animated Active Indicator ── */
.sidebar .nav-link:not(.active)::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--secondary-color);
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.2s ease;
    border-radius: 0 2px 2px 0;
}

html[dir="rtl"] .sidebar .nav-link:not(.active)::before {
    left: auto;
    right: 0;
    border-radius: 2px 0 0 2px;
}

.sidebar .nav-link:hover::before {
    transform: scaleY(1);
}

/* ── Nav Dropdown Chevron Rotation ── */
.nav-dropdown-icon i {
    transition: transform 0.25s ease;
    display: inline-block;
}

.nav-dropdown.open .nav-dropdown-icon i {
    transform: rotate(180deg);
}

/* ── Table Row – Accent Border on Hover ── */
.table tbody tr:hover {
    box-shadow: inset 3px 0 0 var(--primary-color);
}

.list-page-table-wrapper .table tbody tr:hover {
    box-shadow: inset 3px 0 0 var(--primary-color);
}

html[dir="rtl"] .table tbody tr:hover,
html[dir="rtl"] .list-page-table-wrapper .table tbody tr:hover {
    box-shadow: inset -3px 0 0 var(--primary-color);
}

/* ── Skeleton Loading Shimmer ── */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: var(--border-radius-sm);
    color: transparent !important;
}

.skeleton-text {
    height: 0.875rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.skeleton-text:last-child { width: 65%; }

.skeleton-circle {
    border-radius: 50%;
}

/* ── Loading Overlay Entrance ── */
.loading-overlay {
    animation: fadeIn 0.18s ease-out;
}

/* ── Dropdown Panel Entrance (background-jobs, etc.) ── */
.background-jobs-panel {
    animation: slideDownFade 0.2s ease-out;
}

/* ── Tab Pane Entrance ── */
.tab-pane.show.active {
    animation: fadeInUp 0.2s ease-out both;
}

/* ── Empty State / No-data Entrance ── */
.empty-state,
.list-page-empty {
    animation: fadeInUp 0.3s ease-out both;
    animation-delay: 0.08s;
}

/* ── Alert Entrance ── */
.alert {
    animation: fadeInUp 0.25s ease-out both;
}

/* ── Pagination Button Lift ── */
.page-link {
    transition: all var(--transition-fast);
}

.page-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* ── Sidebar Toggle Icon Rotation ──
   The chevron icon rotates when the sidebar collapses/expands */
.sidebar-toggle-btn i {
    transition: transform 0.3s ease;
    display: inline-block;
}

/* collapsed state: chevron flips */
html:not([dir="rtl"]) .sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

html[dir="rtl"] .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

html[dir="rtl"] .sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(0deg);
}

/* ── Accessibility: Honour "reduce motion" preference ── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
