body {
    font-family: Tahoma, "Vazirmatn", Arial, sans-serif;
    background: #f4f6f9;
}
.navbar-brand { font-weight: bold; }
.app-container { padding: 20px; max-width: 1300px; margin: 0 auto; }
.card { border: none; box-shadow: 0 1px 4px rgba(0,0,0,0.08); margin-bottom: 20px; }
table input.cell-input {
    width: 100%; border: 1px solid #ddd; border-radius: 4px; padding: 4px 6px;
}
.product-search-wrapper { position: relative; }
.product-dropdown {
    position: absolute; z-index: 1000; background: #fff; border: 1px solid #ccc;
    border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 280px; overflow-y: auto; width: 320px; top: 100%; right: 0;
}
.product-dropdown .item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f0f0f0; }
.product-dropdown .item:last-child { border-bottom: none; }
.product-dropdown .item.active, .product-dropdown .item:hover { background: #e7f1ff; }
.product-dropdown .item small { color: #888; display: block; }
.zero-stock { color: #c00; }
.text-end-num { text-align: left; direction: ltr; }
.nav-link.active { font-weight: bold; }
.print-only { display: none; }

@media print {
    .no-print { display: none !important; }
    .print-only { display: block !important; }
    body { background: #fff; }
}

.receipt-80mm { width: 76mm; font-size: 11px; padding: 4px; }
.receipt-80mm table { width: 100%; border-collapse: collapse; }
.receipt-80mm th, .receipt-80mm td { border-bottom: 1px dashed #999; padding: 3px 2px; font-size: 10px; }

.label-box {
    width: 56mm; height: 36mm; border: 1px dashed #aaa; padding: 4mm;
    font-size: 11px; box-sizing: border-box; page-break-after: always;
}
.label-box h6 { font-size: 12px; margin-bottom: 4px; }

/* رفع تداخل z-index کتابخانه تقویم جلالی (JalaliDatePicker) با مودال‌های Bootstrap.
   این کتابخانه از یک تگ سفارشی <jdp-container> با z-index:1000 (inline) استفاده می‌کند
   که از مودال بوت‌استرپ (z-index:1055) پایین‌تر است؛ با !important آن را هم‌سطح مودال می‌بریم. */
jdp-container {
    z-index: 1055 !important;
}
jdp-overlay {
    z-index: 1054 !important;
}

/* صفحه ورود */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f4f6f9;
}
.login-box {
    background: #fff;
    padding: 36px 32px;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 360px;
}

/* ===== سایدبار عمودی ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #1e2433;
    color: #cfd3dc;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 20px 18px;
    font-size: 17px;
    font-weight: bold;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-group-title {
    font-size: 11px;
    color: #7c8294;
    padding: 16px 18px 6px;
    letter-spacing: 0.5px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: #cfd3dc;
    text-decoration: none;
    font-size: 14px;
    border-right: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.sidebar-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.sidebar-link.active {
    background: rgba(13,110,253,0.18);
    color: #fff;
    border-right-color: #0d6efd;
    font-weight: bold;
}
.sidebar-link i {
    font-size: 16px;
    width: 18px;
    text-align: center;
}
.sidebar-footer {
    margin-top: auto;
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 13px;
}
.main-content {
    flex: 1;
    min-width: 0;
    background: #f4f6f9;
}
.topbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
}
.main-content-inner {
    padding: 24px;
    max-width: 1300px;
    margin: 0 auto;
}

/* حالت موبایل: سایدبار به‌صورت پنل کشویی */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        right: 0;
        top: 0;
        z-index: 2000;
        transform: translateX(100%);
        transition: transform 0.2s ease;
        box-shadow: -4px 0 16px rgba(0,0,0,0.2);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .topbar-toggle {
        display: block;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1999;
    }
    .sidebar-overlay.open {
        display: block;
    }
}

/* انیمیشن Toast */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* ===== استایل‌های InvoiceAutoComplete ===== */
.invoice-autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.invoice-autocomplete-wrapper .input-wrapper {
    position: relative;
    width: 100%;
}

.invoice-autocomplete-wrapper input.cell-input {
    width: 100%;
    padding: 6px 12px 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.invoice-autocomplete-wrapper input.cell-input:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.invoice-autocomplete-wrapper .clear-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    font-size: 14px;
    padding: 0 4px;
    transition: color 0.15s;
    z-index: 1;
}

.invoice-autocomplete-wrapper .clear-btn:hover {
    color: #dc3545;
}

/* ===== Dropdown استایل‌های ===== */
.invoice-dropdown {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 250px;
    overflow-y: auto;
}

/* ✅ اسکرول‌بار سفارشی */
.invoice-dropdown::-webkit-scrollbar {
    width: 6px;
}

.invoice-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.invoice-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.invoice-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.invoice-dropdown .item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s, border-color 0.15s;
}

.invoice-dropdown .item:last-child {
    border-bottom: none;
}

/* ✅ هایلایت آیتم فعال (کیبورد یا hover) */
.invoice-dropdown .item.active {
    background: #e3f2fd !important;
    border-color: #90caf9;
    border-left: 3px solid #1976d2;
}

/* ✅ استایل hover */
.invoice-dropdown .item:hover:not(.active) {
    background: #f5f5f5 !important;
}

/* ✅ آیتم بدون نتیجه */
.invoice-dropdown .item.no-result {
    color: #999;
    cursor: default;
    text-align: center;
    padding: 20px;
    background: #fafafa !important;
}

.invoice-dropdown .item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    flex-wrap: wrap;
    gap: 4px;
}

.invoice-dropdown .item-main {
    font-weight: 500;
    color: #333;
    font-size: 14px;
    flex: 1;
}

.invoice-dropdown .item-main strong {
    color: #0066cc;
    background: #e8f0fe;
    padding: 0 2px;
    border-radius: 2px;
}

.invoice-dropdown .invoice-number {
    font-size: 11px;
    color: #6c757d;
    background: #f8f9fa;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.invoice-dropdown .item-date {
    font-size: 11px;
    color: #6c757d;
    background: #f8f9fa;
    padding: 1px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.invoice-dropdown .item-detail {
    font-size: 12px;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.invoice-dropdown .item-detail span {
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.invoice-dropdown .item-detail .detail-mobile {
    color: #0d6efd;
}

.invoice-dropdown .item-detail .detail-postal {
    color: #198754;
}

.invoice-dropdown .item-detail .detail-address {
    color: #6f42c1;
}
