/**
 * Stats Dashboard Styles
 * Modern dark theme with glassmorphism effects
 */

:root {
    --stats-bg: #0f1419;
    --stats-surface: #1a1f2e;
    --stats-surface-light: #252b3b;
    --stats-border: #2d3548;
    --stats-text: #e5e7eb;
    --stats-text-dim: #9ca3af;
    --stats-accent: #3b82f6;
    --stats-accent-glow: rgba(59, 130, 246, 0.3);
    --stats-success: #10b981;
    --stats-danger: #ef4444;
    --stats-warning: #f59e0b;
    --stats-neutral: #6b7280;
    --stats-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stats-dashboard {
    background: var(--stats-bg);
    min-height: 100vh;
    padding-bottom: 4rem;
}

/* Header */
.stats-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-bottom: 1px solid var(--stats-border);
    padding: 3rem 0 2rem;
    margin-bottom: 3rem;
}

.stats-title {
    color: var(--stats-text);
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stats-title .icon {
    font-size: 3rem;
}

.stats-subtitle {
    color: var(--stats-text-dim);
    font-size: 1.125rem;
    margin: 0 0 1.5rem 0;
}

.stats-update-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--stats-text-dim);
    font-size: 0.875rem;
}

.update-icon {
    animation: spin 3s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.auto-refresh-note {
    opacity: 0.7;
}

/* Grid Layout */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* Stat Cards */
.stat-card {
    background: var(--stats-surface);
    border: 1px solid var(--stats-border);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stats-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--stats-accent);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.2);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    font-size: 3rem;
    line-height: 1;
}

.stat-content {
    flex: 1;
}

.stat-label {
    color: var(--stats-text-dim);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value {
    color: var(--stats-text);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-sublabel {
    color: var(--stats-text-dim);
    font-size: 0.875rem;
}

/* Highlight Card */
.highlight-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-color: var(--stats-accent);
}

.highlight-card .stat-value {
    background: var(--stats-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Pulse Animation */
.pulse-card {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
    50% { box-shadow: 0 0 20px 5px rgba(59, 130, 246, 0.3); }
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.chart-card {
    background: var(--stats-surface);
    border: 1px solid var(--stats-border);
    border-radius: 1rem;
    padding: 1.5rem;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-header {
    margin-bottom: 1.5rem;
}

.chart-header h2 {
    color: var(--stats-text);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.chart-container {
    position: relative;
    height: 300px;
}

.chart-card.full-width .chart-container {
    height: 400px;
}

/* Category Legend */
.category-legend {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legend-color {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    flex-shrink: 0;
}

.legend-label {
    color: var(--stats-text);
    flex: 1;
}

.legend-value {
    color: var(--stats-text-dim);
    font-weight: 600;
}

/* Country List */
.country-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.country-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--stats-surface-light);
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.country-item:hover {
    background: var(--stats-border);
    transform: translateX(4px);
}

.country-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--stats-text);
    font-weight: 500;
}

.country-flag {
    font-size: 1.25rem;
}

.country-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.country-count {
    color: var(--stats-text);
    font-weight: 600;
}

.country-percentage {
    color: var(--stats-text-dim);
    font-size: 0.875rem;
}

/* Table Card */
.table-card {
    background: var(--stats-surface);
    border: 1px solid var(--stats-border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.table-header {
    margin-bottom: 1.5rem;
}

.table-header h2 {
    color: var(--stats-text);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.table-container {
    overflow-x: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table thead {
    border-bottom: 2px solid var(--stats-border);
}

.stats-table th {
    color: var(--stats-text-dim);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    text-align: left;
}

.stats-table tbody tr {
    border-bottom: 1px solid var(--stats-border);
    transition: background 0.2s ease;
}

.stats-table tbody tr:hover {
    background: var(--stats-surface-light);
}

.stats-table td {
    color: var(--stats-text);
    padding: 1rem;
}

.stats-table td.text-right {
    text-align: right;
}

.domain-link {
    color: var(--stats-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.domain-link:hover {
    color: #60a5fa;
    text-decoration: underline;
}

/* Category Badges */
.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.category-badge.category-good {
    background: rgba(16, 185, 129, 0.1);
    color: var(--stats-success);
}

.category-badge.category-disposable {
    background: rgba(239, 68, 68, 0.1);
    color: var(--stats-danger);
}

.category-badge.category-suspicious {
    background: rgba(245, 158, 11, 0.1);
    color: var(--stats-warning);
}

.category-badge.category-unsure {
    background: rgba(107, 114, 128, 0.1);
    color: var(--stats-neutral);
}

/* Activity Feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--stats-surface-light);
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.activity-item:hover {
    background: var(--stats-border);
}

.activity-icon {
    flex-shrink: 0;
}

.status-icon {
    font-size: 1.25rem;
}

.activity-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.activity-domain {
    color: var(--stats-accent);
    text-decoration: none;
    font-weight: 500;
}

.activity-domain:hover {
    text-decoration: underline;
}

.activity-separator {
    color: var(--stats-text-dim);
}

.activity-category {
    color: var(--stats-text);
    font-weight: 500;
}

.activity-time {
    color: var(--stats-text-dim);
    font-size: 0.875rem;
    white-space: nowrap;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--stats-text-dim);
}

.empty-state p {
    margin: 0;
    font-size: 1.125rem;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-title {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 2rem;
    }

    .chart-container {
        height: 250px;
    }

    .chart-card.full-width .chart-container {
        height: 300px;
    }
}

/* Dark scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--stats-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--stats-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--stats-text-dim);
}
