:root {
    --bg-base: #0F172A; /* Slate 900 */
    --bg-surface: #1E293B; /* Slate 800 */
    --bg-surface-hover: #334155; /* Slate 700 */
    --border: #334155;
    
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    
    --primary: #22C55E; /* Emerald 500 - GitHub inspired */
    --primary-hover: #16A34A; /* Emerald 600 */
    --primary-light: rgba(34, 197, 94, 0.1);
    
    --danger: #EF4444;
    --danger-hover: #DC2626;

    /* Contribution Types */
    --color-pr: #A855F7; /* Purple */
    --color-issue: #EAB308; /* Yellow */
    --color-review: #3B82F6; /* Blue */
    --color-docs: #EC4899; /* Pink */
    --color-mentorship: #14B8A6; /* Teal */

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { background-color: var(--bg-base); color: var(--text-main); font-family: var(--font-sans); height: 100vh; overflow: hidden; }

/* Utilities */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.text-danger { color: var(--danger); }
.font-mono { font-family: var(--font-mono); }
.w-full { width: 100%; }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.justify-left { justify-content: flex-start !important; }

/* Layout */
.app-layout { display: flex; height: 100vh; }

/* Sidebar */
.sidebar {
    width: 260px; background-color: var(--bg-surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 1.5rem 1rem; z-index: 10;
}
.sidebar-header { display: flex; align-items: center; gap: 0.75rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem;}
.logo-icon { color: var(--primary); }
.sidebar-header h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.5px;}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.5rem; flex-grow: 1;}
.nav-btn {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem;
    background: transparent; border: none; border-radius: var(--radius-sm);
    color: var(--text-muted); font-family: var(--font-sans); font-size: 0.95rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s; text-align: left;
}
.nav-btn:hover { background-color: var(--bg-surface-hover); color: var(--text-main); }
.nav-btn.active { background-color: var(--primary-light); color: var(--primary); font-weight: 600;}
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 1.5rem; }

/* Main Content */
.main-content { flex-grow: 1; overflow-y: auto; background-color: var(--bg-base); position: relative; }
.view-section { display: none; padding: 2.5rem; max-width: 1000px; margin: 0 auto; animation: fadeIn 0.3s ease; }
.view-section.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.section-header { margin-bottom: 2.5rem; }
.section-header h1 { font-size: 2rem; font-weight: 800; letter-spacing: -1px; margin-bottom: 0.5rem;}

/* Cards & Forms */
.card { background-color: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.5rem; }
.form-card { display: flex; flex-direction: column; gap: 1.5rem; }
.form-row { display: flex; gap: 1.5rem; }

.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { font-size: 0.875rem; font-weight: 600; color: var(--text-muted); }
input, select, textarea {
    background-color: var(--bg-base); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0.75rem 1rem; color: var(--text-main); font-family: var(--font-sans); width: 100%; transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { resize: vertical; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.75rem 1.25rem; border: none; border-radius: var(--radius-sm);
    font-family: var(--font-sans); font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-primary { background-color: var(--primary); color: #000; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-secondary { background-color: var(--bg-surface-hover); color: var(--text-main); }
.btn-secondary:hover { background-color: var(--border); }
.btn-danger { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background-color: var(--danger); color: #fff; }
.btn-group-vertical { display: flex; flex-direction: column; gap: 0.75rem; }

/* Dashboard UI */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 2.5rem; }
.stat-card { background-color: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.stat-value { font-size: 2.5rem; font-weight: 800; color: var(--primary); font-family: var(--font-mono); line-height: 1;}
.stat-label { font-size: 0.875rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 1px;}

.heatmap-section { background-color: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.5rem; margin-bottom: 2.5rem;}
.heatmap-section h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.heatmap-container { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 0.5rem; }
.heatmap-col { display: flex; flex-direction: column; gap: 4px; }
.heatmap-cell { width: 14px; height: 14px; border-radius: 3px; background-color: var(--bg-base); border: 1px solid rgba(255,255,255,0.05); }
.heatmap-cell[data-level="1"] { background-color: rgba(34, 197, 94, 0.3); }
.heatmap-cell[data-level="2"] { background-color: rgba(34, 197, 94, 0.6); }
.heatmap-cell[data-level="3"] { background-color: rgba(34, 197, 94, 0.9); }
.heatmap-cell[data-level="4"] { background-color: #22C55E; box-shadow: 0 0 5px rgba(34,197,94,0.5); }

.dashboard-bottom { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.recent-contributions, .achievements-card { background-color: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem;}

/* Lists */
.contribution-list { display: flex; flex-direction: column; gap: 1rem; }
.contribution-item {
    background-color: var(--bg-base); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 1rem; display: flex; gap: 1rem; align-items: flex-start; transition: transform 0.2s, border-color 0.2s;
}
.contribution-item:hover { transform: translateX(5px); border-color: var(--primary-light); }
.full-list .contribution-item { background-color: var(--bg-surface); }
.c-type-icon {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.c-content { flex-grow: 1; display: flex; flex-direction: column; gap: 0.25rem; }
.c-header { display: flex; gap: 1rem; align-items: center; margin-bottom: 0.25rem; }
.c-repo { font-weight: 600; color: var(--primary); }
.c-title { font-size: 1rem; font-weight: 600; color: var(--text-main); }
.c-desc { line-height: 1.5; }
.c-actions { display: flex; gap: 0.5rem; }
.btn-icon {
    background: transparent; border: none; color: var(--text-muted); cursor: pointer;
    padding: 0.5rem; border-radius: var(--radius-sm); transition: all 0.2s; text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background-color: var(--bg-surface-hover); color: var(--text-main); }
.c-delete:hover { background-color: rgba(239,68,68,0.1); color: var(--danger); }

/* Badges / Achievements */
.achievements-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 1rem; }
.badge-item {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.5rem;
    opacity: 0.4; filter: grayscale(1); transition: all 0.3s;
}
.badge-item.unlocked { opacity: 1; filter: grayscale(0); transform: translateY(-3px); }
.badge-icon {
    width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--bg-surface-hover), var(--border));
    border: 2px solid var(--border);
}
.badge-item.unlocked .badge-icon {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border-color: var(--primary-light); color: #000; box-shadow: 0 0 15px rgba(34,197,94,0.3);
}
.badge-title { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.badge-item.unlocked .badge-title { color: var(--text-main); }

/* Filters */
.filters { display: flex; gap: 1rem; }
.filter-select { padding: 0.5rem 2rem 0.5rem 1rem; width: auto; background-color: var(--bg-surface); }

/* Settings View specific */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 1.5rem; }

/* Responsive */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; padding: 1rem; border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; align-items: center; justify-content: space-between;}
    .sidebar-header { padding-bottom: 0; border-bottom: none; margin-bottom: 0; }
    .sidebar-nav { flex-direction: row; overflow-x: auto; margin-left: 1rem; }
    .nav-btn { white-space: nowrap; padding: 0.5rem; }
    .nav-btn span { display: none; } /* hide text on mobile */
    .sidebar-footer { display: none; }
    
    .view-section { padding: 1.5rem; }
    .dashboard-bottom { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
    .section-header.flex-between { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .filters { width: 100%; }
    .filter-select { flex-grow: 1; }
}
