:root {
    --bg-body: #f3f4f6;
    --bg-sidebar: #1e1e2d;
    --bg-surface: #ffffff;
    
    --primary: #5664d2;
    --primary-hover: #4351b0;
    --success: #1bc5bd;
    --warning: #ffa800;
    --danger: #f64e60;
    --info: #8950fc;
    
    --text-main: #3f4254;
    --text-muted: #b5b5c3;
    --text-sidebar: #a2a3b7;
    --text-sidebar-hover: #ffffff;
    
    --border: #ebedf3;
    --radius: 12px;
    --shadow: 0 0 20px 0 rgba(76,87,125,0.02);
}

/* Reset & Base */
* { box-sizing: border-box; outline: none; }
body { 
    font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif; 
    background: var(--bg-body); 
    color: var(--text-main); 
    margin: 0; 
    display: flex; 
    min-height: 100vh;
    direction: rtl; 
}
a { text-decoration: none; color: inherit; }
ul, li { list-style: none; padding: 0; margin: 0; }

/* Sidebar */
.sidebar { 
    width: 260px; 
    background: var(--bg-sidebar); 
    display: flex; 
    flex-direction: column; 
    position: fixed; 
    height: 100vh; 
    z-index: 100; 
    transition: 0.3s;
    padding: 24px 16px;
    overflow-y: auto;
}
.sidebar-brand { 
    color: #fff; 
    font-size: 1.3rem; 
    font-weight: 800; 
    margin-bottom: 40px; 
    padding: 0 12px;
    display: flex; 
    align-items: center; 
    gap: 10px; 
}
.nav-item { 
    display: flex; 
    align-items: center; 
    padding: 12px 16px; 
    color: var(--text-sidebar); 
    border-radius: 8px; 
    margin-bottom: 6px; 
    transition: 0.2s; 
    font-weight: 500;
}
.nav-item:hover, .nav-item.active { 
    background: #2b2b40; 
    color: var(--text-sidebar-hover); 
}
.nav-item.active { 
    border-right: 3px solid var(--primary); /* RTL: Border Right */
}
.nav-icon { margin-left: 12px; font-size: 1.1rem; }

/* Main Content */
.main-content { 
    flex: 1; 
    margin-right: 260px; /* RTL */
    padding: 32px; 
    width: calc(100% - 260px); 
    transition: 0.3s; 
}

/* Mobile Toggle */
.menu-toggle { display: none; position: fixed; top: 16px; left: 16px; z-index: 101; background: var(--bg-sidebar); color: #fff; border: 0; padding: 10px; border-radius: 6px; }

/* Grid System */
.row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; }
.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-6  { grid-column: span 6; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }

/* Cards */
.card { 
    background: var(--bg-surface); 
    border-radius: var(--radius); 
    box-shadow: var(--shadow); 
    padding: 24px; 
    height: 100%;
    position: relative;
}
.card-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
}
.card-title { font-size: 1.1rem; font-weight: 700; margin: 0; }
.card-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; color: var(--text-main); }
.form-control { 
    width: 100%; 
    padding: 10px 14px; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    font-family: inherit; 
    transition: 0.2s; 
    background: #fff;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(86,100,210,0.1); }
.form-control[readonly] { background: #f9f9f9; cursor: not-allowed; }

/* Buttons */
.btn { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    padding: 10px 20px; 
    border-radius: 8px; 
    font-weight: 600; 
    border: none; 
    cursor: pointer; 
    transition: 0.2s; 
    font-size: 0.95rem;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-light { background: #f3f6f9; color: var(--text-main); }
.btn-light:hover { background: #e4e6ef; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.d-flex { display: flex; align-items: center; gap: 8px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert-success { background: rgba(27, 197, 189, 0.1); color: var(--success); }
.alert-danger { background: rgba(246, 78, 96, 0.1); color: var(--danger); }

/* Responsive */
@media (max-width: 992px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.active { transform: translateX(0); box-shadow: -5px 0 20px rgba(0,0,0,0.2); }
    .main-content { margin-right: 0; width: 100%; }
    .menu-toggle { display: block; }
    .row { display: flex; flex-direction: column; }
    .col-12, .col-8, .col-6, .col-4, .col-3 { width: 100%; }
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
