@import url('yekan-bakh.css');

/**
 * ERP Core Unified Typography & Number Styling
 * - Unified Yekan Bakh Font (یکان باخ) for all text, headings, tables, and numbers (fallback: Vazirmatn)
 * - Persian Digits enabled everywhere via OpenType ss01 (Stylistic Set 1)
 * - Tabular figures (tnum) for aligned accounting numbers & tables
 * - Thousand separator styling for monetary inputs & display
 */

/* 1. Local Vazirmatn Font Faces (as secondary fallback) */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Light.woff2') format('woff2'),
         url('/fonts/Vazirmatn-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2'),
         url('/fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2'),
         url('/fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-SemiBold.woff2') format('woff2'),
         url('/fonts/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2'),
         url('/fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Black.woff2') format('woff2'),
         url('/fonts/Vazirmatn-Black.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* Fallback/Alias 'Vazir' font family */
@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2'),
         url('/fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2'),
         url('/fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* 2. Global Unified Font: Yekan Bakh for EVERY element, including font-mono */
html, body, button, input, optgroup, select, textarea,
h1, h2, h3, h4, h5, h6, p, span, a, td, th, label, div,
code, pre, kbd, samp, table, tr,
.font-mono, [class*="font-mono"],
.font-sans, [class*="font-sans"] {
    font-family: 'Yekan Bakh', 'Yekan-Bakh', 'YekanBakh', 'bakh', 'Vazirmatn', 'Vazir', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* 2.1 Global Weight Normalization: Clamp font-black (900) & font-extrabold (800) to crisp Bold (700) */
.font-black, [class*="font-black"],
.font-extrabold, [class*="font-extrabold"] {
    font-weight: 700 !important;
}

/* 3. Display ALL Numbers in Persian (ss01) with Tabular figures (tnum) */
html, body, * {
    font-feature-settings: "ss01" 1, "tnum" 1 !important;
    -webkit-font-feature-settings: "ss01" 1, "tnum" 1 !important;
    -moz-font-feature-settings: "ss01" 1, "tnum" 1 !important;
    font-variant-numeric: tabular-nums !important;
}

/* Ensure form controls and table cells inherit Persian digits and font */
input, textarea, select, button, table, td, th {
    font-family: 'Yekan Bakh', 'Yekan-Bakh', 'YekanBakh', 'bakh', 'Vazirmatn', 'Vazir', sans-serif !important;
    font-feature-settings: "ss01" 1, "tnum" 1 !important;
    -webkit-font-feature-settings: "ss01" 1, "tnum" 1 !important;
    -moz-font-feature-settings: "ss01" 1, "tnum" 1 !important;
    font-variant-numeric: tabular-nums !important;
}

/* 4. Monetary input fields styling */
input.money-input,
input.price-input,
input.debit-input,
input.credit-input,
input.discount-input,
input.amount-input,
input.salary-input,
input[data-money="true"] {
    direction: ltr !important;
    text-align: left !important;
    font-variant-numeric: tabular-nums !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
}

/* Display money values */
.money-value, [data-currency] {
    font-variant-numeric: tabular-nums !important;
    font-feature-settings: "ss01" 1, "tnum" 1 !important;
}

/* 5. Complete Suppression of jdp-container / jdp-overlay */
jdp-container,
jdp-overlay {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    z-index: -9999 !important;
}

/* Date input styling */
input[data-jdp],
input[type="date"],
input.persian-datepicker-input,
input.datepicker,
input.pdate,
input.date-picker,
input.persian-date,
input.shamsi-date {
    font-family: 'Yekan Bakh', 'Yekan-Bakh', 'YekanBakh', 'bakh', 'Vazirmatn', 'Vazir', sans-serif !important;
    font-feature-settings: "ss01" 1, "tnum" 1 !important;
    -webkit-font-feature-settings: "ss01" 1, "tnum" 1 !important;
    direction: ltr !important;
    text-align: center !important;
    font-variant-numeric: tabular-nums !important;
    cursor: pointer !important;
}

input[data-jdp]::placeholder,
input.persian-datepicker-input::placeholder,
input.datepicker::placeholder,
input.pdate::placeholder {
    font-family: 'Yekan Bakh', 'Yekan-Bakh', 'YekanBakh', 'bakh', sans-serif !important;
    direction: rtl !important;
    text-align: center !important;
    color: #94a3b8 !important;
}

/* 6. استایل استاندارد و سراسری سلکت‌باکس‌ها (یکپارچگی فلش دراپ‌داون و رفع چسبیدن به لبه راست/چپ) */
select:not([multiple]):not([size]),
select[size="1"] {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: left 0.875rem center !important;
    background-size: 1rem 1rem !important;
    padding-left: 2.25rem !important;
    cursor: pointer;
}

select:not([multiple]):not([size]):focus,
select[size="1"]:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

select:disabled {
    cursor: not-allowed !important;
    opacity: 0.65 !important;
}

select::-ms-expand {
    display: none;
}

/* جهت چپ‌چین در موارد خاص LTR */
[dir="ltr"] select:not([multiple]):not([size]),
select[dir="ltr"]:not([multiple]):not([size]) {
    background-position: right 0.875rem center !important;
    padding-right: 2.25rem !important;
    padding-left: 0.75rem !important;
}

/* سلکت‌باکس‌های فشرده درون سطر جدول */
table td select:not([multiple]):not([size]),
table th select:not([multiple]):not([size]) {
    background-position: left 0.5rem center !important;
    background-size: 0.85rem 0.85rem !important;
    padding-left: 1.5rem !important;
}


/* =================================================================
   ۷. حالت حریم خصوصی سامانه (Privacy Mode Engine - مخفی‌سازی و بلور هوشمند)
   ================================================================= */
body.privacy-mode #appsGrid .app-card,
body.privacy-mode .app-card,
body.privacy-mode .privacy-blur,
body.privacy-mode [data-privacy="blur"],
body.privacy-mode .money-formatted,
body.privacy-mode .table-amount,
body.privacy-mode .money-value,
body.privacy-mode .sensitive-data,
body.privacy-mode .stat-value,
body.privacy-mode .financial-amount,
body.privacy-mode .erp-amount,
body.privacy-mode [data-amount],
body.privacy-mode .privacy-mask {
    filter: blur(8px) !important;
    user-select: none !important;
    transition: filter 0.25s ease-in-out;
}

body.privacy-mode #appsGrid .app-card:hover,
body.privacy-mode .app-card:hover,
body.privacy-mode .privacy-blur:hover,
body.privacy-mode [data-privacy="blur"]:hover,
body.privacy-mode .money-formatted:hover,
body.privacy-mode .table-amount:hover,
body.privacy-mode .money-value:hover,
body.privacy-mode .sensitive-data:hover,
body.privacy-mode .stat-value:hover,
body.privacy-mode .financial-amount:hover,
body.privacy-mode .erp-amount:hover,
body.privacy-mode [data-amount]:hover,
body.privacy-mode .privacy-mask:hover {
    filter: blur(0px) !important;
}

/* =================================================================
   ۸. تولتیپ‌های زیبا، مدرن و اختصاصی با فونت یکان‌باخ (Yekan Bakh Tooltip)
   ================================================================= */
.erp-tooltip {
    position: fixed;
    z-index: 9999999;
    pointer-events: none;
    background: #0f172a;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    font-family: 'Yekan Bakh', 'Yekan-Bakh', 'YekanBakh', 'bakh', sans-serif !important;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: normal;
    direction: rtl;
    text-align: center;
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.35), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px) scale(0.96);
    transition: opacity 0.16s cubic-bezier(0.4, 0, 0.2, 1), transform 0.16s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.16s;
}

.erp-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* فلش کوچک اشاره‌گر تولتیپ (Arrow) */
.erp-tooltip::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: rgba(15, 23, 42, 0.94);
    transform: rotate(45deg);
}

