﻿:root {
    /* --- پالت رنگی حرفه‌ای و مدرن --- */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #3b82f6;
    --light: #f1f5f9;
    --white: #ffffff;
    --dark: #0f172a;
    --gray: #64748b;
    --gray-light: #e2e8f0;
    /* --- متغیرهای ساختاری --- */
    --border-radius: 12px;
    --box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- تنظیمات پایه --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazirmatn','IRANSansX', sans-serif;
}

@font-face {
    font-family: IRANSansX;
    font-style: normal;
    font-weight: normal;
    src: url('/fonts/IRANSansX-Regular.woff2');
}



body {
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.7;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.container-fluid {
    display: flex;
    min-height: 100vh;
    padding: 0 !important;
}

/* --- Sidebar --- */
.sidebar {
    width: 270px;
    background: var(--dark);
    color: white;
    transition: var(--transition);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1000;
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    background: rgba(0,0,0,0.2);
}

    .sidebar-header h4 {
        font-size: 1.1rem;
        color: #f8fafc;
    }

.sidebar-menu {
    padding: 15px 12px;
    overflow-y: auto;
}

    .sidebar-menu a.menu-item {
        display: flex;
        align-items: center;
        padding: 12px 16px;
        margin-bottom: 4px;
        color: #94a3b8;
        border-radius: 8px;
        text-decoration: none;
        transition: var(--transition);
    }

        .sidebar-menu a.menu-item:hover {
            background: rgba(255, 255, 255, 0.08);
            color: #fff;
        }

        .sidebar-menu a.menu-item.active {
            background: var(--primary);
            color: #fff;
            box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
        }

        .sidebar-menu a.menu-item i {
            margin-left: 12px;
            font-size: 1.2rem;
        }

/* --- Main Content & Header --- */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.header {
    background: var(--white);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-light);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

    .header h1 {
        font-size: 1.4rem;
        font-weight: 700;
        margin: 0;
    }

/* --- Profile Dropdown & Avatar (اصلاح شده و ادغام شده) --- */
.user-profile-dropdown {
    position: relative;
}

.user-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

    .user-toggle:hover {
        background-color: var(--primary-light);
    }

.user-avatar {
    width: 42px;
    height: 42px;
    background-color: var(--primary-light) !important;
    color: var(--primary) !important;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    border: 2px solid var(--white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.user-info {
    text-align: right;
    line-height: 1.4;
}

.user-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--dark);
    display: block;
}

.user-role {
    font-size: 0.75rem;
    color: var(--gray);
}

/* Dropdown Menu */
.user-profile-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0 !important;
    right: auto !important;
    min-width: 240px;
    background-color: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    z-index: 1100;
    padding: 8px;
}

    .user-profile-dropdown .dropdown-menu.show {
        display: block;
        animation: dropdownFadeIn 0.2s ease;
    }

.user-profile-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: var(--dark);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: var(--transition);
    text-align: right;
    border: none;
    background: none;
    width: 100%;
}

    .user-profile-dropdown .dropdown-item i {
        width: 20px;
        color: var(--gray);
        font-size: 1.1rem;
        display: flex;
        justify-content: center;
    }

    .user-profile-dropdown .dropdown-item:hover {
        background-color: var(--primary-light);
        color: var(--primary);
    }

    .user-profile-dropdown .dropdown-item.logout:hover {
        background-color: #fef2f2;
        color: var(--secondary);
    }

.user-profile-dropdown .dropdown-divider {
    height: 1px;
    background-color: var(--gray-light);
    margin: 8px 0;
}

/* --- Tables --- */
.employee-data-table th {
    background-color: #f8fafc !important;
    color: var(--gray) !important;
    font-weight: 700;
    padding: 16px;
    border-bottom: 2px solid var(--gray-light);
    text-align: right;
}

.employee-data-table td {
    padding: 16px;
    vertical-align: middle;
    color: #334155;
}

/* --- Login Page --- */
.login-container {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--dark) 0%, var(--primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 420px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

    .login-btn:hover {
        background: var(--primary-hover);
        transform: translateY(-2px);
        box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.4);
    }

