/* ===========================================
   Dashboard Animations - Professional & Modern
   Version 1.2 - Enhanced Skeleton Visibility
   Primary Color: #2C6FE2
   =========================================== */

/* =========================================== 
   CSS Variables
   =========================================== */
:root {
    --dash-primary: #2C6FE2;
    --dash-primary-light: #5B8FE8;
    --dash-primary-dark: #1E5BBE;
    --dash-primary-glow: rgba(44, 111, 226, 0.3);
    --dash-animation-timing: cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Enhanced silver/gray skeleton colors */
    --skeleton-shimmer-color: rgba(255, 255, 255, 0.8);
    --skeleton-bg-light: #c0c7d0;
    --skeleton-bg-light-alt: #d4dae3;
    --skeleton-bg-dark: #4a5568;
    --skeleton-bg-dark-alt: #5a6a7a;
}

/* =========================================== 
   Keyframe Animations
   =========================================== */

/* Card entrance with staggered fade-in and slide-up */
@keyframes dashCardEntrance {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Subtle pulse for active/home card */
@keyframes dashPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 var(--dash-primary-glow);
    }
    50% {
        box-shadow: 0 0 0 8px transparent;
    }
}

/* Icon bounce on hover */
@keyframes dashIconBounce {
    0%, 100% {
        transform: scale(1.05);
    }
    50% {
        transform: scale(1.15);
    }
}

/* Shimmer effect for cards */
@keyframes dashShimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Glow ring effect */
@keyframes dashGlowRing {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Float animation for icons */
@keyframes dashFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Grid container animation */
@keyframes dashGridFadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* =========================================== 
   Dashboard Grid Container
   =========================================== */

.grid.grid-cols-2 {
    animation: dashGridFadeIn 0.5s ease-out;
}

/* =========================================== 
   Dashboard Card - Enhanced Styles
   =========================================== */

.dashboard-card {
    position: relative;
    overflow: hidden;
    animation: dashCardEntrance 0.6s var(--dash-animation-timing) both;
    transition: all 0.4s var(--dash-animation-timing);
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(229, 231, 235, 0.8);
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.04),
        0 4px 6px rgba(0, 0, 0, 0.02);
}

/* Staggered entrance delays for cards */
.dashboard-card:nth-child(1) { animation-delay: 0.05s; }
.dashboard-card:nth-child(2) { animation-delay: 0.1s; }
.dashboard-card:nth-child(3) { animation-delay: 0.15s; }
.dashboard-card:nth-child(4) { animation-delay: 0.2s; }
.dashboard-card:nth-child(5) { animation-delay: 0.25s; }
.dashboard-card:nth-child(6) { animation-delay: 0.3s; }
.dashboard-card:nth-child(7) { animation-delay: 0.35s; }
.dashboard-card:nth-child(8) { animation-delay: 0.4s; }
.dashboard-card:nth-child(9) { animation-delay: 0.45s; }
.dashboard-card:nth-child(10) { animation-delay: 0.5s; }
.dashboard-card:nth-child(11) { animation-delay: 0.55s; }
.dashboard-card:nth-child(12) { animation-delay: 0.6s; }
.dashboard-card:nth-child(13) { animation-delay: 0.65s; }
.dashboard-card:nth-child(14) { animation-delay: 0.7s; }
.dashboard-card:nth-child(15) { animation-delay: 0.75s; }
.dashboard-card:nth-child(16) { animation-delay: 0.8s; }

/* Shine overlay effect */
.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.6s ease;
    z-index: 1;
    pointer-events: none;
}

/* Glow ring pseudo-element */
.dashboard-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid var(--dash-primary);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* =========================================== 
   Dashboard Card - Hover State
   =========================================== */

.dashboard-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 40px -10px var(--dash-primary-glow),
        0 10px 20px -5px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(44, 111, 226, 0.1);
    border-color: var(--dash-primary);
    background: linear-gradient(145deg, #ffffff 0%, #f0f7ff 100%);
}

.dashboard-card:hover::before {
    left: 100%;
}

.dashboard-card:hover::after {
    opacity: 0.2;
    animation: dashGlowRing 0.6s ease-out forwards;
}

/* =========================================== 
   Dashboard Card - Active/Pressed State
   =========================================== */

.dashboard-card:active {
    transform: translateY(-2px) scale(0.98);
    box-shadow: 
        0 5px 15px rgba(44, 111, 226, 0.2),
        0 2px 5px rgba(0, 0, 0, 0.05);
    transition-duration: 0.1s;
}

/* =========================================== 
   Dashboard Icon Animations
   =========================================== */

.dashboard-icon {
    position: relative;
    transition: transform 0.4s var(--dash-animation-timing);
    z-index: 2;
}

.dashboard-card:hover .dashboard-icon {
    animation: dashIconBounce 0.6s var(--dash-animation-timing);
}

/* =========================================== 
   Dashboard Label Animations
   =========================================== */

.dashboard-label {
    position: relative;
    transition: all 0.3s ease;
    z-index: 2;
}

