:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;

    --sidebar-bg: #111827;
    --sidebar-hover: #1f2937;
    --sidebar-active: #4f46e5;

    --text: #111827;
    --text-muted: #6b7280;

    --border: #e5e7eb;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, .08);

    --radius: 16px;
}

html,
body {
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
    background: var(--bg);
}

body {
    margin: 0;
    font-family: "Vazirmatn", sans-serif;
    color: var(--text);
    line-height: 1.7;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    letter-spacing: -0.3px;
}

p,
span,
label,
td,
th,
button,
input,
textarea,
select {
    font-weight: 400;
}


/* Auth Layout */
/* .auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 15px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.login-header {
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.login-header h2 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.login-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
} */

/* Sidebar */

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;

    width: 280px;
    height: 100vh;

    background: var(--sidebar-bg);
    color: white;

    z-index: 1200;

    display: flex;
    flex-direction: column;

    border-left: 1px solid rgba(255, 255, 255, .06);

    /* Always use transform for open/close */
    transform: translateX(0);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1),
        box-shadow .3s ease;

    will-change: transform;
}

/* Closed state — single source of truth */
.sidebar.sidebar-closed {
    transform: translateX(100%);
    box-shadow: none;
}

/* Open state on mobile — adds elevation */
.sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: -8px 0 32px rgba(0, 0, 0, .35);
}

/* ---------- Sidebar Header ---------- */
.sidebar-header {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-inline: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    flex-shrink: 0;
}

.sidebar-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

/* Close button inside sidebar (mobile) */
.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    color: rgba(255, 255, 255, .6);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: color .2s, background .2s;
    line-height: 1;
}

.sidebar-close-btn:hover {
    color: white;
    background: rgba(255, 255, 255, .08);
}

/* ---------- Sidebar Nav ---------- */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .15) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .15);
    border-radius: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 13px 16px;
    margin-bottom: 4px;

    border-radius: 14px;

    text-decoration: none;
    color: rgba(255, 255, 255, .72);

    font-size: 14px;
    font-weight: 500;

    transition: background .2s ease, color .2s ease, transform .15s ease;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: white;
    transform: translateX(-3px);
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: white;
    box-shadow: 0 6px 20px rgba(79, 70, 229, .3);
}

.sidebar-link i {
    font-size: 18px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

/* ---------- Overlay ---------- */
.sidebar-overlay {
    position: fixed;
    inset: 0;

    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition: opacity .3s ease, visibility .3s ease;

    z-index: 1100;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* ---------- Toggle Button ---------- */
.sidebar-toggle {
    width: 44px;
    height: 44px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: white;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

.sidebar-toggle:active {
    transform: translateY(0);
}

.sidebar-toggle i {
    font-size: 22px;
    color: var(--text);
}


/* ---------- Main Content ---------- */
.main-content {
    min-height: 100vh;

    display: flex;
    flex-direction: column;

    /* Desktop: push content left of sidebar */
    margin-right: 280px;
    transition: margin-right .3s cubic-bezier(.4, 0, .2, 1);
}

/* When sidebar is closed on desktop, reclaim the space */
.main-content.sidebar-hidden {
    margin-right: 0;
}

/* Full Width Content */
.main-content.full {
    margin-right: 0;
}


/* Top Navigation */
.topnav {
    height: 72px;

    background: rgba(255, 255, 255, .8);

    backdrop-filter: blur(12px);

    border-bottom: 1px solid var(--border);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding-inline: 32px;

    position: sticky;
    top: 0;
    z-index: 100;
}

.topnav-left h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.topnav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-direction: row-reverse;

}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark-color);
    font-weight: 500;
    flex-direction: row-reverse;

}

.user-info i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Page Content */
.page-content {
    padding: 32px;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0b5ed7 100%);
    color: white;
    border-radius: 10px 10px 0 0 !important;
    padding: 1rem 1.5rem;
}

.card-header h4,
.card-header h5 {
    margin: 0;
    font-weight: 600;
}

/* Stats Cards */
.stats-card {
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
}

.stats-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stats-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--dark-color);
}

.stats-label {
    color: var(--secondary-color);
    font-size: 0.9rem;
    font-weight: 500;
}

/* User Avatar */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--info-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.dept-icon,
.role-icon {
    width: 35px;
    height: 35px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--success-color) 0%, var(--info-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    border-bottom: 2px solid #e9ecef;
    font-weight: 600;
    color: var(--dark-color);
    background-color: var(--light-color);
}

