/* ==========================================================================
   koinoxrista.com.gr — Print & public documents
   Στόχος: απλά, ευδιάκριτα έντυπα (και για ηλικιωμένους) → εκτύπωση/PDF.
   Χρήση: <link rel="stylesheet" href="print.css"> στα print/public layouts.
   ========================================================================== */

:root {
    --ink: #151B2C;
    --violet: #7C5CFC;
    --teal: #17b3a0;
    --line: #c9cfdd;
    --line-2: #e6e9f1;
    --soft: #f2f4f9;
    --pay-bg: #fff4dd;
    --pay-ink: #7a4e00;
    --ok: #12855f; --ok-bg:#e2f4ec;
    --due:#c62f45; --due-bg:#fce8ea;
}

* { box-sizing: border-box; }
body.doc {
    margin: 0; background: #eef1f7;
    font-family: "Segoe UI", Tahoma, "Noto Sans", Arial, system-ui, sans-serif;
    color: var(--ink); font-size: 16px; line-height: 1.4;
}

/* Toolbar (screen only) */
.doc-toolbar {
    position: sticky; top: 0; z-index: 10; background: var(--ink); color: #fff;
    display: flex; gap: .6rem; align-items: center; padding: .6rem 1rem; flex-wrap: wrap;
}
.doc-toolbar .sp { margin-left: auto; }
.doc-toolbar a, .doc-toolbar button {
    font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
    background: rgba(255,255,255,.14); color: #fff; border: 0;
    padding: .55rem .95rem; border-radius: 8px;
}
.doc-toolbar a:hover, .doc-toolbar button:hover { background: rgba(255,255,255,.26); }
.doc-toolbar .btn-print { background: var(--violet); }
.doc-toolbar .btn-print:hover { background: #6a49ec; }

/* Sheets */
.sheet {
    background: #fff; width: 210mm; max-width: 100%; margin: 1.2rem auto;
    padding: 12mm 12mm; box-shadow: 0 6px 24px rgba(21,27,44,.14);
}
.sheet + .sheet { margin-top: 0; }

/* Document header with logo */
.doc-head { display: flex; align-items: center; gap: 1rem; border-bottom: 3px solid var(--ink); padding-bottom: .7rem; margin-bottom: .9rem; }
.doc-head .logo { height: 40px; }
.doc-head .doc-title { margin-left: auto; text-align: right; }
.doc-head .qr-mini svg { width: 92px; height: 92px; display: block; }
.doc-head .doc-title h1 { margin: 0; font-size: 1.35rem; letter-spacing: .02em; }
.doc-head .doc-title .meta { color: #555; font-size: .95rem; }

/* Info grid */
.doc-info { display: grid; grid-template-columns: repeat(2, 1fr); gap: .3rem 1.5rem; margin: .6rem 0 1rem; }
.doc-info .row { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dotted var(--line); padding: .25rem 0; }
.doc-info .row .k { color: #555; font-weight: 600; }
.doc-info .row .v { font-weight: 700; }

/* Big legible table (συγκεντρωτική) */
table.doc-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.doc-table th, table.doc-table td { padding: .55rem .5rem; border: 1px solid var(--line); }
table.doc-table thead th { background: var(--ink); color: #fff; font-size: .9rem; font-weight: 700; text-align: center; }
table.doc-table td.num { text-align: right; }
table.doc-table td.name { font-weight: 600; }
table.doc-table tbody tr:nth-child(even) { background: var(--soft); }
table.doc-table tfoot td { font-weight: 800; background: #eef1f7; border-top: 2px solid var(--ink); }
table.doc-table .payable { font-weight: 800; color: var(--ink); font-size: 1.05em; }

/* Payment status pills */
.pill { display:inline-block; padding:.2rem .55rem; border-radius:999px; font-weight:800; font-size:.85rem; }
.pill-ok  { background: var(--ok-bg);  color: var(--ok); }
.pill-due { background: var(--due-bg); color: var(--due); }
.pill-part{ background: #fff4dd; color: #7a4e00; }

/* Notice / receipt (ειδοποιητήριο/απόδειξη) — big & clear */
.notice-amount {
    display:flex; align-items:center; justify-content:space-between; gap:1rem;
    background: var(--pay-bg); border: 2px solid #f0d091; border-radius: 12px;
    padding: 1rem 1.3rem; margin: 1rem 0;
}
.notice-amount .lbl { font-size: 1.1rem; font-weight: 700; color: var(--pay-ink); }
.notice-amount .amt { font-size: 2.1rem; font-weight: 900; color: var(--ink); }

.breakdown { width:100%; border-collapse: collapse; margin: .6rem 0; }
.breakdown th, .breakdown td { padding: .5rem .6rem; border-bottom: 1px solid var(--line-2); text-align: left; font-size: 1.02rem; }
.breakdown td.num { text-align: right; font-variant-numeric: tabular-nums; }
.breakdown tfoot td { font-weight: 800; border-top: 2px solid var(--ink); }

.qr-box { display:flex; gap: 1rem; align-items:center; border:1px dashed var(--line); border-radius: 12px; padding: .9rem; margin-top: 1rem; }
.qr-box img, .qr-box svg { width: 120px; height: 120px; }
.qr-box .txt { font-size: .95rem; color:#444; }
.qr-box .txt b { color: var(--ink); }

.sign-row { display:flex; justify-content: space-between; margin-top: 1.6rem; gap: 2rem; }
.sign-row .box { flex:1; text-align:center; }
.sign-row .line { border-top: 1px solid var(--ink); margin-top: 2.2rem; padding-top: .3rem; color:#555; font-size:.9rem; }

.doc-note { margin-top: 1rem; font-size: .95rem; color: #444; border-left: 4px solid var(--teal); padding: .3rem .7rem; background: var(--soft); }
.doc-foot { margin-top: 1.2rem; text-align:center; color:#888; font-size: .8rem; }

/* --- 2 αποδείξεις ανά σελίδα ------------------------------------------- */
.sheet-2up { padding: 9mm 12mm; }
.doc-half { display: block; }
.doc-half .doc-head { border-bottom-width: 2px; padding-bottom: .5rem; margin-bottom: .6rem; }
.doc-half .doc-head .logo { height: 30px; }
.doc-half .doc-head .doc-title h1 { font-size: 1.05rem; }
.doc-half .doc-info { margin: .4rem 0 .6rem; gap: .1rem 1.2rem; }
.doc-half .breakdown th, .doc-half .breakdown td { padding: .3rem .5rem; font-size: .92rem; }
.doc-half .notice-amount { padding: .5rem .9rem; margin: .5rem 0; }
.doc-half .notice-amount .amt { font-size: 1.5rem; }
.doc-half .sign-row { margin-top: .8rem; }
.doc-half .sign-row .line { margin-top: 1.2rem; }
.doc-half-empty { min-height: 120mm; }
.cut-line { border-top: 1px dashed #999; text-align: center; margin: 10mm 0 6mm; position: relative; }
.cut-line span { position: relative; top: -.7em; background: #fff; padding: 0 .6rem; color: #999; font-size: .8rem; }

/* Print rules */
@media print {
    .sheet-2up { min-height: auto; }
    .doc-half { break-inside: avoid; page-break-inside: avoid; }
    body.doc { background: #fff; }
    .doc-toolbar, .no-print { display: none !important; }
    .sheet { box-shadow: none; margin: 0; width: auto; padding: 8mm; page-break-after: always; }
    .sheet:last-child { page-break-after: auto; }
    table.doc-table thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .notice-amount, .pill, table.doc-table tbody tr:nth-child(even), table.doc-table thead th, table.doc-table tfoot td {
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    @page { size: A4; margin: 10mm; }
}

@media (max-width: 640px) {
    .doc-info { grid-template-columns: 1fr; }
    .sheet { padding: 6mm; }
    .notice-amount .amt { font-size: 1.7rem; }
}

/* Stacked-cards for wide tables on phones (screen only — print stays tabular) */
@media screen and (max-width: 620px) {
    table.doc-responsive { border: 0; }
    table.doc-responsive thead { position: absolute; left: -9999px; }
    table.doc-responsive tbody tr,
    table.doc-responsive tfoot tr {
        display: block; border: 1px solid var(--line); border-radius: 12px;
        margin: 0 0 .7rem; padding: .5rem .8rem; background: #fff;
    }
    table.doc-responsive tfoot tr { background: #eef1f7; }
    table.doc-responsive td {
        display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
        border: 0; border-bottom: 1px dotted var(--line-2); padding: .5rem .1rem; text-align: right;
        font-size: 1.05rem;
    }
    table.doc-responsive td:last-child { border-bottom: 0; }
    table.doc-responsive td::before {
        content: attr(data-label); font-weight: 700; color: #555; text-align: left; flex: 0 0 auto;
    }
    table.doc-responsive td.payable { font-size: 1.25rem; }
    table.doc-responsive td.name { font-size: 1.15rem; font-weight: 700; }
    table.doc-responsive tfoot td::before { color: var(--ink); }
}
