/* ========================================
   CSS Variables for Theming
   ======================================== */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --border: #475569;
    --shadow: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: #cbd5e1;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* ========================================
   Reset & Base Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* ========================================
   Header
   ======================================== */
.header {
    text-align: center;
    padding: 2rem 1rem;
    position: relative;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px var(--shadow);
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-stats {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-badge {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: transform 0.3s, background 0.3s;
}

.theme-toggle:hover {
    transform: scale(1.1);
    background: var(--bg-secondary);
}

/* ========================================
   Search Section
   ======================================== */
.search-section {
    margin-bottom: 2rem;
}

.search-input {
    width: 100%;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border 0.3s, box-shadow 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-chips {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.chip {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.875rem;
}

.chip:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ========================================
   Stats Grid
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    border: 2px solid var(--border);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px var(--shadow);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-active .stat-value { color: var(--info); }
.stat-blocked .stat-value { color: var(--warning); }
.stat-complete .stat-value { color: var(--success); }

/* ========================================
   Chart Container
   ======================================== */
.chart-container {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 2px solid var(--border);
}

.chart-container h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

#timelineChart {
    width: 100%;
    max-height: 250px;
}

/* ========================================
   Section
   ======================================== */
.section {
    margin-bottom: 2rem;
}

.section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* ========================================
   Projects Grid
   ======================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.project-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px var(--shadow);
    border-color: var(--accent);
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
}

.project-card.status-active::before { background: var(--info); }
.project-card.status-blocked::before { background: var(--warning); }
.project-card.status-complete::before { background: var(--success); }
.project-card.status-paused::before { background: var(--text-muted); }

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}

.project-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active { background: rgba(6, 182, 212, 0.2); color: var(--info); }
.status-blocked { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.status-complete { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.status-paused { background: rgba(148, 163, 184, 0.2); color: var(--text-muted); }

.project-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.project-blockers {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.blocker-badge {
    display: inline-block;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ========================================
   Activity Tabs
   ======================================== */
.activity-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.activity-list {
    list-style: none;
}

.activity-item {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s;
}

.activity-item:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}

.activity-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.activity-text {
    color: var(--text-primary);
    font-size: 0.9375rem;
}

/* ========================================
   Modal
   ======================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    position: relative;
    border: 2px solid var(--border);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ========================================
   Loading & Empty States
   ======================================== */
.loading-spinner {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 1.125rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* ========================================
   Responsive Design (Mobile First)
   ======================================== */
@media (max-width: 640px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .activity-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
}

@media (min-width: 768px) {
    .container {
        padding: 2rem;
    }
}
