/* === متغیرهای CSS مدرن === */
:root {
    /* رنگ‌های اصلی مدرن */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-color: #8b5cf6;
    --accent-hover: #7c3aed;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    /* تم تیره */
    --bg-dark: #0f172a;
    --surface-dark: #1e293b;
    --surface-dark-hover: #334155;
    --text-dark: #f1f5f9;
    --text-secondary-dark: #94a3b8;
    --border-dark: #475569;
    
    /* تم روشن */
    --bg-light: #f8fafc;
    --surface-light: #ffffff;
    --surface-light-hover: #f1f5f9;
    --text-light: #1e293b;
    --text-secondary-light: #64748b;
    --border-light: #e2e8f0;
    
    /* سایه‌ها */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* انیمیشن */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* سایر متغیرها */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --sidebar-width: 280px;
}

/* تم پیش‌فرض (تیره) */
body {
    --bg: var(--bg-dark);
    --surface: var(--surface-dark);
    --surface-hover: var(--surface-dark-hover);
    --text: var(--text-dark);
    --text-secondary: var(--text-secondary-dark);
    --border: var(--border-dark);
}

/* تم روشن */
body[theme="light"] {
    --bg: var(--bg-light);
    --surface: var(--surface-light);
    --surface-hover: var(--surface-light-hover);
    --text: var(--text-light);
    --text-secondary: var(--text-secondary-light);
    --border: var(--border-light);
}

/* === استایل‌های عمومی === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    min-height: 100vh;
    overflow-x: hidden;
}

body.sidebar-visible {
    padding-right: var(--sidebar-width);
}

@media (max-width: 768px) {
    body.sidebar-visible {
        padding-right: 0;
    }
}

/* === هدر مدرن === */
.main-nav {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.main-nav::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 4px;
  background: var(--primary-gradient);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo::before {
    content: "✨";
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    position: relative;
}

.nav-links a:hover {
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 50%;
    transform: translateX(50%);
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width var(--transition-fast);
}

.nav-links a:hover::after {
    width: 80%;
}

/* دکمه اصلی */
.btn-primary {
    background: var(--primary-gradient);
    color: white !important;
    padding: 0.6rem 1.5rem !important;
    border-radius: var(--border-radius);
    font-weight: 600 !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all var(--transition-normal) !important;
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
}

/* نشانگر سکه - مدرن‌تر */
.credit-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.15) 100%);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 700;
    margin-left: 10px;
    transition: all var(--transition-normal);
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.1);
    position: relative;
    overflow: hidden;
}

.credit-badge::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent 30%, rgba(255, 255, 255, 0.1) 100%);
    z-index: 0;
}

.credit-badge:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
}

.credit-badge i {
    color: #fbbf24;
    filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.3));
    z-index: 1;
    position: relative;
}

.credit-badge span {
    z-index: 1;
    position: relative;
}

/* === فوتر مدرن === */
.main-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 2rem 1.5rem;
    text-align: center;
    margin-top: auto;
    backdrop-filter: blur(10px);
}

.main-footer p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    position: relative;
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--accent-color);
    background: var(--surface-hover);
    transform: translateY(-2px);
}

.footer-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width var(--transition-fast);
}

.footer-links a:hover::after {
    width: 60%;
}

/* جداکننده در فوتر */
.footer-links a:not(:last-child)::before {
    content: '|';
    position: absolute;
    left: -0.75rem;
    color: var(--border);
}

/* === محتوای اصلی === */
.main-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 170px);
}

@media (max-width: 768px) {
    .main-content {
        padding: 1.5rem;
    }
}

/* === سایدبار مدرن === */
/* دکمه منو همبرگری */
.menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 12px;
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.menu-toggle:hover {
    transform: rotate(90deg) scale(1.1);
    background: var(--accent-hover);
}

/* دکمه تغییر تم */
.theme-toggle {
    position: fixed;
    bottom: 25px;
    left: 25px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.theme-toggle:hover {
    transform: rotate(30deg) scale(1.1);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

/* لایه overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

/* سایدبار اصلی */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    color: var(--text);
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition-normal);
    z-index: 1000;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15);
}

/* هدر سایدبار */
.sidebar-header {
    padding: 35px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-hover) 100%);
    border-bottom: 1px solid var(--border);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.sidebar-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
}

.sidebar-header h3 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: -10px;
    font-size: 1.4rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.sidebar-header small {
    opacity: 0.8;
    font-size: 0.85rem;
    margin-top: 5px;
    display: block;
    color: var(--text-secondary);
}

/* منو و لینک‌ها */
.menu-links {
    list-style: none;
    padding: 20px 15px;
    margin: 0;
    flex-grow: 1;
}

.menu-links li {
    margin-bottom: 6px;
}

.menu-links a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all var(--transition-normal);
    position: relative;
    font-size: 0.95rem;
    border: 1px solid transparent;
    overflow: hidden;
}

.menu-links a::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-color);
    transform: translateX(10px);
    transition: transform var(--transition-normal);
    border-radius: 0 4px 4px 0;
}

.menu-links a:hover {
    background: var(--surface-hover);
    transform: translateX(-4px);
    border-color: var(--border);
    padding-right: 22px;
}

.menu-links a:hover::before {
    transform: translateX(0);
}

.menu-links a.active {
    background: var(--surface-hover);
    color: var(--accent-color);
    font-weight: 600;
    border-color: var(--border);
    padding-right: 22px;
}

.menu-links a.active::before {
    transform: translateX(0);
}

.menu-links a i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    color: inherit;
    transition: transform var(--transition-normal);
}

.menu-links a:hover i {
    transform: scale(1.2);
}

/* برچسب‌های دسته‌بندی منو */
.menu-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.9;
    margin: 25px 0 12px 16px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    position: relative;
    padding-right: 10px;
}

.menu-label::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    transform: translateY(-50%);
}

/* نشانگر (بدج) */
.badge-mini {
    background: var(--success-color);
    color: white;
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 20px;
    margin-right: auto;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* لینک خروج با رنگ متمایز */
.menu-links a[href="logout.php"] {
    color: var(--danger-color) !important;
}

.menu-links a[href="logout.php"]:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

/* بخش پایینی سایدبار */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    margin-top: auto;
    text-align: center;
    background: var(--surface-hover);
}

.sidebar-footer div {
    font-size: 0.8rem;
    opacity: 0.8;
    color: var(--text-secondary);
}

.sidebar-footer small {
    font-size: 0.75rem;
    opacity: 0.6;
    display: block;
    margin-top: 5px;
}

/* رسپانسیو برای موبایل */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
        width: 85%;
        max-width: 320px;
        box-shadow: -8px 0 40px rgba(0, 0, 0, 0.2);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
    
    .theme-toggle {
        bottom: 90px;
        left: 25px;
    }
}

/* اسکرول بار زیبا */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* === افکت‌های اضافی === */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.pulse {
    animation: pulse 2s infinite;
}

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

.fade-in-up {
    animation: fadeInUp var(--transition-normal) ease-out;
}

@keyframes shimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.shimmer {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.1) 50%, 
        transparent 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}