/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    background-color: #f5f5f5;
    color: #333;
    font-weight: 400;
}

/* Admin Wrapper */
.admin-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.admin-header {
    background: #3498db;
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    transition: opacity 0.3s;
}

.menu-toggle:hover {
    opacity: 0.8;
}

.dashboard-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    font-family: 'Vazirmatn', sans-serif;
}

/* هدر پنل کارمند: منو + برند + آیکن‌ها در یک ردیف */
.employee-panel-header {
    flex-wrap: nowrap;
}

.employee-panel-header .header-left {
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 8px;
}

.employee-panel-header .header-right {
    flex-shrink: 0;
}

/* برند سایت: یک ردیف — اول لوگو (راست)، بعد عنوان (چپ‌تر در RTL) */
.site-brand--header {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    flex-shrink: 1;
    min-width: 0;
}

.site-brand--header .site-brand__logo--header {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.site-brand--header .site-brand__title--inline {
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
    flex: 0 1 auto;
    max-width: 11rem;
}

.site-brand--sidebar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0 8px;
    width: 100%;
    box-sizing: border-box;
}

.site-brand--sidebar .site-brand__logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 12px;
    flex-shrink: 0;
}

.site-brand--sidebar .site-brand__title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    line-height: 1.35;
    color: inherit;
    flex: 1;
    min-width: 0;
    text-align: right;
    align-self: center;
}

.site-brand--login {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: right;
}

.site-brand--login .site-brand__logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 14px;
    flex-shrink: 0;
}

.site-brand--login .site-brand__title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
    text-align: right;
}

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

.notification-bell {
    position: relative;
    color: white;
    font-size: 20px;
    padding: 8px 12px;
    border-radius: 50%;
    transition: background 0.3s;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-bell:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notification-bell .notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: #dc3545;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    border: 2px solid #3498db;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    cursor: pointer;
    padding: 5px 15px;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    transition: background 0.3s;
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.2);
}

.notification-bell {
    position: relative;
    margin-left: 20px;
    color: #fff;
    font-size: 22px;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.2s, color 0.2s;
}

.notification-bell:hover {
    transform: scale(1.1) rotate(15deg);
    color: #fff;
}

.notification-bell .notification-badge {
    position: absolute;
    top: -8px;
    left: -8px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}


.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

.header-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.header-logout:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* Breadcrumb */
.breadcrumb-nav {
    background: white;
    padding: 12px 30px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.breadcrumb-nav a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb-nav a:hover {
    color: #2980b9;
}

.breadcrumb-nav .separator {
    color: #999;
}

/*
 * طعمهٔ autocomplete: هرگز از left:-9999px استفاده نکنید — عرض اسکرول افقی سند را
 * به هزاران پیکسل می‌برد و روی موبایل قالب را می‌شکند.
 */
.admin-filter-form {
    position: relative;
}

.admin-autofill-decoy {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
}

/* Admin Container */
.admin-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    max-width: 100%;
    min-width: 0;
}

