/*site.css - نسخه بهینه شده*/

/* ===== فونت‌ها ===== */
@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-Regular.woff2') format('woff2'), url('/fonts/Vazirmatn-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-Bold.woff2') format('woff2'), url('/fonts/Vazirmatn-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ===== ریست و پایه ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html, body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    height: 100%;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
}

/* Override فقط برای Kendo */
.k-widget, .k-widget *,
input, button, select, textarea {
    font-family: 'Vazirmatn', Tahoma, sans-serif !important;
}

/* ===== Bootstrap Overrides ===== */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ===== متغیرهای تم روشن ===== */
:root {
    --header-bg: rgba(0, 0, 0, 0.4);
    --sidebar-bg: #2c3e50;
    --sidebar-hover: #34495e;
    --sidebar-active: #3498db;
    --sidebar-text: #ecf0f1;
    --sidebar-border: rgba(255,255,255,0.1);
    --submenu-bg: #1a252f;
    --submenu-hover: #283747;
    --submenu-text: #bdc3c7;
    --content-bg: #f4f6f9;
    --content-text: #2c3e50;
    --shadow: rgba(0,0,0,0.1);
    --menu-toggle-bg: rgba(44, 62, 80, 0.95);
}

/* ===== متغیرهای تم تیره ===== */
body.dark-theme {
    --header-bg: rgba(0, 0, 0, 0.6);
    --sidebar-bg: #1a1a1a;
    --sidebar-hover: #2d2d2d;
    --sidebar-active: #0d7377;
    --sidebar-text: #e0e0e0;
    --sidebar-border: rgba(255,255,255,0.05);
    --submenu-bg: #0d0d0d;
    --submenu-hover: #1f1f1f;
    --submenu-text: #a0a0a0;
    --content-bg: #121212;
    --content-text: #e0e0e0;
    --shadow: rgba(0,0,0,0.3);
    --menu-toggle-bg: rgba(26, 26, 26, 0.95);
}

body {
    background: #f4f6f9; /* fallback */
    background: var(--content-bg);
    color: #2c3e50; /* fallback */
    color: var(--content-text);
}

/* ===== دکمه منو ===== */
.menu-toggle {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1002;
    background: rgba(44, 62, 80, 0.95); /* fallback */
    background: var(--menu-toggle-bg);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .menu-toggle:hover {
        background: #3498db; /* fallback */
        background: var(--sidebar-active);
        transform: scale(1.1);
    }

/* ===== سایدبار ===== */
.sidebar {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: #2c3e50; /* fallback */
    background: var(--sidebar-bg);
    z-index: 1001;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0,0,0,0.3);
    transition: right 0.4s ease;
}

    .sidebar.open {
        right: 0;
    }

.sidebar-header {
    text-align: center;
    padding: 25px 20px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.1); /* fallback */
    border-bottom: 1px solid var(--sidebar-border);
}

    .sidebar-header h5 {
        font-size: 16px;
        font-weight: bold;
        margin: 0;
        color: #ecf0f1; /* fallback */
        color: var(--sidebar-text);
    }

/* ===== منوها ===== */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.menu-item {
    border-bottom: 1px solid rgba(255,255,255,0.1); /* fallback */
    border-bottom: 1px solid var(--sidebar-border);
}

.menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    color: #ecf0f1; /* fallback */
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    font-size: 15px;
}

    .menu-link:hover {
        background: #34495e; /* fallback */
        background: var(--sidebar-hover);
        color: white;
        padding-right: 25px;
    }

    .menu-link.active {
        background: #3498db; /* fallback */
        background: var(--sidebar-active);
        border-right: 4px solid #2980b9;
    }

.menu-icon {
    margin-left: 10px;
    font-size: 18px;
    width: 25px;
    text-align: center;
}

.menu-arrow {
    font-size: 12px;
    transition: transform 0.3s;
}

    .menu-arrow.open {
        transform: rotate(180deg);
    }

/* ===== زیرمنو - بهینه شده ===== */
.submenu {
    list-style: none;
    background: #1a252f; /* fallback */
    background: var(--submenu-bg);
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out;
}

    .submenu.open {
        max-height: 1000px; /* به اندازه کافی بزرگ */
    }

.submenu-item {
    border-bottom: 1px solid rgba(255,255,255,0.1); /* fallback */
    border-bottom: 1px solid var(--sidebar-border);
}

