/* Modern Dashboard Styles */
:root {
    --primary-blue: #3B82F6;
    --primary-blue-dark: #2563EB;
    --sidebar-bg: #FFFFFF;
    --white: #FFFFFF;
    --text-dark: #1F2937;
    --text-gray: #6B7280;
    --text-light: #9CA3AF;
    --border-color: #E5E7EB;
    --hover-bg: #F3F4F6;
    --active-bg: #3B82F6;
    --active-text: #FFFFFF;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 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);
}

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

body {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #F9FAFB;
    direction: rtl;
    overflow-x: hidden;
}

.modern-dashboard {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Right Sidebar Styles */
.sidebar-right {
    width: 280px;
    background: var(--sidebar-bg);
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
    border-left: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary-blue);
}

    .brand-logo i {
        font-size: 32px;
        color: var(--primary-blue);
    }

.brand-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-gray);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

    .sidebar-toggle:hover {
        background: var(--hover-bg);
    }

/* Sidebar Menu */
.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.menu-list {
    list-style: none;
}

.menu-item {
    margin-bottom: 4px;
}

    .menu-item > a,
    .submenu-toggle {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        color: var(--text-gray);
        text-decoration: none;
        border-radius: 10px;
        transition: all 0.2s;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        background: transparent;
        border: none;
        width: 100%;
        text-align: right;
    }

        .menu-item > a i,
        .submenu-toggle i {
            font-size: 20px;
            min-width: 20px;
        }

        .menu-item > a:hover,
        .submenu-toggle:hover {
            background: var(--hover-bg);
            color: var(--text-dark);
        }

    .menu-item.active > a {
        background: var(--active-bg);
        color: var(--active-text);
        font-weight: 600;
    }

        .menu-item.active > a i {
            color: var(--active-text);
        }

    /* Submenu Styles */
    .menu-item.has-submenu .arrow {
        margin-right: auto;
        font-size: 16px;
        transition: transform 0.3s;
    }

    .menu-item.has-submenu.open .arrow {
        transform: rotate(180deg);
    }

.submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-right: 20px;
}

.menu-item.has-submenu.open .submenu {
    max-height: 500px;
    margin-top: 4px;
}

.submenu li {
    margin-bottom: 4px;
}

.submenu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-gray);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 13px;
}

    .submenu a i {
        font-size: 18px;
    }

    .submenu a:hover {
        background: var(--hover-bg);
        color: var(--text-dark);
    }

.submenu li.active a {
    background: var(--active-bg);
    color: var(--active-text);
    font-weight: 600;
}

    .submenu li.active a i {
        color: var(--active-text);
    }

/* Main Content Area */
.main-content {
    flex: 1;
    margin-right: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-right 0.3s ease;
}

/* Top Header */
.top-header {
    background: var(--white);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-dark);
    cursor: pointer;
    padding: 8px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #F3F4F6;
    padding: 10px 16px;
    border-radius: 10px;
    width: 350px;
}

    .search-box i {
        color: var(--text-gray);
        font-size: 18px;
    }

    .search-box input {
        border: none;
        background: transparent;
        outline: none;
        width: 100%;
        color: var(--text-dark);
        font-size: 14px;
    }

        .search-box input::placeholder {
            color: var(--text-gray);
        }

/* Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon-btn {
    position: relative;
    background: transparent;
    border: none;
    font-size: 22px;
    color: var(--text-gray);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

    .header-icon-btn:hover {
        background: #F3F4F6;
        color: var(--primary-blue);
    }

    .header-icon-btn .badge {
        position: absolute;
        top: 4px;
        left: 4px;
        background: #EF4444;
        color: white;
        font-size: 10px;
        padding: 2px 6px;
        border-radius: 10px;
        font-weight: 600;
    }

/* User Menu */
.user-menu {
    position: relative;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

    .user-profile-btn:hover {
        background: #F9FAFB;
        border-color: var(--primary-blue);
    }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: right;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.user-role {
    font-size: 12px;
    color: var(--text-gray);
}

.user-profile-btn i {
    color: var(--text-gray);
    font-size: 16px;
}

/* User Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

    .user-dropdown.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-dark);
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: right;
}

    .dropdown-item:first-child {
        border-radius: 12px 12px 0 0;
    }

    .dropdown-item:last-child {
        border-radius: 0 0 12px 12px;
    }

    .dropdown-item:hover {
        background: #F9FAFB;
    }

    .dropdown-item i {
        font-size: 18px;
        color: var(--text-gray);
    }

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 32px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Sidebar Overlay (for mobile) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

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

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    min-height: 160px;
    display: flex;
    flex-direction: column;
}

    .stat-card:hover {
        box-shadow: var(--shadow-lg);
        transform: translateY(-2px);
    }

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.stat-card-title {
    font-size: 14px;
    color: var(--text-gray);
    font-weight: 500;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

    .stat-card-icon.blue {
        background: rgba(59, 130, 246, 0.1);
        color: var(--primary-blue);
    }

    .stat-card-icon.green {
        background: rgba(34, 197, 94, 0.1);
        color: #22C55E;
    }

    .stat-card-icon.yellow {
        background: rgba(251, 191, 36, 0.1);
        color: #FBBF24;
    }

    .stat-card-icon.purple {
        background: rgba(168, 85, 247, 0.1);
        color: #A855F7;
    }

.stat-card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.2;
    flex: 1;
    display: flex;
    align-items: center;
}

.stat-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-gray);
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

    .stat-change.positive {
        color: #22C55E;
    }

    .stat-change.negative {
        color: #EF4444;
    }

/* Chart Card */
.chart-card {
    background: var(--white);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.chart-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.chart-tabs {
    display: flex;
    gap: 8px;
}

.chart-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

    .chart-tab:hover {
        background: #F3F4F6;
    }

    .chart-tab.active {
        background: var(--primary-blue);
        color: var(--white);
    }

/* Transaction Table */
.transaction-table {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-title {
    font-size: 18px;
  font-weight: 600;
 color: var(--text-dark);
}

.view-all-link {
color: var(--primary-blue);
  font-size: 14px;
    text-decoration: none;
    font-weight: 500;
 display: flex;
    align-items: center;
    gap: 4px;
}

    .view-all-link:hover {
        text-decoration: underline;
    }

/* Desktop Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: right;
    padding: 16px 24px;
    background: #F9FAFB;
  font-size: 13px;
    font-weight: 600;
    color: var(--text-gray);
    border-bottom: 1px solid var(--border-color);
}

tbody td {
  padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
    font-size: 14px;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: #F9FAFB;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar-right {
        transform: translateX(100%);
    }

        .sidebar-right.show {
          transform: translateX(0);
        }

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

    .mobile-menu-toggle,
    .sidebar-toggle {
 display: block;
    }

    .search-box {
        width: 250px;
  }

    /* Keep 4 cards in one row on lg screens */
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .top-header {
        padding: 12px 16px;
    }

    .search-box {
        display: none;
    }

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

    .user-info {
     display: none;
    }

 .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
   gap: 16px;
    }

    .stat-card {
 padding: 20px;
    }

    .stat-card-value {
        font-size: 28px;
 }

    /* Responsive Table */
    .transaction-table {
     border-radius: 12px;
    }

 .table-header {
        padding: 16px;
    }

    .table-title {
        font-size: 16px;
  }

  /* Hide table headers on mobile */
    thead {
        display: none;
  }

    /* Convert table to card-based layout on mobile */
    tbody,
    tbody tr,
    tbody td {
        display: block;
        width: 100%;
    }

    tbody tr {
        margin-bottom: 16px;
        border: 1px solid var(--border-color);
    border-radius: 12px;
        padding: 16px;
        background: var(--white);
    }

        tbody tr:hover {
background: #F9FAFB;
        }

    tbody td {
        padding: 8px 0;
        border: none;
        position: relative;
    padding-right: 45%;
        text-align: left;
    }

        /* Add labels using data-label attribute */
        tbody td::before {
            content: attr(data-label);
     position: absolute;
            right: 0;
          width: 40%;
   padding-left: 10px;
       font-weight: 600;
  color: var(--text-gray);
      font-size: 13px;
    }

        /* First td in each row */
        tbody td:first-child {
  padding-top: 0;
       font-weight: 600;
            font-size: 15px;
        }

        /* Last td in each row */
     tbody td:last-child {
     padding-bottom: 0;
        }
}

@media (max-width: 480px) {
    .brand-text {
        font-size: 18px;
  }

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

    .dashboard-grid {
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card-header {
    margin-bottom: 12px;
    }

    .stat-card-icon {
 width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .stat-card-value {
        font-size: 24px;
        margin-bottom: 4px;
    }

  .stat-card-footer {
        font-size: 12px;
    }

    .chart-tabs {
        flex-wrap: wrap;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
     gap: 12px;
 padding: 12px;
    }

    .transaction-table {
 border-radius: 8px;
    }

    tbody tr {
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 8px;
    }

    tbody td {
      padding: 6px 0;
        padding-right: 50%;
        font-size: 13px;
    }

        tbody td::before {
            font-size: 12px;
          width: 45%;
  }

    .status-badge {
      font-size: 11px;
        padding: 4px 10px;
    }

  .btn-sm {
        font-size: 12px !important;
        padding: 4px 12px !important;
    }

    /* Make alerts more compact on mobile */
    .alert {
        padding: 12px 16px;
        flex-direction: column !important;
 align-items: flex-start !important;
        gap: 12px;
    }

        .alert .btn {
 width: 100%;
            text-align: center;
        }
}

/* Scrollbar Styling */
.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: #F3F4F6;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 10px;
}

    .sidebar-menu::-webkit-scrollbar-thumb:hover {
        background: #9CA3AF;
    }

/* Animation */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.sidebar-right.show {
    animation: slideInRight 0.3s ease;
}

.sidebar-overlay.show {
    animation: fadeIn 0.3s ease;
}

/* Alert Styles */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.alert-warning {
    background: #FEF3C7;
    border: 1px solid #FDE68A;
    color: #92400E;
}

.alert i {
    font-size: 24px;
    margin-left: 12px;
}
/* Mobile Responsive Improvements for Index Page */
.stat-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease;
}

    .stat-card-link:hover .stat-card {
        transform: translateY(-2px);
   box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

@media (max-width: 768px) {
    .dashboard-grid {
  grid-template-columns: repeat(2, 1fr);
    }

    .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .d-flex.justify-content-between.align-items-center.mb-4 h4 {
        font-size: 20px;
    }

    .btn-primary {
     width: 100%;
        justify-content: center;
        display: flex !important;
    }

    .alert.alert-warning {
      flex-wrap: wrap !important;
    }

     .alert.alert-warning > div:first-child {
    min-width: 100% !important;
        margin-bottom: 12px;
        }

        .alert.alert-warning .btn {
      width: 100%;
 text-align: center;
        }
}

/* ==================== دکمه تغییر نقش در Header ==================== */
.workfield-selector-header {
    display: flex;
    align-items: center;
}
