/*
 * invoice.css — shared styles for invoice pages.
 * Selectors are id/class-prefixed (`.qc-*`, `#invoiceReviewModal`, `.sc-*`, `.qp-*`,
 * `.irm-*`, `.cash-helper*`, `.helper-stat*`, `.denom-chip*`, `.ati-*`) so they don't
 * collide with other modules. The scroll-override for the create pages is scoped
 * via `body:has(.invoice-form-page)` so it only applies when an invoice-form is present.
 */

/* ── Scroll override for long invoice forms ─────────────────── */
body:has(.invoice-form-page),
body:has(.invoice-form-page) #kt_body,
body:has(.invoice-form-page) #kt_content,
body:has(.invoice-form-page) .content,
body:has(.invoice-form-page) .container-xxl {
    overflow-y: auto !important;
    height: auto !important;
    overflow: visible !important;
}

/* ── Stock-availability field states ────────────────────────── */
.available     { border-color: green; background-color: #eaffea; }
.not-available { border-color: red;   background-color: #ffeaea; }

/* ── Loading spinner overlay ────────────────────────────────── */
#loading-indicator {
    display: none;
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1051;
}

/* ── Invoice Review Modal (IRM) ─────────────────────────────── */
#invoiceReviewModal { font-size: .93rem; }
#invoiceReviewModal .modal-dialog { max-width: min(980px, 96vw); }
#invoiceReviewModal .modal-body   { font-size: .93rem; }
#invoiceReviewModal .modal-footer { font-size: .88rem; }
#invoiceReviewModal .modal-title  { font-size: 1rem !important; }

#irm-header {
    background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 60%, #415a77 100%);
    transition: background .4s ease;
}
#irm-header.irm-ok  { background: linear-gradient(135deg, #0a2e1a, #166534, #14532d) !important; }
#irm-header.irm-bad { background: linear-gradient(135deg, #3b0000, #7f1d1d, #991b1b) !important; }

.sc-card {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .28s ease, transform .28s ease;
}
.sc-card.sc-visible { opacity: 1; transform: translateY(0); }

#irm-summary-card {
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    min-height: 100%;
    font-size: .9rem;
}
#irm-stock-cards { font-size: .9rem; }
#irm-stock-cards::-webkit-scrollbar { width: 6px; }
#irm-stock-cards::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
#irm-stock-cards::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
#irm-stock-cards::-webkit-scrollbar-thumb:hover { background: #888; }

.irm-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 700;
}

/* ── Quick-create / abbreviated-create form ─────────────────── */
.qc-label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
}
.qc-label.required::after { content: " *"; color: #dc3545; }

#qc-table thead th {
    font-size: .71rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #6c757d;
    padding: 6px 3px;
    white-space: nowrap;
}
#qc-table tbody td { padding: 3px 2px; vertical-align: middle; }
#qc-total-section td { padding: 3px 6px; font-size: .88rem; }

/* Payment panel */
#qc-payment-panel {
    display: none;
    border-top: 3px solid #198754;
    background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
    border-radius: 0 0 8px 8px;
    padding: 0;
    animation: qc-slide-down .35s ease;
}
@keyframes qc-slide-down {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.qp-header {
    background: linear-gradient(135deg, #166534 0%, #15803d 100%);
    padding: .75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.qp-chip {
    background: rgba(255,255,255,.2);
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 999px;
    padding: .2rem .7rem;
    font-size: .78rem;
    color: #fff;
    white-space: nowrap;
}
.qp-body  { padding: 1rem 1.25rem; }
.qp-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #374151;
    margin-bottom: .2rem;
}
.qp-label.required::after { content: " *"; color: #dc2626; }

.cash-helper {
    border: 1px solid #bbf7d0;
    background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
    border-radius: 10px;
    padding: .85rem 1rem;
}
.cash-helper-title {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #15803d;
    margin-bottom: .5rem;
}
.helper-stat {
    min-width: 120px;
    padding: .5rem .7rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}
.helper-stat .lbl {
    display: block;
    font-size: .65rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}
.helper-stat .val {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
    margin-top: .1rem;
}
.helper-stat.change .val { color: #059669; }
.helper-stat.short  .val { color: #dc2626; }

.denom-chip {
    display: inline-block;
    padding: .18rem .5rem;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #fff;
    font-size: .76rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s;
}
.denom-chip:hover {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}

/* Abbreviated tax-invoice badges */
.ati-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: .25rem .7rem;
    font-size: .8rem;
    font-weight: 600;
}
.ati-note {
    background: #f0f4ff;
    border-left: 4px solid #4361ee;
    border-radius: 4px;
    padding: .6rem 1rem;
    font-size: .82rem;
    color: #334;
}

/* ── Mobile: invoice-items table → card per row ─────────────── */
@media (max-width: 767px) {
    .invoice-items-table { table-layout: auto !important; }
    .invoice-items-table thead { display: none; }
    .invoice-items-table tbody tr {
        display: block;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        margin-bottom: .75rem;
        padding: .5rem .65rem;
        background: #fff;
    }
    .invoice-items-table tbody td {
        display: flex;
        align-items: center;
        padding: .35rem .25rem;
        border: 0;
        border-bottom: 1px solid #f1f5f9;
        gap: .5rem;
    }
    .invoice-items-table tbody td:last-child { border-bottom: 0; }
    .invoice-items-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: .7rem;
        text-transform: uppercase;
        color: #6b7280;
        min-width: 80px;
        flex-shrink: 0;
    }
    .invoice-items-table tbody td[data-label=""]::before,
    .invoice-items-table tbody td:not([data-label])::before { display: none; }
    .card-footer.footer { position: static !important; float: none !important; width: 100%; }
}

/* ─────────────────────────────────────────────────────────────
   Invoice detail view (invoice/show.blade.php)
   Scoped under `.invoice-show` because it introduces short/
   generic class names like `.num`, `.subtle`, `.section-title`.
───────────────────────────────────────────────────────────── */
.invoice-show {
    --ink: #0f172a;
    --muted: #64748b;
    --soft: #f8fafc;
    --ring: #cbd5e1;
    --brand: #1a4567;
    --ok: #16a34a;
    --warn: #ea580c;
    --danger: #dc2626;
    --invoice-radius: 16px;
    --invoice-shadow: 0 10px 30px rgba(2, 6, 23, .06);
}
.invoice-show .toolbar-chip {
    background: #eef2ff;
    border: 1px dashed #c7d2fe;
    padding: .35rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
}
.invoice-show .card-modern {
    border: 0;
    border-radius: var(--invoice-radius);
    box-shadow: var(--invoice-shadow);
}
.invoice-show .card-modern .card-header {
    border: 0;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
    border-top-left-radius: var(--invoice-radius);
    border-top-right-radius: var(--invoice-radius);
}
.invoice-show .avatar-60 { width: 60px; height: 60px; object-fit: cover; }
/* .table-tight / .table-sticky skins removed — Bootstrap 5.3 default tables. */
.invoice-show .num { text-align: right; white-space: nowrap; }
.invoice-show .subtle { color: var(--muted); }
.invoice-show .badge-soft {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #0f172a;
}
.invoice-show .section-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
}
.invoice-show .section-title .bi { opacity: .8; }
