/* =====================================================
   متغیرهای CSS
   ===================================================== */

:root {
    /* رنگ‌های اصلی */
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* رنگ‌های خنثی */
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* سایه‌ها */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    
    /* اندازه‌ها */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --border-radius: 10px;
    --border-radius-sm: 6px;
    --border-radius-lg: 14px;
    
    /* انتقال */
    --transition: all 0.3s ease;
}

/* =====================================================
   ریست و پایه
   ===================================================== */

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

html {
    font-size: 14px;
}

body {
    font-family: 'Yekan Bakh', 'Tahoma', sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    direction: rtl;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* =====================================================
   ساختار اپلیکیشن
   ===================================================== */

.app-container {
    display: flex;
    min-height: 100vh;
}

.main-wrapper {
    flex: 1;
    margin-right: var(--sidebar-width);
    min-width: 0;
    transition: var(--transition);
}

/* =====================================================
   سایدبار
   ===================================================== */

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
    color: var(--white);
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: var(--transition);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--white);
}

.sidebar-toggle-mobile {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
}

.sidebar-nav {
    padding: 15px 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 4px;
    border-radius: var(--border-radius);
    color: rgba(255, 255, 255, 0.85);
    transition: var(--transition);
    position: relative;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    transform: translateX(-3px);
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background-color: #fbbf24;
    border-radius: 2px;
}

.nav-icon {
    font-size: 1.2rem;
    margin-left: 12px;
    width: 24px;
    text-align: center;
}

.nav-text {
    font-size: 0.95rem;
    font-weight: 400;
    flex: 1;
}

.nav-badge {
    background-color: var(--danger);
    color: var(--white);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.nav-divider {
    padding: 15px 15px 8px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-logout {
    margin-top: 20px;
    background-color: rgba(239, 68, 68, 0.1);
}

.nav-logout:hover {
    background-color: rgba(239, 68, 68, 0.3);
    color: var(--white);
}

/* =====================================================
   نوار بالایی
   ===================================================== */

.topbar {
    height: var(--topbar-height);
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-700);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--border-radius-sm);
}

.sidebar-toggle:hover {
    background-color: var(--gray-100);
}

.page-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--gray-800);
}

.topbar-item {
    display: flex;
    align-items: center;
}

.icon-button {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
}

.icon-button:hover {
    background-color: var(--gray-200);
}

.icon-badge {
    position: absolute;
    top: -2px;
    left: -2px;
    background-color: var(--danger);
    color: var(--white);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    font-weight: 600;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.user-dropdown:hover {
    background-color: var(--gray-100);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: left;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
}

.user-role {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

/* =====================================================
   محتوای صفحه
   ===================================================== */

.page-content {
    padding: 25px;
    min-height: calc(100vh - var(--topbar-height));
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
}

.page-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* =====================================================
   ریسپانسیو
   ===================================================== */

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-right: 0;
    }
    
    .sidebar-toggle,
    .sidebar-toggle-mobile {
        display: block;
    }
    
    .user-info {
        display: none;
    }
}

@media (max-width: 576px) {
    .page-content {
        padding: 15px;
    }
    
    .topbar {
        padding: 0 15px;
    }
    
    .page-title {
        font-size: 1.1rem;
    }
}