.erp-tooltip.arrow-top::before {
    top: -4px;
    left: 50%;
    margin-left: -4px;
    border-left: 1px solid rgba(255, 255, 255, 0.14);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.erp-tooltip.arrow-bottom::before {
    bottom: -4px;
    left: 50%;
    margin-left: -4px;
    border-right: 1px solid rgba(255, 255, 255, 0.14);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

/* ==========================================================================
   استایل‌ها و انیمیشن‌های سیستم نوتیفیکیشن ERP (ERP Notification Styles)
   ========================================================================== */

@keyframes bellWiggle {
    0% { transform: rotate(0); }
    15% { transform: rotate(14deg); }
    30% { transform: rotate(-14deg); }
    45% { transform: rotate(10deg); }
    60% { transform: rotate(-8deg); }
    75% { transform: rotate(4deg); }
    100% { transform: rotate(0); }
}

#notifications-bell-btn:hover i {
    animation: bellWiggle 0.8s ease-in-out infinite;
    transform-origin: top center;
}

#erp-toasts-container > div {
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.4), 0 0 1px 1px rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   موتور سراسری استایل‌دهی فیلدهای انتخابی ERP (Unified Custom Select Engine)
   ایجاد منوی شناور مدرن، گرد و شیشه‌ای کاملاً هماهنگ با دیزاین فیلد ورودی
   ========================================================================== */