/* --- Animations --- */
@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Responsive --- */
@media (max-width: 992px) {
    .sidebar {
        width: 70px;
    }

        .sidebar span, .sidebar-header h4 {
            display: none;
        }

    .sidebar-menu a.menu-item i {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .container-fluid {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .employee-data-table thead {
        display: none;
    }

    .employee-data-table tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid var(--gray-light) !important;
        border-radius: var(--border-radius);
    }

    .employee-data-table td {
        display: flex;
        justify-content: space-between;
        flex-direction: row-reverse;
        padding: 10px !important;
        border-bottom: 1px dashed var(--gray-light) !important;
    }

        .employee-data-table td::before {
            content: attr(data-label);
            font-weight: 700;
        }
}


/* --- Dashboard Specific Styles --- */

/* Stats Cards Grid */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

    .stat-card:hover {
        transform: translateY(-5px);
    }

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

    .stat-icon.employees {
        background-color: #e0e7ff;
        color: #4338ca;
    }

    .stat-icon.departments {
        background-color: #ffedd5;
        color: #c2410c;
    }

    .stat-icon.leaves {
        background-color: #dcfce7;
        color: #15803d;
    }

    .stat-icon.vacancies {
        background-color: #f3e8ff;
        color: #7e22ce;
    }

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0;
    color: var(--dark);
}

.stat-info p {
    color: var(--gray);
    margin: 0;
    font-size: 0.9rem;
}

/* Content Sections */
.content-section {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 25px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

    .section-header h2 {
        font-size: 1.1rem;
        font-weight: 700;
        margin: 0;
        display: flex;
        align-items: center;
    }

.view-all {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Events List Styles */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: 10px;
    background-color: #f8fafc;
    transition: var(--transition);
}

    .event-item:hover {
        background-color: var(--primary-light);
    }

.event-date {
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .event-date .day {
        font-weight: 800;
        font-size: 1.2rem;
        line-height: 1;
    }

    .event-date .month {
        font-size: 0.75rem;
    }

.event-details h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 5px 0;
}

.event-details p {
    font-size: 0.8rem;
    color: var(--gray);
    margin: 0;
}

/* Chart Placeholder */
.chart-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray-light);
    border: 2px dashed var(--gray-light);
    border-radius: var(--border-radius);
    padding: 40px;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* --- اصلاح نهایی بخش پاسخگو (Responsive) --- */

/* حذف استایل‌های تداخلی قبلی و جایگزینی با این ساختار */
@media (max-width: 992px) {
    /* در تبلت‌ها سایدبار کمی جمع‌تر می‌شود اما متن‌ها هستند */
    .sidebar {
        width: 240px;
    }
}

@media (max-width: 768px) {
    /* 1. تنظیمات سایدبار کشویی */
    .sidebar {
        position: fixed;
        right: -280px; /* کاملاً مخفی در سمت راست */
        top: 0;
        bottom: 0;
        z-index: 2000;
        width: 280px;
        height: 100vh;
        transition: var(--transition);
        box-shadow: none;
    }

        .sidebar.active {
            right: 0; /* باز شدن منو */
            box-shadow: -10px 0 30px rgba(0,0,0,0.3);
        }

        /* 2. نمایش اجباری متن‌ها در موبایل */
        .sidebar span, .sidebar-header h4 {
            display: inline-block !important;
        }

    .sidebar-header {
        padding: 20px;
        text-align: right;
    }

    /* 3. اصلاح جدول در موبایل (Card View) */
    .employee-data-table thead {
        display: none;
    }

    .employee-data-table tr {
        display: block;
        background: var(--white);
        margin-bottom: 15px;
        border: 1px solid var(--gray-light) !important;
        border-radius: var(--border-radius);
        padding: 10px;
    }

    .employee-data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-direction: row-reverse; /* برای تراز درست متن و عنوان */
        border: none !important;
        padding: 8px 5px !important;
    }

        .employee-data-table td::before {
            content: attr(data-label);
            font-weight: 700;
            color: var(--gray);
            font-size: 0.85rem;
        }

    /* 4. تنظیمات هدر موبایل */
    .header {
        padding: 10px 15px;
    }

        .header h1 {
            font-size: 1.1rem;
        }

    .user-info {
        display: none; /* مخفی کردن نام در هدر موبایل برای خلوت شدن */
    }
}

/* لایه تیره پشت سایدبار در موبایل (اختیاری - نیاز به اضافه کردن یک div در Layout دارد) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1999;
}

    .sidebar-overlay.show {
        display: block;
    }