/* Dashboard Enhancements - Better UX, Performance, and Analytics */

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

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    min-height: 150px;
    padding: 20px;
}

.skeleton-text {
    height: 20px;
    margin-bottom: 10px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-title {
    height: 30px;
    width: 40%;
    margin-bottom: 15px;
}

.skeleton-chart {
    height: 300px;
    margin-top: 20px;
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 4px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Stat Cards Enhancements */
.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #3498db, #2980b9);
}

.stat-card.revenue::before { background: linear-gradient(180deg, #27ae60, #229954); }
.stat-card.subs::before { background: linear-gradient(180deg, #3498db, #2980b9); }
.stat-card.unSubs::before { background: linear-gradient(180deg, #e74c3c, #c0392b); }
.stat-card.subRev::before { background: linear-gradient(180deg, #f39c12, #e67e22); }
.stat-card.renRev::before { background: linear-gradient(180deg, #9b59b6, #8e44ad); }
.stat-card.churnRate::before { background: linear-gradient(180deg, #e74c3c, #c0392b); }
.stat-card.conversionRate::before { background: linear-gradient(180deg, #1abc9c, #16a085); }

/* Metric Value Animations */
.metric-value {
    transition: all 0.3s ease;
}

.metric-value.updating {
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Percentage Badge */
.percentage-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.percentage-badge.positive {
    background: #d4edda;
    color: #155724;
}

.percentage-badge.negative {
    background: #f8d7da;
    color: #721c24;
}

.percentage-badge.neutral {
    background: #e2e3e5;
    color: #383d41;
}

/* Filter Section Enhancements */
.filter-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-group {
    position: relative;
}

.filter-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    display: block;
    font-size: 13px;
}

.filter-input {
    transition: all 0.2s ease;
    border: 1px solid #dee2e6;
}

.filter-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* Refresh Indicator */
.refresh-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
    font-size: 12px;
}

.refresh-indicator.active {
    color: #3498db;
}

.refresh-indicator.active .refresh-icon {
    animation: spin 1s linear infinite;
}

.refresh-icon {
    width: 14px;
    height: 14px;
}

/* Chart Container */
.chart-container {
    position: relative;
    min-height: 300px;
}

.chart-container.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Table Enhancements */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background: #f8f9fa;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.success {
    background: #d4edda;
    color: #155724;
}

.status-badge.danger {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.warning {
    background: #fff3cd;
    color: #856404;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #495057;
}

.empty-state-text {
    font-size: 14px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    min-width: 300px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Performance Optimizations */
.will-change-transform {
    will-change: transform;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .filter-section {
        padding: 15px;
    }
    
    .stat-card {
        margin-bottom: 20px;
    }
    
    .chart-container {
        min-height: 250px;
    }
}

/* Print Styles */
@media print {
    .filter-section,
    .refresh-indicator,
    .btn {
        display: none;
    }
    
    .stat-card {
        break-inside: avoid;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .skeleton-loader {
        background: linear-gradient(90deg, #2c3e50 25%, #34495e 50%, #2c3e50 75%);
        background-size: 200% 100%;
    }
}

