/* UI Enhancements - Fiacore 2025 */
/* Motion graphics, micro-interactions, glassmorphism */
/* Note: Color variables are centralized in css-variables.css */
/* Note: Core animations are centralized in core-animations.css */

/* ===== PAGE TRANSITIONS ===== */
.page-transition-enter {
    animation: pageSlideIn 0.3s ease forwards;
}

.page-transition-exit {
    animation: pageSlideOut 0.2s ease forwards;
}

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

@keyframes pageSlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

/* Apply to main content */
.main-container {
    animation: pageSlideIn 0.35s ease;
}

/* ===== BUTTON RIPPLE EFFECT ===== */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10);
    opacity: 0;
    transition: transform 0.5s, opacity 0.8s;
}

.btn-ripple:active::after {
    transform: scale(0);
    opacity: 1;
    transition: 0s;
}

/* Apply ripple to all primary buttons */
.btn-primary,
.btn-success,
.btn-warning,
.btn-danger,
.btn-info {
    position: relative;
    overflow: hidden;
}

/* ===== CARD HOVER EFFECTS ===== */
.card,
.analysis-card,
.dashboard-card,
.summary-card {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover,
.analysis-card:hover,
.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* ===== GLASSMORPHISM CARDS ===== */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.glass-card-subtle {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(59, 130, 246, 0.08);
    border-radius: 12px;
}

/* ===== SEMANTIC SUMMARY CARDS ===== */
.summary-card-income {
    background: linear-gradient(135deg, var(--color-income-bg) 0%, rgba(255, 255, 255, 0.95) 100%);
    border: 1px solid var(--color-income-border);
    border-left: 4px solid var(--color-income);
}

.summary-card-income .card-value,
.summary-card-income .amount {
    color: var(--color-income);
}

.summary-card-expense {
    background: linear-gradient(135deg, var(--color-expense-bg) 0%, rgba(255, 255, 255, 0.95) 100%);
    border: 1px solid var(--color-expense-border);
    border-left: 4px solid var(--color-expense);
}

.summary-card-expense .card-value,
.summary-card-expense .amount {
    color: var(--color-expense);
}

.summary-card-warning {
    background: linear-gradient(135deg, var(--color-warning-bg) 0%, rgba(255, 255, 255, 0.95) 100%);
    border: 1px solid var(--color-warning-border);
    border-left: 4px solid var(--color-warning);
}

.summary-card-warning .card-value,
.summary-card-warning .amount {
    color: var(--color-warning);
}

.summary-card-info,
.summary-card-neutral {
    background: linear-gradient(135deg, var(--color-info-bg) 0%, rgba(255, 255, 255, 0.95) 100%);
    border: 1px solid var(--color-info-border);
    border-left: 4px solid var(--color-info);
}

.summary-card-info .card-value,
.summary-card-neutral .card-value {
    color: var(--color-info);
}

/* ===== CHART ENHANCEMENTS ===== */
.chart-container {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.chart-container:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Animated chart loading */
.chart-loading {
    position: relative;
    overflow: hidden;
}

.chart-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.08), transparent);
    animation: shimmer 1.5s infinite;
}

/* shimmer animation defined in core-animations.css */

/* ===== TOOLTIP ENHANCEMENTS ===== */
.chartjs-tooltip,
.custom-tooltip {
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(8px);
    border-radius: 10px !important;
    box-shadow: var(--shadow-xl) !important;
    padding: 10px 14px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* ===== LOADING SKELETON IMPROVEMENTS ===== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

/* skeleton-shimmer = skeleton-loading in core-animations.css */

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-chart {
    height: 200px;
    border-radius: 12px;
}

.skeleton-card {
    height: 120px;
    border-radius: 12px;
}

/* ===== MICRO-INTERACTIONS ===== */
/* Icon bounce on hover */
.icon-bounce:hover i,
.icon-bounce:hover .fa {
    animation: iconBounce 0.4s ease;
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Pulse animation for alerts */
.pulse-alert {
    animation: pulseGlow 2s infinite;
}

/* pulseGlow defined in core-animations.css */

/* Success checkmark animation */
.success-check {
    animation: checkPop 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes checkPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ===== FOCUS STATES ===== */
input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ===== NUMBER ANIMATIONS ===== */
.animate-number {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== PROGRESS BAR ANIMATIONS ===== */
.progress-bar-animated {
    animation: progressFill 1s ease forwards;
}

/* progressFill defined in core-animations.css */

/* ===== SCROLL REVEAL ===== */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ===== DARK MODE SUPPORT ===== */
[data-theme="dark"] {
    --color-income-bg: rgba(16, 185, 129, 0.15);
    --color-expense-bg: rgba(248, 113, 113, 0.15);
    --color-warning-bg: rgba(245, 158, 11, 0.15);
    --color-info-bg: rgba(59, 130, 246, 0.15);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .glass-card {
    background: rgba(31, 41, 55, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4B5563 50%, #374151 75%);
    background-size: 200% 100%;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    .card:hover,
    .analysis-card:hover,
    .dashboard-card:hover {
        transform: none;
    }
    
    .chart-container:hover {
        transform: none;
    }
}

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