:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}

* { box-sizing: border-box; outline: none; }

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: #0f172a;
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: fixed;
    height: 100vh;
    right: 0;
    z-index: 100;
}

.brand { font-size: 1.5rem; font-weight: 800; margin-bottom: 40px; color: #38bdf8; display: flex; align-items: center; gap: 10px; }
.nav-item { padding: 12px 15px; margin-bottom: 8px; border-radius: 8px; cursor: pointer; color: #94a3b8; display: flex; align-items: center; gap: 10px; transition: 0.3s; }
.nav-item.active, .nav-item:hover { background: rgba(255,255,255,0.1); color: white; }

/* Main Content */
.main-content { margin-right: 260px; flex: 1; padding: 30px; width: calc(100% - 260px); }

/* Components */
.header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.page-title h2 { margin: 0; }
.page-title p { margin: 5px 0 0; color: var(--text-muted); }

.btn-export {
    background: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-family: inherit; font-weight: bold; transition: 0.3s;
}
.btn-export:hover { background: var(--primary-dark); }

/* Grid & Cards */
.dashboard-grid { display: grid; grid-template-columns: 350px 1fr; gap: 25px; }
.card { background: var(--bg-card); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 25px; }
.card-header { border-bottom: 1px solid var(--border); padding-bottom: 15px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }

/* Stats */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 25px; }
.stat-box { background: var(--bg-card); padding: 20px; border-radius: 12px; border: 1px solid var(--border); display: flex; align-items: center; gap: 15px; }
.icon-box { width: 45px; height: 45px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.icon-blue { background: #eff6ff; color: var(--primary); }
.icon-green { background: #ecfdf5; color: #10b981; }
.icon-purple { background: #f5f3ff; color: #8b5cf6; }
.stat-info p { margin: 5px 0 0; font-size: 1.4rem; font-weight: 700; }
.value-badge { background: #eff6ff; color: var(--primary); padding: 2px 8px; border-radius: 6px; font-weight: 700; font-size: 0.9rem; }

/* Inputs */
.control-group { margin-bottom: 20px; }
.label-row { display: flex; justify-content: space-between; margin-bottom: 10px; font-weight: 500; }
input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 20px; width: 20px; border-radius: 50%; background: var(--primary); cursor: pointer; margin-top: -8px; box-shadow: 0 2px 6px rgba(37,99,235,0.4); border: 2px solid white; }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 6px; cursor: pointer; background: #e2e8f0; border-radius: 10px; }

/* Goals List */
.goal-item { background: #f8fafc; padding: 12px; margin-bottom: 8px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; border: 1px solid #e2e8f0; animation: fadeIn 0.3s ease; }
.delete-goal { color: #ef4444; cursor: pointer; background: none; border: none; padding: 5px; font-size: 1rem; }

/* Navigation Logic */
.view-section { display: none; animation: fadeIn 0.4s ease; }
.view-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Chart Area */
.chart-wrapper { position: relative; height: 350px; width: 100%; }

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .sidebar { width: 70px; padding: 20px 10px; }
    .sidebar span, .brand span { display: none; }
    .main-content { margin-right: 70px; width: calc(100% - 70px); }
}
@media (max-width: 768px) {
    .stats-row { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main-content { margin-right: 0; width: 100%; padding: 15px; }
}

/* === تنسيقات الطباعة (PDF) === */
@media print {
    .sidebar, .btn-export, .no-print { display: none !important; }
    .main-content { margin: 0; width: 100%; padding: 0; }
    body { background: white; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    .dashboard-grid { display: block; }
    .chart-wrapper { height: 300px; }
}