/* مخفی‌سازی دسترس‌پذیر المان بومی بدون حذف از فرم و چرخه DOM */
.erp-select-native-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ظرف بیرونی المان انتخابی */
.erp-select-wrapper {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.erp-select-wrapper.w-full {
    display: block;
    width: 100%;
}

.erp-select-wrapper.flex-1 {
    display: block;
    flex: 1 1 0%;
    min-width: 0;
    width: 100%;
}

/* دکمه محرک فیلد انتخابی (Trigger) */
.erp-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
    user-select: none;
    text-align: right;
    transition: all 0.15s ease-in-out;
    outline: none;
    font-family: 'Yekan Bakh', 'Yekan-Bakh', sans-serif !important;
}

.erp-select-trigger:focus-visible {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.erp-select-trigger.is-open {
    background-color: #ffffff !important;
    border-color: #10b981 !important; /* Emerald 500 */
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}

.erp-select-trigger.is-open .erp-select-chevron {
    transform: rotate(180deg);
    color: #10b981 !important;
}

.erp-select-trigger[class*="border-rose"].is-open {
    border-color: #f43f5e !important;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2) !important;
}
.erp-select-trigger[class*="border-rose"].is-open .erp-select-chevron {
    color: #f43f5e !important;
}

.erp-select-trigger[class*="border-indigo"].is-open {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
}
.erp-select-trigger[class*="border-indigo"].is-open .erp-select-chevron {
    color: #6366f1 !important;
}

.erp-select-trigger[class*="border-amber"].is-open {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2) !important;
}
.erp-select-trigger[class*="border-amber"].is-open .erp-select-chevron {
    color: #f59e0b !important;
}

/* منوی بازشونده شناور (Dropdown Menu) */
.erp-select-dropdown {
    position: fixed;
    z-index: 999999;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 1rem; /* rounded-2xl */
    box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.12), 0 6px 14px -2px rgba(15, 23, 42, 0.06);
    padding: 0.375rem;
    box-sizing: border-box;
    font-family: 'Yekan Bakh', 'Yekan-Bakh', sans-serif !important;
    direction: rtl;
    text-align: right;
    opacity: 0;
    transform: scale(0.97) translateY(-4px);
    transform-origin: top center;
    transition: opacity 0.14s cubic-bezier(0.16, 1, 0.3, 1), transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    visibility: hidden;
}

.erp-select-dropdown.is-open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
    visibility: visible;
}

.erp-select-dropdown.is-above {
    transform-origin: bottom center;
    transform: scale(0.97) translateY(4px);
}

.erp-select-dropdown.is-above.is-open {
    transform: scale(1) translateY(0);
}

/* فیلد جستجوی زنده داخل منوی شناور */
.erp-select-search-wrapper {
    position: relative;
    padding: 0.25rem 0.25rem 0.375rem;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 0.25rem;
}

.erp-select-search-input {
    width: 100%;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    padding: 0.35rem 1.85rem 0.35rem 0.5rem;
    font-size: 0.75rem;
    color: #334155;
    outline: none;
    font-family: 'Yekan Bakh', 'Yekan-Bakh', sans-serif !important;
    transition: all 0.15s ease;
}

.erp-select-search-input:focus {
    background-color: #ffffff;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.erp-select-search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.65rem;
    pointer-events: none;
}

