/* =========================================
   فونت‌ها و تنظیمات پایه
   ========================================= */
@font-face {
    font-family: 'Vazir';
    src: url('fonts/Vazir.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    font-family: 'Vazir', Tahoma, sans-serif;
    direction: rtl;
    background-color: #f1f5f9;
    color: #334155;
    line-height: 1.6;
}

/* کلاسی که توسط JS اضافه میشود تا اسکرول متوقف شود */
body.no-scroll {
    overflow: hidden;
}

a { 
    text-decoration: none; 
}

/* =========================================
   استایل‌های صفحه لاگین و ثبت‌نام (Auth)
   ========================================= */
.auth-container {
    max-width: 400px; 
    margin: 100px auto;
    background: #fff; 
    padding: 30px;
    border-radius: 8px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.auth-container h2 { text-align: center; margin-bottom: 20px; color: #2c3e50; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 14px; }
.form-control {
    width: 100%; padding: 10px; border: 1px solid #cbd5e1;
    border-radius: 4px; font-family: inherit; font-size: 14px;
    transition: border-color 0.3s;
}
.form-control:focus { outline: none; border-color: #3b82f6; }
.btn {
    width: 100%; padding: 10px; background: #3b82f6; color: #fff;
    border: none; border-radius: 4px; cursor: pointer; font-family: inherit;
    transition: background 0.3s;
}
.btn:hover { background: #2563eb; }
.alert { padding: 10px; margin-bottom: 15px; border-radius: 4px; font-size: 14px; }
.alert.error { background: #fee2e2; color: #991b1b; border: 1px solid #f87171; }
.alert.success { background: #dcfce7; color: #166534; border: 1px solid #4ade80; }

/* =========================================
   استایل‌های پنل کاربری (ساختار اصلی)
   ========================================= */
.panel-wrapper {
    display: flex;
    min-height: 100vh;
}

/* سایدبار */
.sidebar {
    width: 260px;
    background-color: #1e293b;
    color: #fff;
    flex-shrink: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid #334155;
    background-color: #0f172a;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: #f8fafc;
}

.role-badge {
    font-size: 12px;
    color: #cbd5e1;
    background: #334155;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
}

.sidebar-nav {
    list-style: none;
    padding: 10px 0;
    overflow-y: auto;
}

.sidebar-nav li a {
    display: block;
    padding: 12px 25px;
    color: #cbd5e1;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
    border-right: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background-color: #334155;
    color: #fff;
    border-right-color: #3b82f6;
}

/* رنگ‌های اختصاصی نقش‌ها */
.text-warning { color: #f59e0b !important; font-weight: bold; }
.text-danger { color: #ef4444 !important; font-weight: bold; }

/* محتوای اصلی */
.main-content {
    flex-grow: 1;
    padding: 30px;
    width: calc(100% - 260px);
}

/* =========================================
   هدر موبایل و لایه تاریک
   ========================================= */
.mobile-header {
    display: none;
    background-color: #1e293b;
    color: #fff;
    padding: 15px 20px;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky; /* هدر را در بالای موبایل ثابت نگه می‌دارد */
    top: 0;
    z-index: 1000;
}

.menu-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-title {
    margin-right: 15px;
    font-weight: bold;
    font-size: 1.1rem;
}

.sidebar-overlay {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px); /* افکت زیبایی تار شدن پس زمینه */
    z-index: 1040;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    visibility: visible;
    opacity: 1;
}

/* =========================================
   تنظیمات ریسپانسیو (موبایل و تبلت)
   ========================================= */
@media (max-width: 768px) {
    .mobile-header {
        display: flex; 
    }

    .panel-wrapper {
        flex-direction: column;
    }

    .main-content {
        width: 100%;
        padding: 15px;
    }

    /* تنظیمات سایدبار در موبایل با انیمیشن روان */
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        transform: translateX(100%); /* مخفی کردن در سمت راست با ترانسفورم بجای رایت */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* انیمیشن نرم‌تر */
        box-shadow: none;
    }

    /* نمایش سایدبار */
    .sidebar.active {
        transform: translateX(0); /* بازگشت به جای اصلی */
        box-shadow: -5px 0 25px rgba(0,0,0,0.5);
    }
}