.table td {
    vertical-align: middle;
    border-bottom: 1px solid #f1f3f4;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Forms */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #e3e6ea;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
    border-radius: 12px;
    font-weight: 600;
    padding: 10px 18px;

    transition: .2s ease;
}

.btn-primary {
    background: var(--primary);
    border: none;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #157347 100%);
    border: none;
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #0baccc 100%);
    border: none;
}

/* Alerts */
.alert {
    border-radius: 10px;
    border: none;
    padding: 1rem 1.5rem;
}

.alert-success {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.1) 0%, rgba(25, 135, 84, 0.05) 100%);
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(220, 53, 69, 0.05) 100%);
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

/* Badges */
.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
}

/* Input Groups */
.input-group-text {
    background: var(--light-color);
    border: 1px solid #e3e6ea;
    border-radius: 8px 0 0 8px;
    color: var(--secondary-color);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 0;
        overflow: hidden;
    }

    .main-content {
        margin-right: 0;
    }

    .topnav {
        padding: 1rem;
    }

    .topnav-left h2 {
        font-size: 1.25rem;
    }

    .user-info {
        font-size: 0.9rem;
    }

    .page-content {
        padding: 1rem;
    }

    .stats-number {
        font-size: 1.5rem;
    }

    .user-avatar {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }
}

/* @media (max-width: 576px) {
    .login-card {
        padding: 2rem 1.5rem;
    }

    .topnav {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .user-menu {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .btn-group .btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
    }
} */

/* Animation for page transitions */
.page-content {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Success states */
.form-control.is-valid {
    border-color: var(--success-color);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

/* Focus states */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: none;
}

/* Custom checkbox styles */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

/* ----- */

.btn-filter {
    background: #f5f6fa;
    color: #444;
    border: 1px solid #e1e4ea;
    transition: background 0.2s;
}

.btn-filter:hover {
    background: #e1e4ea;
    color: #222;
}

.btn-filter-active {
    background: #6c63ff;
    color: #fff;
    border: 1px solid #6c63ff;
}

.btn-filter-active-scheduled {
    background: #38b6ff;
    color: #fff;
    border: 1px solid #38b6ff;
}

.btn-filter-active-pending {
    background: #ffd966;
    color: #444;
    border: 1px solid #ffd966;
}

.btn-filter-active-sent {
    background: #a0aec0;
    color: #fff;
    border: 1px solid #a0aec0;
}

.btn-filter-active-approved {
    background: #4fd18b;
    color: #fff;
    border: 1px solid #4fd18b;
}

.btn-filter-active-rejected {
    background: #ff6b6b;
    color: #fff;
    border: 1px solid #ff6b6b;
}

/* ----- */
.table {
    margin: 0;
}

.table thead th {
    background: #f9fafb;
    border-bottom: 1px solid var(--border);

    font-size: 13px;
    font-weight: 700;

    color: var(--text-muted);

    padding: 16px;
}

.table tbody td {
    padding: 16px;
    border-bottom: 1px solid #f3f4f6;
}

.table-hover tbody tr:hover {
    background: rgba(79, 70, 229, .03);
}

.dropdown-menu {
    text-align: right;
}

.pagination {
    direction: rtl;
}

/* RTL classes */
.rtl-flex {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rtl-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}



/* =============================================
   DESKTOP (≥ 993px)
   ============================================= */
@media (min-width: 993px) {

    /* Sidebar always visible by default on desktop */
    .sidebar {
        box-shadow: none;
    }

    /* No overlay on desktop */
    .sidebar-overlay {
        display: none !important;
    }

    /* Close-X inside sidebar only on mobile */
    .sidebar-close-btn {
        display: none !important;
    }
}

/* =============================================
   TABLET & MOBILE (≤ 992px)
   ============================================= */
@media (max-width: 992px) {

    /* Sidebar off-screen by default on mobile */
    .sidebar {
        transform: translateX(100%);
        width: 300px;
    }

    /* Sidebar open on mobile */
    .sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: -8px 0 40px rgba(0, 0, 0, .4);
    }

    /* Main content full-width on mobile (no margin) */
    .main-content {
        margin-right: 0 !important;
    }

    /* Show close button inside sidebar on mobile */
    .sidebar-close-btn {
        display: flex !important;
    }

    .topnav {
        padding-inline: 16px;
    }

    .page-content {
        padding: 16px;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 100%;
        max-width: 320px;
    }
}