/* اسکرول و محفظه گزینه‌ها */
.erp-select-options {
    max-height: 240px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.125rem;
}

.erp-select-options::-webkit-scrollbar {
    width: 4px;
}
.erp-select-options::-webkit-scrollbar-track {
    background: transparent;
}
.erp-select-options::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.erp-select-options::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* هر ردیف گزینه داخل منو */
.erp-select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.65rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    user-select: none;
    transition: all 0.12s ease;
}

.erp-select-option:hover,
.erp-select-option.is-highlighted {
    background-color: #f1f5f9;
    color: #0f172a;
}

.erp-select-option.is-selected {
    background-color: #ecfdf5;
    color: #065f46;
    font-weight: 700;
}

.erp-select-option.is-selected:hover {
    background-color: #d1fae5;
}

.erp-select-option.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.erp-select-option .erp-select-check {
    color: #10b981;
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* وضعیت خالی در جستجو */
.erp-select-empty {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* استایل پشتیبان المان‌های select بومی جهت حفظ سازگاری */
select:not(.erp-select-native-hidden) option {
    background-color: #ffffff;
    color: #1e293b;
    padding: 8px 12px;
    font-family: 'Yekan Bakh', 'Yekan-Bakh', sans-serif !important;
}

/* ==========================================================================
   اسکرول‌بار مدرن و ظریف سیستم ERP (Unified Custom Scrollbar)
   رفع کامل بیرون‌زدگی اسکرول از گوشه‌های گرد سایدبار و المان‌های سیستم
   ========================================================================== */
.custom-scrollbar {
    scrollbar-width: thin !important;
    scrollbar-color: rgba(203, 213, 225, 0.7) transparent !important;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 5px !important;
    height: 5px !important;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent !important;
    margin: 4px 0 !important;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(203, 213, 225, 0.7) !important;
    border-radius: 9999px !important;
    transition: background-color 0.2s ease !important;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(148, 163, 184, 0.95) !important;
}

.custom-scrollbar::-webkit-scrollbar-corner {
    background: transparent !important;
}

/* ==================== Global Dark Mode Theme  ==================== */
html.dark body {
    background-color: #0b1120 !important;
    color: #e2e8f0 !important;
}

html.dark header {
    background-color: #111827 !important;
    border-color: #1f2937 !important;
    color: #f1f5f9 !important;
}

html.dark header h1, 
html.dark header h2, 
html.dark header h3 {
    color: #f8fafc !important;
}

html.dark aside#moduleSidebar,
html.dark aside#accountingSidebar,
html.dark .bg-white {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

html.dark .bg-slate-50,
html.dark .bg-slate-50\/40,
html.dark .bg-slate-50\/50,
html.dark .bg-slate-50\/60,
html.dark .bg-slate-50\/70,
html.dark .bg-slate-50\/80,
html.dark .bg-slate-100,
html.dark .bg-slate-100\/60,
html.dark .bg-slate-100\/80,
html.dark .bg-slate-100\/90 {
    background-color: #0f172a !important;
    border-color: #1e293b !important;
    color: #cbd5e1 !important;
}

html.dark .text-slate-900,
html.dark .text-slate-800,
html.dark .text-slate-700 {
    color: #f8fafc !important;
}

html.dark .text-slate-600,
html.dark .text-slate-500 {
    color: #94a3b8 !important;
}

html.dark .border-slate-100,
html.dark .border-slate-200,
html.dark .border-slate-200\/60,
html.dark .border-slate-200\/80,
html.dark .border-slate-200\/90 {
    border-color: #334155 !important;
}

html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
html.dark select,
html.dark textarea {
    background-color: #0f172a !important;
    border-color: #475569 !important;
    color: #f8fafc !important;
}

html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):focus,
html.dark select:focus,
html.dark textarea:focus {
    background-color: #1e293b !important;
    border-color: #6366f1 !important;
}

html.dark table thead tr {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

html.dark table tbody tr {
    border-color: #334155 !important;
}

html.dark table tbody tr:hover {
    background-color: rgba(51, 65, 85, 0.4) !important;
}

html.dark .shadow-xs,
html.dark .shadow-sm,
html.dark .shadow-md,
html.dark .shadow-lg,
html.dark .shadow-xl {
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5) !important;
}






