/* ============================================
   SIMPLIFIED MODERN GLASSMORPHIC DASHBOARD
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================
   RESET & ROOT VARIABLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Gradients */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);

    /* Glass Effects */
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);

    /* Background Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;

    /* Text Colors */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* ============================================
   BASE STYLES
   ============================================ */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Static background gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at top, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(118, 75, 162, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    position: relative;
    z-index: 1;
}

/* ============================================
   GLASSMORPHIC CARD
   ============================================ */

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* ============================================
   HEADER
   ============================================ */

.header {
    background: var(--primary-gradient);
    padding: 32px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
}

.header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.header-info {
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 500;
}

/* ============================================
   SECTIONS
   ============================================ */

.section {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

.section:hover {
    transform: translateY(-2px);
}

.section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    font-weight: 700;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   STATUS SECTION
   ============================================ */

.status-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.status-indicator:hover {
    background: rgba(255, 255, 255, 0.08);
}

.status-light {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.status-light.stopped {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

.status-light.running {
    background: var(--success-gradient);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.status-light.stopping {
    background: var(--warning-gradient);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.status-light.error {
    background: var(--danger-gradient);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.status-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #f1f5f9, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   BUTTONS
   ============================================ */

.control-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-success {
    background: var(--success-gradient);
    color: white;
}

.btn-warning {
    background: var(--warning-gradient);
    color: white;
}

.btn-danger {
    background: var(--danger-gradient);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    color: white;
}

/* ============================================
   CONFIGURATION SECTION
   ============================================ */

.config-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.config-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.config-group {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-group.full-width {
    flex: 100%;
}

.config-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.config-group input,
.config-group select {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.config-group input:focus,
.config-group select:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.full-width-input {
    width: 100%;
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.config-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

/* ============================================
   SOURCE PRIORITY LIST
   ============================================ */

.source-priority-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    min-height: 200px;
}

.priority-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    cursor: move;
    transition: all 0.3s ease;
}

.priority-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateX(4px);
}

.priority-item.dragging {
    opacity: 0.5;
}

.priority-handle {
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: grab;
}

.priority-handle:active {
    cursor: grabbing;
}

.priority-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
}

.priority-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.priority-label {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.priority-input {
    width: 70px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
}

.priority-input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

/* ============================================
   STATISTICS
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 255, 255, 0.25);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-success { color: #10b981; }
.stat-warning { color: #f59e0b; }
.stat-danger { color: #ef4444; }
.stat-info { color: #3b82f6; }
.stat-muted { color: #94a3b8; }

/* ============================================
   DISTRIBUTION SECTION
   ============================================ */

.distribution-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.distribution-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 6px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

.distribution-content {
    position: relative;
    min-height: 250px;
}

.distribution-chart {
    display: none;
}

.distribution-chart.active {
    display: block;
}

.distribution-bar-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.distribution-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.distribution-bar-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.distribution-source-label {
    min-width: 130px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.distribution-bar-wrapper {
    flex: 1;
    height: 32px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.distribution-bar-fill {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.8s ease;
    display: flex;
    align-items: center;
    padding-left: 12px;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
}

.distribution-count {
    min-width: 80px;
    text-align: right;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
}

.distribution-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ============================================
   PROGRESS BAR
   ============================================ */

.progress-container {
    margin: 24px 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 36px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.progress-fill {
    height: 100%;
    background: var(--success-gradient);
    transition: width 0.8s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
}

/* ============================================
   SESSION STATS
   ============================================ */

.session-stats {
    margin-top: 24px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.session-stats h3 {
    margin-bottom: 16px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.session-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.session-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.session-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.session-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.session-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* ============================================
   CACHE SECTION
   ============================================ */

.cache-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cache-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 14px;
}

.cache-stat {
    display: flex;
    justify-content: space-between;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.cache-stat:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.cache-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.cache-value {
    font-weight: 700;
    color: #667eea;
    font-size: 1.05rem;
}

.cache-actions {
    display: flex;
    gap: 12px;
}

/* ============================================
   ACTIVITY LOG
   ============================================ */

.log-container {
    max-height: 400px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 16px;
    font-family: 'Courier New', monospace;
}

.log-entry {
    padding: 10px 14px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid #667eea;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.log-entry:hover {
    background: rgba(255, 255, 255, 0.06);
}

.log-time {
    color: #667eea;
    margin-right: 10px;
    font-weight: 700;
}

.log-message {
    color: var(--text-secondary);
}

/* Custom Scrollbar */
.log-container::-webkit-scrollbar {
    width: 8px;
}

.log-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#footerStatus {
    color: #10b981;
    font-weight: 700;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .status-container {
        flex-direction: column;
        align-items: stretch;
    }

    .config-row {
        flex-direction: column;
    }

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

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

/* ============================================
   UTILITY CLASSES
   ============================================ */

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ADD THIS TO YOUR style.css */

/* Category breakdown styling */
.cache-stat.full-width {
    grid-column: 1 / -1;
}

.category-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.category-badge {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.text-muted {
    color: #6c757d;
    font-style: italic;
}

/* Category breakdown styling */
.cache-stat.full-width {
    grid-column: 1 / -1;
}

.category-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.category-badge {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: help;
    transition: transform 0.2s ease;
    white-space: nowrap;
}

.category-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.text-muted {
    color: #6c757d;
    font-style: italic;
    font-size: 13px;
}

/* Different colors for different categories */
.category-badge:nth-child(1) { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.category-badge:nth-child(2) { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.category-badge:nth-child(3) { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.category-badge:nth-child(4) { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.category-badge:nth-child(5) { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.category-badge:nth-child(6) { background: linear-gradient(135deg, #30cfd0 0%, #330867 100%); }