/* UI-3 invoices: editor action bar and the A4 «صورتحساب» print layout. Uses the --mz-* tokens of app.css. */

/* ---------- editor ---------- */
.ui3-lines { min-width: 860px; }
.ui3-lines td { vertical-align: top; }
.ui3-lines .input-money { text-align: left; direction: ltr; }

.ui3-actionbar {
    position: sticky; bottom: 0; z-index: 1010;
    display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
    margin-top: 1rem; padding: .75rem 1rem;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px);
    border: 1px solid var(--mz-border); border-radius: var(--mz-radius);
    box-shadow: var(--mz-shadow);
    animation: ui3-rise .3s ease both;
}
@keyframes ui3-rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.ui3-check { animation: ui3-rise .3s ease both; }
@media (prefers-reduced-motion: reduce) { .ui3-actionbar, .ui3-check { animation: none; } }

/* ---------- A4 invoice ---------- */
.ui3-invoice {
    position: relative; max-width: 210mm; margin-inline: auto; padding: 10mm;
    background: #fff; color: #000; border: 1px solid var(--mz-border); border-radius: var(--mz-radius);
    box-shadow: var(--mz-shadow-sm); font-size: 12px; line-height: 1.8;
}
.ui3-invoice h1 { font-size: 16px; margin: 0; text-align: center; color: #000; }
.ui3-invoice h2 { font-size: 12px; margin: 0; padding: .25rem .5rem; background: #eef2f7; border: 1px solid #555; border-bottom: 0; font-weight: 700; color: #000; text-align: center; }
.ui3-inv-head { display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.ui3-inv-meta { display: grid; grid-template-columns: auto 1fr; gap: 0 .5rem; margin: 0; justify-self: end; }
.ui3-inv-meta dt { font-weight: 400; color: #444; }
.ui3-inv-meta dd { margin: 0; font-weight: 700; }
.ui3-inv-stamp {
    position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg);
    font-size: 42px; font-weight: 700; color: rgba(192, 54, 44, .16); border: 4px solid rgba(192, 54, 44, .16);
    padding: .25rem 1.5rem; border-radius: 12px; pointer-events: none; white-space: nowrap;
}
.ui3-inv-party { margin-bottom: .5rem; }
.ui3-inv-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid #555; }
.ui3-inv-grid > div { padding: .2rem .5rem; border-inline-start: 1px solid #ccc; border-bottom: 1px solid #ccc; min-height: 1.9em; }
.ui3-inv-grid > div span { color: #444; margin-inline-end: .35rem; }
.ui3-inv-grid > div span::after { content: ":"; }
.ui3-inv-grid .span-2 { grid-column: span 2; }
.ui3-inv-grid .span-all { grid-column: 1 / -1; }
.ui3-inv-title { margin-top: .25rem !important; }
.ui3-inv-lines { width: 100%; border-collapse: collapse; min-width: 720px; }
.ui3-inv-lines th, .ui3-inv-lines td { border: 1px solid #555; padding: .25rem .3rem; vertical-align: middle; }
.ui3-inv-lines th { background: #f3f5f8; font-weight: 700; font-size: 10.5px; text-align: center; line-height: 1.4; }
.ui3-inv-lines .c { text-align: center; }
.ui3-inv-lines .n { text-align: left; direction: ltr; white-space: nowrap; font-feature-settings: "tnum" 1; }
.ui3-inv-lines .desc { min-width: 140px; }
.ui3-inv-lines .desc .sub { color: #555; font-size: 10.5px; }
.ui3-inv-lines .strong { font-weight: 700; }
.ui3-inv-lines tfoot td { font-weight: 700; background: #f3f5f8; }
.ui3-inv-sum { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: .5rem; border: 1px solid #555; border-top: 0; }
.ui3-inv-sum .words { flex: 1 1 260px; }
.ui3-inv-sum .words span { color: #444; }
.ui3-inv-sum .mz-totals dt, .ui3-inv-sum .mz-totals .grand { color: #000; }
.ui3-inv-note { padding: .4rem .5rem; border: 1px solid #555; border-top: 0; }
.ui3-inv-note span { color: #444; }
.ui3-inv-sign { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #555; border-top: 0; }
.ui3-inv-sign > div { min-height: 26mm; padding: .4rem .5rem; text-align: center; color: #333; }
.ui3-inv-sign > div + div { border-inline-start: 1px solid #555; }
.ui3-inv-foot { margin-top: .4rem; text-align: center; font-size: 10px; color: #777; }

@media (max-width: 575.98px) {
    .ui3-invoice { padding: 12px; }
    .ui3-inv-head { grid-template-columns: 1fr; text-align: center; }
    .ui3-inv-meta { justify-self: center; }
    .ui3-inv-grid { grid-template-columns: 1fr 1fr; }
}

@media print {
    .ui3-invoice { max-width: none; padding: 0; border: 0; border-radius: 0; box-shadow: none; font-size: 10.5px; }
    .ui3-invoice .mz-table-wrap { overflow: visible; }
    .ui3-inv-lines { min-width: 0; }
    .ui3-inv-lines th, .ui3-inv-lines td { padding: .15rem .2rem; }
    .ui3-inv-lines th { font-size: 9.5px; }
    .ui3-invoice h2, .ui3-inv-lines th, .ui3-inv-lines tfoot td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .ui3-inv-lines tr { break-inside: avoid; }
    .ui3-actionbar { display: none !important; }
}
