/* CSS Animations and Transitions for Enhanced Interactivity */

/* Smooth transitions for all interactive elements */
* {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Disable transitions for table content to prevent animation on page changes */
td,
th,
tbody,
tr {
    transition: none !important;
}

/* Loading animation */
@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes countUp {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.stat-card {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: calc(var(--card-index, 0) * 0.1s);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.15),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.chart-card:hover,
.table-card:hover {
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.15),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.stat-value {
    animation: countUp 1s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.theme-toggle {
    transform: scale(1);
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle:active {
    transform: scale(0.95);
}

input[type='text'],
input[type='date'],
select {
    transform: scale(1);
    border-width: 1px;
}

input[type='text']:focus,
input[type='date']:focus,
select:focus {
    transform: scale(1.02);
    border-width: 2px;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.section-content {
    transition:
        max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease-in-out,
        transform 0.3s ease-in-out,
        overflow 0s ease 0.3s;
}

.section-content.collapsed {
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
    transition:
        max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease-in-out,
        transform 0.3s ease-in-out,
        overflow 0s ease 0s;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

.container {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.chart-container canvas {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: 0.2s;
}

.tooltip {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition:
        opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tooltip.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

[onclick],
button,
.section-header {
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[onclick]:active,
button:active {
    transform: scale(0.98);
}

.copy-button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.copy-button:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.copy-button:active {
    transform: scale(0.95);
}

/* Accessibility: respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
