/* Tooltip helper for cashier page */
.help-tooltip {
	position: relative;
}
.help-tooltip::after {
	content: attr(data-tooltip);
	position: absolute;
	left: 0;
	bottom: 100%;
	transform: translateY(-6px);
	background: rgba(17,24,39,0.95); /* gray-900 */
	color: #fff;
	font-size: 11px;
	white-space: nowrap;
	padding: 4px 8px;
	border-radius: 4px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.15);
	opacity: 0;
	pointer-events: none;
	transition: opacity .15s ease, transform .15s ease;
	z-index: 9999;
}
.help-tooltip:hover::after {
	opacity: 1;
	transform: translateY(-10px);
}
body {
    font-family: 'Vazirmatn', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f3f4f6;
}
html, body {
    overflow-x: hidden;
}
.sidebar {
    width: 280px;
    transition: all 0.3s ease;
    z-index: 10;
    overflow-x: hidden; /* جلوگیری از اسکرول افقی */
}
/* دکمه همبرگری داخل سایدبار در بالا */
.sidebar-top-toggle { position: sticky; top: 0; background: #fff; z-index: 5; display:flex; justify-content:flex-end; }
.sidebar-top-toggle .sidebar-toggle { width: 36px; height: 36px; }

/* دکمه همبرگری در حالت سایدبار جمع‌شده (دسکتاپ) را بالای آیکون‌ها نگه دار */
@media (min-width: 1025px) {
  body.sidebar-collapsed .sidebar-top-toggle { display: flex; justify-content: flex-end; }
}
/* قوانین فقط برای حالت جمع‌شده در ادامه تعریف می‌شود */
/* قوانین عمومی برای حالت جمع‌شده، بدون وابستگی به عرض صفحه */
body.sidebar-collapsed .sidebar .nav-link span { display: none !important; }
body.sidebar-collapsed .sidebar p.uppercase { display: none !important; }
/* پنهان کردن فلش کنار منوهای کشویی (فقط در دکمه‌های کشویی) */
body.sidebar-collapsed .sidebar button.nav-link > i.fa-chevron-down { display: none !important; }
/* نمایش آیکون‌های اصلی آیتم‌ها و عدم نمایش فلش‌ها */
body.sidebar-collapsed .sidebar .nav-link i:not(.fa-chevron-down) { display: inline-flex !important; }

.main-content {
    margin-right: 280px;
    transition: all 0.3s ease;
    flex-grow: 1;
    margin-bottom: 5rem;
}
/* حالت جمع‌شده سایدبار در دسکتاپ (RTL): فقط باریک می‌شود و آیکون‌ها باقی می‌مانند */
@media (min-width: 1025px) {
    body.sidebar-collapsed .sidebar {
        width: 56px;
    }
    body.sidebar-collapsed .main-content {
        margin-right: 56px;
        width: calc(100% - 56px);
    }
    /* متن‌ها و برچسب‌ها مخفی شوند؛ فقط آیکون‌ها بمانند */
    body.sidebar-collapsed .sidebar .nav-link span {
        display: none !important;
    }
    /* دکمه‌های nav-link در حالت جمع‌شده وسط‌چین شوند */
    body.sidebar-collapsed .sidebar .nav-link {
        display: flex;
        align-items: center;
        justify-content: center !important;
        gap: 0 !important;
        padding: 0.5rem 0.5rem;
        min-height: 44px;
        width: 100% !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
        text-align: center !important;
    }
    /* آیکون‌ها تمام عرض ردیف را اشغال نکنند، اما وسط باشند */
    body.sidebar-collapsed .sidebar .nav-link i {
        margin-left: 0 !important;
        width: 24px;
        height: 24px;
        line-height: 24px;
        text-align: center;
        font-size: 1.1rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 0 !important;
        margin-inline: auto !important;
    }
    /* اطمینان از اینکه wrapper داخلی لینک‌ها مزاحم مرکز شدن نباشد */
    body.sidebar-collapsed .sidebar .nav-link > div {
        display: contents !important;
    }
    /* متن‌ها در حالت جمع‌شده دسکتاپ قطعاً مخفی باشند */
    body.sidebar-collapsed .sidebar .nav-link > span {
        display: none !important;
    }
    /* تیتر گروه‌ها پنهان شوند */
    body.sidebar-collapsed .sidebar p.uppercase {
        display: none !important;
    }
    /* فلش‌های منوهای کشویی پنهان شوند */
    body.sidebar-collapsed .sidebar .fa-chevron-down {
        display: none !important;
    }
    /* هرگونه بج/برچسب کنار آیتم‌ها پنهان شود */
    body.sidebar-collapsed .sidebar .upgrade-badge {
        display: none !important;
    }

    /* Override نهایی برای app-sidebar در base.html:
       در حالت collapse همه آیتم‌ها دقیقا وسط ستون بایستند. */
    body.sidebar-collapsed #app-sidebar nav.space-y-1 {
        align-items: stretch !important;
        gap: 2px !important;
    }
    body.sidebar-collapsed #app-sidebar a,
    body.sidebar-collapsed #app-sidebar button {
        width: 100% !important;
    }
    body.sidebar-collapsed #app-sidebar a.nav-link,
    body.sidebar-collapsed #app-sidebar div.relative > button.nav-link {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 44px !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
        text-align: center !important;
    }
    body.sidebar-collapsed #app-sidebar .nav-link > .flex.items-center {
        width: 100% !important;
        justify-content: center !important;
    }
    body.sidebar-collapsed #app-sidebar .nav-link i,
    body.sidebar-collapsed #app-sidebar .nav-link .flex.items-center > i {
        margin-right: 0 !important;
        margin-left: 0 !important;
        margin-inline: 0 !important;
    }
    body.sidebar-collapsed #app-sidebar .sidebar-top-toggle {
        justify-content: center !important;
    }
    body.sidebar-collapsed #app-sidebar .sidebar-current-module {
        border-right-width: 0 !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
        display: flex;
        justify-content: center;
    }
    body.sidebar-collapsed #app-sidebar .sidebar-current-module-label,
    body.sidebar-collapsed #app-sidebar .sidebar-current-module-name span {
        display: none !important;
    }
    body.sidebar-collapsed #app-sidebar .sidebar-current-module-name {
        margin: 0 !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
    body.sidebar-collapsed #app-sidebar .sidebar-current-module-icon {
        margin: 0 !important;
    }
}
/* دسکتاپ: محتوای اصلی با فاصله از سایدبار */
@media (min-width: 1025px) {
    .main-content {
        width: calc(100% - 280px);
        box-sizing: border-box;
    }
}
.nav-link {
    position: relative;
    transition: all 0.3s ease;
    border-radius: 0.5rem;
    margin: 0.25rem 0;
}
.nav-link:hover {
    background-color: rgba(59, 130, 246, 0.1);
}
.nav-link.active {
    background-color: #3B82F6;
    color: white;
}
.nav-link.active i {
    color: white;
}
/* موبایل و تبلت: سایدبار به صورت drawer */
@media (max-width: 1024px) {
    .sidebar,
    #app-sidebar {
        transform: translateX(100%);
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        height: 100vh;
        z-index: 50;
    }
    .sidebar.open,
    #app-sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-right: 0;
    }
}