.submenu-link {
    display: block;
    padding: 12px 20px 12px 50px;
    color: #bdc3c7; /* fallback */
    color: var(--submenu-text);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
}

    .submenu-link:hover {
        background: #283747; /* fallback */
        background: var(--submenu-hover);
        color: #3498db; /* fallback */
        color: var(--sidebar-active);
        padding-right: 25px;
    }

    .submenu-link.active {
        background: #283747; /* fallback */
        background: var(--submenu-hover);
        color: #3498db; /* fallback */
        color: var(--sidebar-active);
        border-right: 3px solid #3498db; /* fallback */
        border-right: 3px solid var(--sidebar-active);
    }

/* ===== Overlay ===== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    transition: opacity 0.3s;
}

    .sidebar-overlay.show {
        display: block;
    }

/* ===== هدر ===== */
.layout-header {
    background-image: url('/images/header-bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #2c3e50;
    height: 120px;
    display: flex;
    align-items: center;
    padding: 0 80px 0 30px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1); /* fallback */
    box-shadow: 0 3px 10px var(--shadow);
    position: relative;
}

    .layout-header::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4); /* fallback */
        background: var(--header-bg);
        z-index: 1;
    }

    .layout-header > * {
        position: relative;
        z-index: 2;
    }

.layout-header-title {
    color: white;
    font-size: 24px;
    font-weight: 700;
    flex-grow: 1;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.layout-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
}

    .theme-toggle-btn:hover {
        background: rgba(255, 255, 255, 0.4);
        transform: translateY(-2px);
    }

/* ===== پروفایل کاربر ===== */
.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255,255,255,0.1);
    padding: 8px 20px;
    border-radius: 50px;
    backdrop-filter: blur(5px);
    color: white;
}

    .user-profile i {
        font-size: 20px;
    }

    .user-profile span {
        font-weight: 600;
        font-size: 15px;
        text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    }

.logout-btn {
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    padding: 5px;
}

    .logout-btn:hover {
        color: #ff4757;
        transform: scale(1.15);
    }

/* ===== محتوای اصلی ===== */
.main-content {
    min-height: calc(100vh - 120px);
    padding: 25px;
}

/* ===== Scrollbar ===== */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #1a252f; /* fallback */
    background: var(--submenu-bg);
}

.sidebar::-webkit-scrollbar-thumb {
    background: #34495e; /* fallback */
    background: var(--sidebar-hover);
    border-radius: 4px;
}

    .sidebar::-webkit-scrollbar-thumb:hover {
        background: #3498db; /* fallback */
        background: var(--sidebar-active);
    }

