/* ================================================================
   assets/css/invoice.css
   فاکتور سفارش — Next Pro
   ================================================================ */

:root {
    --inv-primary   : #00baba;
    --inv-ink       : #1c1b19;
    --inv-muted     : #6b7280;
    --inv-line      : #e5e7eb;
    --inv-bg        : #f9fafb;
    --inv-radius    : 12px;
    --inv-font      : 'Vazirmatn', 'Tahoma', sans-serif;
}

/* ── PRINT BODY ───────────────────────────────────────────────── */
.inv-print-body {
    margin: 0;
    padding: 20px;
    background: #fff;
    font-family: var(--inv-font);
    color: var(--inv-ink);
    direction: rtl;
    font-size: 13px;
    line-height: 1.7;
}

/* ── WRAP ─────────────────────────────────────────────────────── */
.inv-wrap {
    max-width: 860px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--inv-line);
    border-radius: var(--inv-radius);
    overflow: hidden;
}

/* ── HEADER ───────────────────────────────────────────────────── */
.inv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding: 28px 32px;
    background: var(--inv-bg);
    border-bottom: 2px solid var(--inv-primary);
}

.inv-logo { max-height: 60px; max-width: 160px; object-fit: contain; }
.inv-logo-text { font-size: 22px; font-weight: 900; color: var(--inv-primary); }

.inv-shop-info {
    margin-top: 10px;
    font-size: 12px;
    color: var(--inv-muted);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.inv-header-meta { text-align: left; flex-shrink: 0; }

.inv-badge {
    display: inline-block;
    background: var(--inv-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.inv-meta-table { border-collapse: collapse; font-size: 12.5px; }
.inv-meta-table td { padding: 3px 10px; }
.inv-meta-table td:first-child { color: var(--inv-muted); white-space: nowrap; }
.inv-meta-table td:last-child  { font-weight: 600; }

.inv-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: #e5e7eb;
    color: #374151;
}
.inv-status--completed  { background: #d1fae5; color: #065f46; }
.inv-status--processing { background: #dbeafe; color: #1e40af; }
.inv-status--on-hold    { background: #fef3c7; color: #92400e; }
.inv-status--cancelled,
.inv-status--refunded   { background: #fee2e2; color: #991b1b; }
.inv-status--pending    { background: #f3f4f6; color: #6b7280; }

/* ── PARTIES ──────────────────────────────────────────────────── */
.inv-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-bottom: 1px solid var(--inv-line);
}

.inv-party {
    padding: 20px 32px;
    font-size: 13px;
    line-height: 1.8;
}

.inv-party:first-child { border-left: 1px solid var(--inv-line); }

.inv-party-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--inv-primary);
    margin-bottom: 6px;
}

.inv-party-name { font-size: 15px; font-weight: 800; margin-bottom: 4px; }

/* ── TABLE ────────────────────────────────────────────────────── */
.inv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.inv-table thead { background: var(--inv-ink); color: #fff; }
.inv-table thead th {
    padding: 11px 16px;
    text-align: right;
    font-weight: 700;
    font-size: 12px;
}

.inv-table tbody tr { border-bottom: 1px solid var(--inv-line); }
.inv-table tbody tr:nth-child(even) { background: var(--inv-bg); }
.inv-table tbody tr:hover { background: #f0fafa; }

.inv-table td { padding: 12px 16px; vertical-align: top; }

.inv-th-num,
.inv-td-center { text-align: center !important; width: 40px; }

.inv-td-money  { text-align: left !important; white-space: nowrap; font-weight: 600; }
.inv-discount  { color: #dc2626; }
.inv-total-cell { color: var(--inv-primary); font-weight: 800; }

.inv-item-name { font-weight: 700; }
.inv-item-sku  { font-size: 11px; color: var(--inv-muted); margin-top: 2px; }
.inv-item-attr { font-size: 11px; color: var(--inv-muted); }

/* ── SUMMARY ──────────────────────────────────────────────────── */
.inv-summary-wrap {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding: 24px 32px;
    border-top: 1px solid var(--inv-line);
}

.inv-notes { font-size: 12.5px; color: var(--inv-muted); flex: 1; line-height: 2; }
.inv-note-box { background: #fef9c3; border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; color: #78350f; }

.inv-totals { min-width: 280px; }

.inv-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed var(--inv-line);
    font-size: 13px;
}
.inv-totals-row:last-child { border-bottom: none; }

.inv-totals-discount { color: #dc2626; }

.inv-totals-final {
    background: var(--inv-primary);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    margin-top: 8px;
    font-size: 15px;
    font-weight: 800;
    border: none;
}

/* ── SIGNATURE ────────────────────────────────────────────────── */
.inv-signature-row {
    display: flex;
    gap: 24px;
    padding: 24px 32px;
    border-top: 1px solid var(--inv-line);
}
.inv-signature-box {
    flex: 1;
    border: 1px dashed var(--inv-line);
    border-radius: 8px;
    height: 90px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
}
.inv-signature-label { font-size: 11px; color: var(--inv-muted); }

/* ── FOOTER ───────────────────────────────────────────────────── */
.inv-footer {
    background: var(--inv-ink);
    color: #9ca3af;
    text-align: center;
    padding: 14px 32px;
    font-size: 12px;
    line-height: 1.8;
}
.inv-footer-url { color: var(--inv-primary); margin-top: 2px; }

/* ── PRINT ACTIONS ────────────────────────────────────────────── */
.inv-print-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 20px;
    background: #f3f4f6;
    border-top: 1px solid var(--inv-line);
}

.inv-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    font-family: var(--inv-font);
    cursor: pointer;
    border: none;
    transition: background .15s;
}
.inv-btn-print { background: var(--inv-primary); color: #fff; }
.inv-btn-print:hover { background: #009e9e; }
.inv-btn-close { background: #e5e7eb; color: #374151; }
.inv-btn-close:hover { background: #d1d5db; }

/* ── MODAL ────────────────────────────────────────────────────── */
.inv-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.inv-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(2px);
}
.inv-modal-box {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 16px;
    width: 90vw;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.inv-modal-toolbar {
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    justify-content: flex-end;
}
.inv-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 0;
}
.inv-loading {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 14px;
}

/* ── دکمه فاکتور در جدول سفارش‌ها ───────────────────────────── */
.nxt-btn-invoice {
    background: var(--inv-primary) !important;
    color: #fff !important;
    border-color: var(--inv-primary) !important;
    font-size: 12px !important;
    padding: 6px 14px !important;
}
.nxt-btn-invoice:hover { background: #009e9e !important; }

.nxt-order-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── PRINT MEDIA ──────────────────────────────────────────────── */
@media print {
    .no-print,
    .inv-modal-toolbar,
    .inv-print-actions { display: none !important; }

    .inv-print-body { padding: 0 !important; }
    .inv-wrap { border: none; border-radius: 0; }
    .inv-modal-box { box-shadow: none; }

    @page { size: A4; margin: 15mm; }
}

/* ── RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 640px) {
    .inv-header   { flex-direction: column; }
    .inv-parties  { grid-template-columns: 1fr; }
    .inv-party:first-child { border-left: none; border-bottom: 1px solid var(--inv-line); }
    .inv-summary-wrap { flex-direction: column; }
    .inv-totals   { width: 100%; }
    .inv-signature-row { flex-direction: column; }
    .inv-table { font-size: 11px; }
    .inv-table td, .inv-table th { padding: 8px; }
}