/* نوار اسکرول باریک برای سایدبار (WebKit) */
.sidebar::-webkit-scrollbar { width: 2px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.3); border-radius: 4px; }

/* نوار اسکرول باریک برای مرورگرهای مدرن */
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.4) transparent; }
.upgrade-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}
.active-sub-item {
    background-color: rgba(59, 130, 246, 0.2); /* bg-blue-100 */
    color: #1e40af; /* text-blue-800 */
    font-weight: 600;
}

.search-result-item.active {
    background-color: #f3f4f6 !important;
}

.search-results {
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Docs layout */
.docs-container {
    max-width: 1200px;
}
.docs-card, .docs-toc {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.docs-card {
    padding: 24px;
}
.docs-toc {
    padding: 16px 18px;
    position: sticky;
    top: 90px;
}
.docs-toc .title {
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 10px;
}
.docs-link {
    display: block;
    padding: 6px 0;
    color: #111827;
    text-decoration: none;
    border-radius: 8px;
}
.docs-link:hover { color: #0d6efd; }
.docs-link.active { color: #0d6efd; font-weight: 800; }
.docs-sub a { color: #6b7280; text-decoration: none; display: block; padding: 4px 0; }
.docs-sub a:hover { color: #0d6efd; }

html { scroll-behavior: smooth; }