.dashboard-card:hover .dashboard-label {
    color: var(--dash-primary) !important;
    transform: translateY(-2px);
}

/* =========================================== 
   Special Card - Home (First Card)
   =========================================== */

.dashboard-card:first-child {
    background: linear-gradient(145deg, #f0f7ff 0%, #e8f2ff 100%);
    border-color: rgba(44, 111, 226, 0.3);
}

.dashboard-card:first-child .dashboard-label {
    color: var(--dash-primary);
    font-weight: 700;
}

/* =========================================== 
   Special Card - Logout (Red Theme)
   =========================================== */

.dashboard-card:last-child:hover {
    border-color: #ef4444;
    background: linear-gradient(145deg, #ffffff 0%, #fef2f2 100%);
    box-shadow: 
        0 20px 40px -10px rgba(239, 68, 68, 0.3),
        0 10px 20px -5px rgba(0, 0, 0, 0.08);
}

.dashboard-card:last-child:hover .dashboard-label {
    color: #ef4444 !important;
}

.dashboard-card:last-child::after {
    border-color: #ef4444;
}

/* =========================================== 
   Dark Mode Support
   =========================================== */

.dark .dashboard-card,
[data-mode="dark"] .dashboard-card {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border-color: rgba(51, 65, 85, 0.8);
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.2),
        0 4px 6px rgba(0, 0, 0, 0.1);
}

.dark .dashboard-card:hover,
[data-mode="dark"] .dashboard-card:hover {
    background: linear-gradient(145deg, #1e3a5f 0%, #1e293b 100%);
    border-color: var(--dash-primary);
    box-shadow: 
        0 20px 40px -10px rgba(44, 111, 226, 0.4),
        0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

.dark .dashboard-card::before,
[data-mode="dark"] .dashboard-card::before {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
}

.dark .dashboard-label,
[data-mode="dark"] .dashboard-label {
    color: #e2e8f0;
}

.dark .dashboard-card:hover .dashboard-label,
[data-mode="dark"] .dashboard-card:hover .dashboard-label {
    color: var(--dash-primary-light) !important;
}

/* Dark mode - Home card */
.dark .dashboard-card:first-child,
[data-mode="dark"] .dashboard-card:first-child {
    background: linear-gradient(145deg, #1e3a5f 0%, #1e293b 100%);
    border-color: rgba(44, 111, 226, 0.4);
}

/* Dark mode - Logout card */
.dark .dashboard-card:last-child:hover,
[data-mode="dark"] .dashboard-card:last-child:hover {
    background: linear-gradient(145deg, #3b1a1a 0%, #1e293b 100%);
    border-color: #ef4444;
    box-shadow: 
        0 20px 40px -10px rgba(239, 68, 68, 0.4),
        0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

/* =========================================== 
   Focus States (Accessibility)
   =========================================== */

.dashboard-card:focus-visible {
    outline: none;
    box-shadow: 
        0 0 0 3px var(--dash-primary),
        0 0 0 6px rgba(44, 111, 226, 0.2);
}

/* =========================================== 
   Reduced Motion Support
   =========================================== */

@media (prefers-reduced-motion: reduce) {
    .dashboard-card {
        animation: none;
        transition: 
            box-shadow 0.2s ease,
            border-color 0.2s ease,
            background 0.2s ease;
    }
    
    .dashboard-card:hover {
        transform: none;
    }
    
    .dashboard-card::before {
        display: none;
    }
    
    .dashboard-icon {
        transition: none;
    }
    
    .dashboard-card:hover .dashboard-icon {
        animation: none;
        transform: none;
    }
}

/* =========================================== 
   Responsive Adjustments
   =========================================== */

@media (max-width: 640px) {
    .dashboard-card:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    /* Faster entrance on mobile */
    .dashboard-card:nth-child(n) {
        animation-delay: calc(0.03s * var(--index, 1));
    }
}

/* =========================================== 
   Loading State Enhancement
   =========================================== */

.dashboard-card.loading {
    pointer-events: none;
    background: linear-gradient(
        90deg,
        #f3f4f6 25%,
        #e5e7eb 50%,
        #f3f4f6 75%
    );
    background-size: 200% 100%;
    animation: dashShimmer 1.5s infinite;
}

.dark .dashboard-card.loading,
[data-mode="dark"] .dashboard-card.loading {
    background: linear-gradient(
        90deg,
        #1e293b 25%,
        #334155 50%,
        #1e293b 75%
    );
    background-size: 200% 100%;
}

/* ===========================================
   SKELETON LOADER - Unified Styles
   =========================================== */

/* Skeleton shimmer keyframe */
@keyframes skeletonShimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Skeleton pulse for subtle background animation */
@keyframes skeletonPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Skeleton fade in */
@keyframes skeletonFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.98);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Skeleton fade out to real content */
@keyframes skeletonFadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Dashboard skeleton container */
.dashboard-skeleton-fadein {
    animation: skeletonFadeIn 0.4s ease-out forwards;
}

/* =========================================== 
   Skeleton Card Styles
   =========================================== */

.dashboard-card-skeleton {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border-radius: 0.75rem;
    background: linear-gradient(145deg, #f5f7fa 0%, #e8ecf1 100%);
    border: 1px solid #c5cdd8;
    min-height: 140px;
    overflow: hidden;
    animation: skeletonFadeIn 0.5s ease-out both;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.06),
        0 4px 12px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Staggered entrance for skeleton cards */
.dashboard-card-skeleton:nth-child(1) { animation-delay: 0.02s; }
.dashboard-card-skeleton:nth-child(2) { animation-delay: 0.04s; }
.dashboard-card-skeleton:nth-child(3) { animation-delay: 0.06s; }
.dashboard-card-skeleton:nth-child(4) { animation-delay: 0.08s; }
.dashboard-card-skeleton:nth-child(5) { animation-delay: 0.1s; }
.dashboard-card-skeleton:nth-child(6) { animation-delay: 0.12s; }
.dashboard-card-skeleton:nth-child(7) { animation-delay: 0.14s; }
.dashboard-card-skeleton:nth-child(8) { animation-delay: 0.16s; }
.dashboard-card-skeleton:nth-child(9) { animation-delay: 0.18s; }
.dashboard-card-skeleton:nth-child(10) { animation-delay: 0.2s; }
.dashboard-card-skeleton:nth-child(11) { animation-delay: 0.22s; }
.dashboard-card-skeleton:nth-child(12) { animation-delay: 0.24s; }
.dashboard-card-skeleton:nth-child(13) { animation-delay: 0.26s; }
.dashboard-card-skeleton:nth-child(14) { animation-delay: 0.28s; }
.dashboard-card-skeleton:nth-child(15) { animation-delay: 0.3s; }
.dashboard-card-skeleton:nth-child(16) { animation-delay: 0.32s; }

/* Dark mode skeleton card */
.dark .dashboard-card-skeleton,
[data-mode="dark"] .dashboard-card-skeleton {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border-color: rgba(51, 65, 85, 0.8);
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.2),
        0 4px 6px rgba(0, 0, 0, 0.1);
}

/* =========================================== 
   Skeleton Content Elements
   =========================================== */

.dashboard-card-skeleton-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
}

/* Icon skeleton - Enhanced silver/metallic look */
.dashboard-icon-skeleton {
    display: block;
    width: 4rem;
    height: 4rem;
    border-radius: 0.75rem;
    flex-shrink: 0;
    background: linear-gradient(145deg, #b8c1cc 0%, #9aa5b3 100%);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3),
                inset 0 -2px 4px rgba(0, 0, 0, 0.1);
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.dark .dashboard-icon-skeleton,
[data-mode="dark"] .dashboard-icon-skeleton {
    background: linear-gradient(145deg, #5a6a7a 0%, #4a5568 100%);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.1),
                inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

/* Label skeleton - Enhanced silver/metallic look */
.dashboard-label-skeleton {
    display: block;
    height: 0.875rem;
    border-radius: 0.375rem;
    max-width: 140px;
    background: linear-gradient(90deg, #b8c1cc 0%, #a8b3c0 50%, #b8c1cc 100%);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3);
    animation: skeletonPulse 1.5s ease-in-out infinite;
    animation-delay: 0.2s;
}

.dark .dashboard-label-skeleton,
[data-mode="dark"] .dashboard-label-skeleton {
    background: linear-gradient(90deg, #5a6a7a 0%, #4a5568 50%, #5a6a7a 100%);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.05);
}

/* =========================================== 
   Shimmer Effect Overlay
   =========================================== */

.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--skeleton-shimmer-color) 50%,
        transparent 100%
    );
    animation: skeletonShimmer 1.8s ease-in-out infinite;
}

.dark .shimmer::after,
[data-mode="dark"] .shimmer::after {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.08) 50%,
        transparent 100%
    );
}

/* =========================================== 
   Skeleton Responsive Adjustments
   =========================================== */

@media (min-width: 640px) {
    .dashboard-card-skeleton {
        padding: 1.25rem;
        min-height: 160px;
    }
    
    .dashboard-icon-skeleton {
        width: 5rem;
        height: 5rem;
    }
    
    .dashboard-label-skeleton {
        height: 0.9375rem;
    }
}

@media (min-width: 768px) {
    .dashboard-card-skeleton {
        padding: 1.8rem;
        min-height: 180px;
    }
    
    .dashboard-icon-skeleton {
        width: 6rem;
        height: 6rem;
    }
    
    .dashboard-label-skeleton {
        height: 1rem;
    }
}

/* =========================================== 
   Reduced Motion - Skeleton
   =========================================== */

@media (prefers-reduced-motion: reduce) {
    .dashboard-card-skeleton {
        animation: none;
    }
    
    .dashboard-icon-skeleton,
    .dashboard-label-skeleton {
        animation: none;
    }
    
    .shimmer::after {
        animation: none;
        display: none;
    }
}