/* Sidebar */
.admin-sidebar {
    width: 280px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.sidebar-search {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    transition: background 0.3s;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
    gap: 12px;
}

.nav-item i:first-child {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.nav-item span {
    flex: 1;
    font-size: 15px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: #3498db;
    color: white;
}

.nav-arrow {
    font-size: 12px;
    opacity: 0.6;
}

.nav-badge {
    background-color: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-right: auto;
    margin-left: 8px;
}

.notification-badge-small {
    background: #2ecc71;
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: bold;
    margin-right: auto;
}

/* Main Content */
.admin-main {
    flex: 1;
    min-width: 0;
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f5f5f5;
    max-width: 100%;
}

/* Dashboard Content */
.dashboard-content {
    max-width: 1400px;
    margin: 0 auto;
    min-width: 0;
    width: 100%;
}

/* KPI Cards */
.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.kpi-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.kpi-card.kpi-red {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.kpi-card.kpi-orange {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

.kpi-card.kpi-green {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
}

.kpi-card.kpi-blue {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.kpi-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    backdrop-filter: blur(10px);
}

.kpi-icon {
    font-size: 60px;
    opacity: 0.2;
    margin-bottom: 15px;
    position: absolute;
    left: 20px;
    top: 20px;
}

.kpi-content {
    flex: 1;
    position: relative;
    z-index: 1;
}

.kpi-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.95);
}

.kpi-number {
    font-size: 42px;
    font-weight: bold;
    color: white;
    margin-bottom: 10px;
}

.kpi-details-btn {
    margin-top: auto;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    color: white;
    transition: background 0.3s;
    align-self: flex-start;
    backdrop-filter: blur(10px);
    font-weight: 600;
}

.kpi-details-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Widgets Row */
.widgets-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
}

.widget {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.widget-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.widget-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.widget-actions {
    display: flex;
    gap: 10px;
}

.widget-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 5px;
    transition: color 0.3s;
}

.widget-btn:hover {
    color: #555;
}

.widget-badge {
    background: #e74c3c;
    color: white;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: bold;
}

.widget-body {
    padding: 20px;
    flex: 1;
}

/* Notes Widget */
.notes-textarea {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 15px;
    direction: rtl;
}

.notes-textarea:focus {
    outline: none;
    border-color: #3498db;
}

.save-note-btn {
    width: 100%;
    padding: 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.save-note-btn:hover {
    background: #2980b9;
}

/* Online Admins Widget */
.online-admins {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

.admin-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 5px;
    transition: background 0.3s;
}

.admin-item:hover {
    background: #f5f5f5;
}

.admin-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
}

.admin-name {
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.view-link {
    display: block;
    text-align: center;
    color: #3498db;
    text-decoration: none;
    font-size: 14px;
    padding: 10px;
    border-radius: 5px;
    transition: background 0.3s;
}

.view-link:hover {
    background: #f0f8ff;
}

/* Recent Logins Widget */
.login-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.login-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 5px;
    transition: background 0.3s;
}

.login-item:hover {
    background: #f0f0f0;
}

.login-info {
    flex: 1;
}

.login-email {
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 5px;
}

.login-date {
    font-size: 12px;
    color: #999;
}

.status-badge {
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-success {
    background: #d4edda;
    color: #155724;
}

.status-failed {
    background: #f8d7da;
    color: #721c24;
}

/* Footer */
.admin-footer {
    background: white;
    padding: 15px 30px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #999;
}

.footer-left,
.footer-right {
    display: flex;
    align-items: center;
}

/* Responsive Design — پنل ادمین: تا تبلت کوچک هم مثل موبایل (سایدبار کشویی، محتوا تمام‌عرض) */
@media (max-width: 991.98px) {
    /* 100vw شامل عرض اسکرول‌بار است و اغلب اسکرول افقی کاذب می‌دهد */
    html,
    body {
        overflow-x: hidden;
        max-width: 100%;
    }

    .admin-wrapper {
        overflow-x: hidden;
        max-width: 100%;
    }

    .admin-header {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* جلوگیری از کشیده شدن کل صفحه به خاطر جدول/گرید؛ سایدبار ثابت وسط صفحه «شناور» دیده نشود */
    .admin-container {
        /* flex + سایدبار position:fixed در بعضی مرورگرها فضای خالی/اسکرول افقی عجیب می‌دهد؛ block پایدارتر است */
        display: block;
        position: relative;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .admin-main .dashboard-content {
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
    }

    /*
     * سایدبار را با جابجایی «right» بیرون می‌بریم (به‌جای transform) تا در RTL/WebKit گیر نکند.
     * بسته: کاملاً خارج از دید؛ باز: چسبیده به لبهٔ راست ویوپورت.
     */
    .admin-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: auto;
        right: calc(-1 * min(280px, 85vw));
        z-index: 1001;
        height: 100vh;
        height: 100dvh;
        width: min(280px, 85vw);
        max-width: min(280px, 85vw);
        margin: 0;
        transform: none;
        transition: right 0.3s ease, box-shadow 0.3s ease;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    }

    .admin-sidebar.active {
        right: 0;
    }

    .admin-main {
        flex: none;
        display: block;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        padding: 20px;
        margin-right: 0;
        margin-left: 0;
        overflow-x: hidden;
    }

    .kpi-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .widgets-row {
        grid-template-columns: 1fr;
    }

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

    .user-name {
        display: none;
    }

    .header-right {
        gap: 10px;
    }

    .notification-bell {
        padding: 6px 10px;
        font-size: 18px;
    }

    .menu-toggle {
        font-size: 20px;
        padding: 8px;
    }

    /* Overlay for mobile sidebar */
    .admin-wrapper.sidebar-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    /* Cards and tables */
    .card {
        margin-bottom: 20px;
        border-radius: 8px;
    }

    .card-header {
        flex-wrap: wrap;
        gap: 12px;
        align-items: flex-start;
    }

    .table {
        font-size: 14px;
    }

    .table th,
    .table td {
        padding: 8px;
    }

    /* Buttons */
    .btn {
        padding: 8px 16px;
        font-size: 14px;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Forms */
    .form-control {
        font-size: 14px;
        padding: 10px;
    }

    .form-group {
        margin-bottom: 15px;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination .page-link {
        padding: 8px 12px;
        font-size: 14px;
    }

    /* Mobile table improvements */
    #ajax-table-container {
        min-width: 0;
        max-width: 100%;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        min-width: 0;
    }

    /* ردیف‌های بوت‌استرپ: margin منفی در کارت و فیلترها باعث overflow افقی می‌شود */
    .admin-main .card-body > .row,
    .admin-main form .row {
        margin-left: 0;
        margin-right: 0;
    }

    .emp-table-wrapper {
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .emp-list-table {
        font-size: 13px;
    }

    .emp-list-table th {
        background: #f8f9fa;
        font-weight: 600;
        white-space: nowrap;
    }

    .emp-list-table td {
        vertical-align: middle;
    }

    .emp-name-cell {
        min-width: 150px;
    }

    .emp-actions-col {
        min-width: 120px;
        text-align: center;
    }

    .emp-num {
        font-family: 'Vazirmatn', monospace;
        font-weight: 600;
    }

    .employee-profile {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .employee-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        overflow: hidden;
        flex-shrink: 0;
    }

    .employee-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .avatar-placeholder {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: 600;
        font-size: 12px;
    }

    .avatar-initials {
        text-transform: uppercase;
    }
}

@media (max-width: 480px) {
    .admin-header {
        padding: 10px 12px;
    }

    .header-left {
        flex-wrap: wrap;
        gap: 8px;
        row-gap: 6px;
    }

    .employee-panel-header .header-left {
        flex-wrap: nowrap;
    }

    .admin-main {
        padding: 15px;
    }

    .kpi-card {
        padding: 20px;
    }

    .dashboard-title {
        font-size: 14px;
        flex: 1 1 100%;
        min-width: 0;
    }

    .site-brand--header .site-brand__title--inline {
        font-size: 12px;
    }

    .employee-panel-header .user-name {
        max-width: 4.5rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11px;
    }

    .header-right {
        gap: 8px;
    }

    .notification-bell {
        padding: 5px 8px;
        font-size: 16px;
    }

    .user-avatar-circle {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .menu-toggle {
        font-size: 18px;
        padding: 6px;
    }

    /* Table improvements for small screens */
    .emp-list-table {
        font-size: 12px;
    }

    .emp-list-table th,
    .emp-list-table td {
        padding: 6px 4px;
    }

    .employee-avatar,
    .avatar-placeholder {
        width: 28px;
        height: 28px;
    }

    .avatar-placeholder {
        font-size: 10px;
    }

    /* Button improvements */
    .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }

    /* Form improvements */
    .form-control {
        padding: 8px;
        font-size: 13px;
    }

    /* Card improvements */
    .card-body {
        padding: 15px;
    }

    /* Badge improvements */
    .badge {
        font-size: 10px;
        padding: 3px 6px;
    }

    /* Hide less important columns on very small screens */
    .emp-list-table th:nth-child(3),
    .emp-list-table td:nth-child(3) {
        display: none;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

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

/* Bootstrap-like utilities */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #2ecc71;
    color: white;
}

.btn-success:hover {
    background: #27ae60;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-info {
    background: #3498db;
    color: white;
}

.btn-info:hover {
    background: #2980b9;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    vertical-align: middle;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 26px;
    transition: 0.3s;
}
.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    right: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider {
    background-color: #3498db;
}
.toggle-switch.toggle-danger input:checked + .toggle-slider {
    background-color: #e74c3c;
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}
.toggle-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.toggle-wrap .toggle-label { font-weight: 500; font-family: 'Vazirmatn', sans-serif; }
.toggle-wrap .toggle-helper { width: 100%; margin-top: 6px; font-size: 13px; color: #6c757d; font-family: 'Vazirmatn', sans-serif; font-weight: 400; }

.form-section-title {
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
    font-family: 'Vazirmatn', sans-serif;
}
.form-section { margin-bottom: 24px; }

/* Two-column form layout (50% / 50%) - desktop only */
.form-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 24px;
    align-items: start;
}
.form-two-col .form-col { min-width: 0; }
@media (max-width: 767px) {
    .form-two-col { grid-template-columns: 1fr; }
}

/* Collapsible section (card) */
.section-collapsible { margin-bottom: 20px; }
.section-collapsible .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.section-collapsible .section-header:hover { background: #f5f5f5; }
.section-collapsible .section-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    font-family: 'Vazirmatn', sans-serif;
}
.section-collapsible .section-header .collapse-icon {
    transition: transform 0.2s;
    color: #6c757d;
}
.section-collapsible.collapsed .section-header .collapse-icon { transform: rotate(-90deg); }
.section-collapsible .section-body {
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 10px 10px;
}
.section-collapsible.collapsed .section-body { display: none; }
.section-collapsible.collapsed .section-header { border-radius: 10px; }

/* Employee Panel Mobile Styles */
@media (max-width: 768px) {
    .employee-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        left: auto;
        bottom: 0;
        z-index: 1001;
        height: 100vh;
        height: 100dvh;
        width: 280px;
        max-width: min(280px, 85vw);
        transform: translateX(100%);
        transition: transform 0.3s ease;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    }

    .employee-sidebar.active {
        transform: translateX(0);
    }

    .employee-main {
        padding: 20px;
        margin-right: 0;
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
    }

    .employee-header {
        padding: 15px 20px;
    }

    .employee-header .header-title {
        font-size: 16px;
    }

    .employee-header .header-actions {
        gap: 10px;
    }

    .employee-sidebar .sidebar-nav .nav-item {
        padding: 12px 20px;
        font-size: 14px;
    }

    .employee-sidebar .sidebar-nav .nav-item i {
        width: 20px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .employee-header {
        padding: 10px 15px;
    }

    .employee-main {
        padding: 15px;
    }

    .employee-header .header-title {
        font-size: 14px;
    }

    .employee-sidebar .sidebar-nav .nav-item {
        padding: 10px 15px;
        font-size: 13px;
    }

    .employee-sidebar .sidebar-header {
        padding: 15px;
    }

    .employee-sidebar .sidebar-avatar-circle {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
}

.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.card-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Vazirmatn', sans-serif;
}

.card-body {
    padding: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.table th,
.table td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid #e0e0e0;
}

.table th {
    background: #f5f5f5;
    font-weight: 600;
}

.table-striped tbody tr:nth-child(odd) {
    background: #f9f9f9;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
    font-family: 'Vazirmatn', sans-serif;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 400;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
}

.invalid-feedback {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: #721c24;
    font-family: 'Vazirmatn', sans-serif;
}

.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col-md-2, .col-md-3, .col-md-4, .col-md-8 {
    padding: 0 15px;
}

.col-md-2 {
    flex: 0 0 16.666667%;
    max-width: 16.666667%;
}

.col-md-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

.col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

.col-md-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
}

.modal.show {
    display: block;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    max-width: 500px;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.3rem;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.5);
    outline: 0;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    border-top-left-radius: calc(0.3rem - 1px);
    border-top-right-radius: calc(0.3rem - 1px);
}

.modal-title {
    margin-bottom: 0;
    line-height: 1.5;
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    border-bottom-right-radius: calc(0.3rem - 1px);
    border-bottom-left-radius: calc(0.3rem - 1px);
}

.modal-footer > * {
    margin: 0.25rem;
}

.close {
    padding: 1rem;
    margin: -1rem -1rem -1rem auto;
    background: transparent;
    border: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: 0.5;
    cursor: pointer;
}

.close:hover {
    opacity: 0.75;
}

.text-muted {
    color: #6c757d !important;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.text-center {
    text-align: center;
}

/* مودال تأیید / اطلاع (جایگزین confirm/alert) — وسط صفحه، بدون عنوان دامنه */
.modal.admin-app-dialog {
    z-index: 1060;
}

.admin-dialog-content {
    border-radius: 12px;
    overflow: hidden;
}

.admin-dialog-content .admin-dialog-message {
    font-size: 1.05rem;
    line-height: 1.75;
}

@media (max-width: 768px) {
    .col-md-2, .col-md-3, .col-md-4, .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/*
 * پنل کارمند (موبایل): اسکرول افقی کاذب، سایدبار، تقویم جلالی
 * — طعمهٔ autocomplete با left:-9999px در فرم‌ها نادیده گرفته شود (همان الگوی .admin-autofill-decoy)
 */
body.employee-panel-layout .admin-header {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    body.employee-panel-layout .admin-container {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* جدول/فرم عریض کمتر بریده شود؛ اسکرول افقی در سطح html/body کنترل می‌شود */
    body.employee-panel-layout .admin-main {
        overflow-x: visible;
    }

    body.employee-panel-layout .dashboard-content,
    body.employee-panel-layout .card,
    body.employee-panel-layout .card-body {
        max-width: 100%;
        min-width: 0;
    }

    body.employee-panel-layout jdp-overlay {
        z-index: 10049 !important;
    }

    /*
     * بین ~۴۸۲px تا ۷۶۸px کتابخانه فقط absolute می‌گذارد؛ fixed + z-index بالاتر از سایدبار (۱۰۰۱)
     */
    body.employee-panel-layout jdp-container {
        position: fixed !important;
        z-index: 10050 !important;
        left: 50% !important;
        right: auto !important;
        bottom: 0 !important;
        top: auto !important;
        transform: translateX(-50%) !important;
        max-width: 100% !important;
        width: 100% !important;
        min-width: min(100vw, 307.875px) !important;
        border-radius: 4px 4px 0 0;
    }
}
