/**
 * أنماط تصور البيانات
 * Charts & Data Visualization Styles
 */

/* ========================================
   Progress Ring
   ======================================== */

.progress-ring-container {
    position: relative;
    display: inline-block;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.progress-ring-value-text {
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.progress-ring-label-text {
    font-size: 12px;
    color: #64748b;
}

/* ========================================
   Bar Chart
   ======================================== */

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 8px;
    padding-bottom: 30px;
    position: relative;
}

.bar-chart-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.bar-chart-bar {
    width: 100%;
    max-width: 40px;
    border-radius: 8px 8px 0 0;
    position: relative;
    transition: height 1s ease;
}

.bar-chart-value {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.bar-chart-label {
    position: absolute;
    bottom: 0;
    font-size: 11px;
    color: #64748b;
    text-align: center;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   Donut Chart
   ======================================== */

.donut-chart-wrapper {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.donut-chart {
    position: relative;
}

.donut-chart-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.donut-chart-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #94a3b8;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-label {
    flex: 1;
}

.legend-value {
    font-weight: 600;
    color: white;
}

/* ========================================
   Sparkline
   ======================================== */

.sparkline-container {
    display: inline-block;
    vertical-align: middle;
}

.sparkline {
    display: block;
}

/* ========================================
   Stat Cards with Charts
   ======================================== */

.stat-card-chart {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-card-info h4 {
    font-size: 28px;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.stat-card-info p {
    font-size: 14px;
    color: #64748b;
}

.stat-card-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    margin-top: 8px;
}

.stat-card-trend.up {
    color: #10b981;
}

.stat-card-trend.down {
    color: #ef4444;
}

/* ========================================
   Animated Count
   ======================================== */

[data-animate-count] {
    transition: opacity 0.3s ease;
}

/* ========================================
   Real-time Indicator
   ======================================== */

.realtime-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #10b981;
}

.realtime-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* ========================================
   Data Grid
   ======================================== */

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.data-grid-item {
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.data-grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.2);
}

.data-grid-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
}

.data-grid-value {
    font-size: 28px;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.data-grid-label {
    font-size: 14px;
    color: #64748b;
}

/* ========================================
   Chart Container
   ======================================== */

.chart-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 24px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.chart-actions {
    display: flex;
    gap: 8px;
}

.chart-action-btn {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-action-btn:hover,
.chart-action-btn.active {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    color: white;
}