/* ===== رسپانسیو ===== */
@media (max-width: 768px) {
    .layout-header {
        height: 100px;
        padding: 0 70px 0 20px;
    }

    .layout-header-title {
        font-size: 18px;
    }

    .user-profile span {
        display: none;
    }

    .main-content {
        min-height: calc(100vh - 100px);
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .layout-header {
        height: 80px;
        padding: 0 65px 0 15px;
    }

    .layout-header-title {
        font-size: 14px;
    }

    .theme-toggle-btn {
        padding: 6px 12px;
        font-size: 16px;
    }

    .user-profile {
        padding: 6px 15px;
        gap: 10px;
    }

    .main-content {
        min-height: calc(100vh - 80px);
        padding: 10px;
    }

    .menu-toggle {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}


/* اعمال سقف ارتفاع روی تمام گریدها */
.k-grid {
    height: auto !important;
    max-height: calc(100vh - 250px); /* تنظیم نسبت به ارتفاع هدر شما */
    display: flex;
    flex-direction: column;
}

/* اسکرول‌دار کردن بخش بدنه گرید */
.k-grid-content {
    flex: 1;
    overflow-y: auto;
}

/* حل مشکل هم‌ترازی هدر و بدنه در هر دو حالت */
.k-grid-content {
    /* فضا را برای اسکرول‌بار همیشه رزرو نگه می‌دارد حتی اگر محتوا کم باشد */
    scrollbar-gutter: stable;
    overflow-y: auto !important;
}

/* اطمینان از اینکه جداول هدر و بدنه عرض یکسانی دارند */
.k-grid-header table,
.k-grid-content table {
    width: 100% !important;
    table-layout: fixed !important;
}

/* در حالت RTL، کِندو گاهی پدینگ اشتباه اعمال می‌کند */
/*.k-rtl .k-grid-header {
    padding-left: 0 !important;
    padding-right: 0 !important;
}*/

/* تنظیم گرید زمانی که داخل پنجره کِندو قرار دارد */
.k-window-content {
    overflow: hidden !important; /* جلوگیری از اسکرول خودِ ویندو */
}

    .k-window-content .k-grid {
        height: 100% !important;
        display: flex;
        flex-direction: column;
        border-width: 0;
        height: 100% !important;
    }

    .k-window-content .k-grid-content {
        flex: 1;
        overflow-y: auto !important; /* اسکرول فقط اینجا ظاهر شود */
    }

/* فقط وقتی تم تیره فعال است این اوررایدها اعمال شوند */
body.dark-theme .k-grid {
    border-color: #444;
}

body.dark-theme .k-window {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    border-color: var(--sidebar-border);
}

/* هدر گرید در تم تیره */
body.dark-theme .k-grid-header {
    background-color: #252525;
}

.datepicker-plot-area .datepicker-toolbox .unselectable {
    background-color: var(--sidebar-active) !important;
    color: white !important;
    border-radius: 4px;
    padding: 5px 15px;
    cursor: pointer;
}

/* یکسان سازی عرض تمام ورودی‌ها در فرم ویرایش */
.k-edit-form-container .k-edit-field > .k-widget,
.k-edit-form-container .k-edit-field > .k-textbox,
.k-edit-form-container .k-edit-field > input {
    width: 100% !important; /* تمام عرض ستون سمت چپ را پر کن */
    box-sizing: border-box;
}

/* فاصله بین لیبل و اینپوت در حالت پاپ‌آپ */
.k-edit-label {
    width: 30% !important;
    text-align: right;
    padding-right: 10px;
}

.k-edit-field {
    width: 65% !important;
    padding-left: 10px;
}

/* اصلاح جهت آیکون‌های Pager در حالت RTL برای هماهنگی با Tooltip */
.k-rtl .k-pager-nav.k-pager-nav .k-icon {
    transform: scaleX(-1);
}

/* اگر نمی‌خواهید کل آیکون بچرخد، فقط جهت فلش‌های خاص را اصلاح کنید */
.k-rtl .k-i-arrow-60-right::before {
    content: "\e008";
}
/* آیکون سمت چپ */
.k-rtl .k-i-arrow-60-left::before {
    content: "\e002";
}
/* آیکون سمت راست */

/* اصلاح ترتیب چیدمان دکمه‌های صفحه‌بندی در حالت راست‌چین */
.k-rtl .k-pager-numbers-wrap {
    display: flex;
    flex-direction: row-reverse; /* معکوس کردن ترتیب اعداد و فلش‌ها */
}

.k-rtl .k-pager-nav.k-pager-nav {
    /* دکمه‌های ناوبری را بر اساس ترتیب منطقی فارسی مرتب می‌کنیم */
}

/* جابه‌جایی فیزیکی کلیدهای اول/قبلی با بعدی/آخر */
.k-rtl .k-pager-wrap {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
}

/* معکوس کردن کل بخش دکمه‌ها برای رعایت ترتیب فارسی */
.k-rtl .k-pager-numbers-wrap ~ .k-pager-nav,
.k-rtl .k-pager-nav {
    order: 0;
}

/* قطعی‌ترین راه برای جابه‌جایی فلش‌های سمت چپ و راست در کِندو ۲۰۲۴ */
.k-rtl .k-pager-wrap {
    direction: ltr !important; /* منطق داخلی را چپ‌به‌راست نگه می‌داریم */
}

.k-rtl .k-pager-wrap > * {
    direction: rtl !important; /* محتوا را راست‌به‌راست نشان می‌دهیم */
}

/* غیرفعال کردن قابلیت انتخاب متن در تمامی تولتیپ‌های کِندو */
.k-tooltip, .k-tooltip-content {
    user-select: none !important;
    -webkit-user-select: none !important; /* برای مرورگرهای Safari و Chrome قدیمی */
    -moz-user-select: none !important; /* برای Firefox */
    -ms-user-select: none !important; /* برای IE/Edge */
    cursor: default !important; /* تغییر نشانگر موس به حالت پیش‌فرض */
}

/* اصلاح تولتیپ در تم تاریک */
.dark-theme .k-tooltip {
    background-color: #333 !important;
    color: #fff !important;
    border-color: #444 !important;
}

/* استایل عمومی کارت‌های پروفایل */
.profile-card {
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #eee;
}

.profile-card-header {
    background: #fcfcfc;
    border-bottom: 1px solid #f0f0f0;
    padding: 12px 18px;
}

/* اصلاح کارت‌ها در تم تاریک */
.dark-theme .profile-card {
    background-color: #2c2c2c !important;
    border-color: #444 !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.dark-theme .profile-card-header {
    background-color: #383838 !important;
    border-bottom-color: #444 !important;
}

.dark-theme .profile-card h6,
.dark-theme .profile-card label {
    color: #e0e0e0 !important;
}

.dark-theme .profile-avatar-circle {
    background: #383838 !important;
    border-color: #444 !important;
}