/* ============================================================================
   Stats Change Indicators Styling
   تنسيقات مؤشرات تغيير الإحصائيات
   التاريخ: 4 أكتوبر 2025
   ============================================================================ */

/* Container for all change indicators */
.stat-change-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    animation: fadeInUp 0.5s ease-out;
}

/* Individual change badge */
.stat-change-indicator .change-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 11px;
    color: white;
    transition: all 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(5px);
}

.stat-change-indicator .change-badge:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Period label inside badge */
.stat-change-indicator .period-label {
    opacity: 0.8;
    font-weight: 500;
}

/* Change value with icon */
.stat-change-indicator .change-value {
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* Positive change (increase) */
.stat-change-indicator .change-badge.positive {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(5, 150, 105, 0.25) 100%);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.stat-change-indicator .change-badge.positive:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.35) 0%, rgba(5, 150, 105, 0.35) 100%);
}

.stat-change-indicator .change-badge.positive .change-value {
    color: #6ee7b7;
}

.stat-change-indicator .change-badge.positive .change-value::before {
    content: "↑";
    font-size: 14px;
    font-weight: 900;
    color: #10b981;
    margin-right: 2px;
}

/* Negative change (decrease) */
.stat-change-indicator .change-badge.negative {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(220, 38, 38, 0.25) 100%);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.stat-change-indicator .change-badge.negative:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.35) 0%, rgba(220, 38, 38, 0.35) 100%);
}

.stat-change-indicator .change-badge.negative .change-value {
    color: #fca5a5;
}

.stat-change-indicator .change-badge.negative .change-value::before {
    content: "↓";
    font-size: 14px;
    font-weight: 900;
    color: #ef4444;
    margin-right: 2px;
}

/* No change (neutral) */
.stat-change-indicator .change-badge.neutral {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.stat-change-indicator .change-badge.neutral:hover {
    background: rgba(255, 255, 255, 0.25);
}

.stat-change-indicator .change-badge.neutral .change-value {
    color: rgba(255, 255, 255, 0.9);
}

.stat-change-indicator .change-badge.neutral .change-value::before {
    content: "=";
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    margin-right: 2px;
}

/* Loading state */
.stat-change-indicator .change-badge.loading {
    opacity: 0.6;
    pointer-events: none;
}

.stat-change-indicator .change-badge.loading .change-value::after {
    content: "...";
    animation: loading-dots 1.5s infinite;
}

/* Percentage display */
.stat-change-indicator .change-percentage {
    font-size: 10px;
    opacity: 0.8;
    margin-left: 2px;
}

/* Tooltip for detailed info */
.stat-change-indicator .change-badge[data-tooltip] {
    position: relative;
}

.stat-change-indicator .change-badge[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

.stat-change-indicator .change-badge[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* Animation for fade in */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading dots animation */
@keyframes loading-dots {
    0%, 20% {
        content: ".";
    }
    40% {
        content: "..";
    }
    60%, 100% {
        content: "...";
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .stat-change-indicator {
        gap: 6px;
    }
    
    .stat-change-indicator .change-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .stat-change-indicator .change-value::before {
        font-size: 12px;
    }
}

/* Dark mode support */
body.dark-mode .stat-change-indicator .change-badge {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .stat-change-indicator .change-badge:hover {
    background: rgba(255, 255, 255, 0.15);
}

body.dark-mode .stat-change-indicator .change-badge.positive {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.2) 100%);
}

body.dark-mode .stat-change-indicator .change-badge.negative {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.2) 100%);
}

/* Special styling for different periods */
.stat-change-indicator .change-badge[data-period="daily"] {
    border-left: 3px solid rgba(59, 130, 246, 0.5);
}

.stat-change-indicator .change-badge[data-period="weekly"] {
    border-left: 3px solid rgba(168, 85, 247, 0.5);
}

.stat-change-indicator .change-badge[data-period="monthly"] {
    border-left: 3px solid rgba(251, 146, 60, 0.5);
}

.stat-change-indicator .change-badge[data-period="yearly"] {
    border-left: 3px solid rgba(236, 72, 153, 0.5);
}

/* Pulse animation for significant changes */
.stat-change-indicator .change-badge.significant {
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
    }
}

/* Compact mode for smaller cards */
.stat-change-indicator.compact {
    gap: 4px;
}

.stat-change-indicator.compact .change-badge {
    padding: 2px 6px;
    font-size: 10px;
}

.stat-change-indicator.compact .change-value::before {
    font-size: 11px;
}

/* ============================================================================
   Sparkline Charts Styling
   تنسيقات الرسوم البيانية المدمجة
   ============================================================================ */

/* Sparkline container */
.stat-sparkline-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    height: 60px;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.stat-sparkline-container:hover {
    opacity: 1;
}

/* Canvas element */
.stat-sparkline {
    display: block;
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: filter 0.3s ease;
}

.stat-sparkline:hover {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

/* Responsive - Hide sparklines on mobile */
@media (max-width: 768px) {
    .stat-sparkline-container {
        display: none;
    }
}

/* Dark mode adjustments for sparklines */
body.dark-mode .stat-sparkline {
    filter: drop-shadow(0 2px 6px rgba(255, 255, 255, 0.1));
}

body.dark-mode .stat-sparkline:hover {
    filter: drop-shadow(0 4px 10px rgba(255, 255, 255, 0.2));
}

