/* ============================================================================
   Ponude — "Klikni na dokument" interactive editor (WYSIWYG canvas)
   ----------------------------------------------------------------------------
   Visual facsimile of the server QuestPDF (DetailedTemplate.cs). Colors are the
   literal hex values from that template so the on-screen editor matches the
   generated PDF the user sees on the detail/send screens.

      #064e3b  dark green   — table header band, REKAPITULACIJA title, ZA PLATITI
      #059669  medium green — IZDAVATELJ / KUPAC title bands, id sub-labels
      #ecfdf5  mint         — dates row, totals title band, even table rows
      #6ee7b7  light green  — all box / cell borders
      #d97706  amber        — NAPOMENE box border + title (bg #fefce8)

   Owned solely by the Ponude module — do NOT edit wwwroot/eracun-new/css.
   ========================================================================== */

.pde-shell {
    --pde-green-dark: #064e3b;
    --pde-green: #059669;
    --pde-mint: #ecfdf5;
    --pde-border: #6ee7b7;
    --pde-amber: #d97706;
    --pde-amber-bg: #fefce8;
    --pde-grey: #374151;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* ── Toolbar above the page (Prodavatelj / Plaćanje / Dostava entry points) ── */
.pde-toolbar {
    width: 100%;
    max-width: 820px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── The paper sheet ── */
.pde-page {
    position: relative;
    width: 100%;
    max-width: 820px;
    background: #ffffff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.10);
    padding: 32px 34px 40px;
    font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
    overflow: hidden;
}

/* ── Header band ── */
.pde-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 12px;
    margin-bottom: 14px;
}
.pde-header-left { font-weight: 700; font-size: 1.05rem; color: #111827; }
.pde-logo { max-height: 56px; max-width: 200px; object-fit: contain; display: block; }
.pde-header-center { display: flex; align-items: baseline; justify-content: center; gap: 8px; flex-wrap: wrap; }
.pde-doctype {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--pde-green-dark);
    /* Isti font kao ostatak dokumenta (DM Sans) — Instrument Serif je odskakao. */
    font-family: inherit;
}
.pde-broj { font-size: 0.95rem; font-weight: 700; color: #111827; margin-top: 0; }
.pde-header-right { text-align: right; color: #9ca3af; font-size: 0.7rem; }

/* ── Dates row ── */
.pde-dates {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    background: var(--pde-mint);
    border: 1px solid var(--pde-border);
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 14px;
}
.pde-date-label { color: var(--pde-grey); font-size: 0.66rem; text-transform: uppercase; letter-spacing: .3px; }
.pde-date-value { font-weight: 700; font-size: 0.86rem; color: #111827; }

/* ── Party boxes ── */
.pde-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}
.pde-party {
    border: 1px solid var(--pde-border);
    border-radius: 4px;
    overflow: hidden;
}
.pde-party-title {
    background: var(--pde-green);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: .5px;
    padding: 5px 10px;
    text-transform: uppercase;
}
.pde-party-body { padding: 8px 10px; font-size: 0.78rem; line-height: 1.45; }
.pde-party-name { font-weight: 700; font-size: 0.86rem; color: #111827; }
.pde-party-muted { color: #6b7280; }
.pde-id-label {
    color: var(--pde-green);
    font-weight: 700;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-top: 4px;
}
.pde-id-value { font-family: 'DM Mono', 'Roboto Mono', monospace; font-size: 0.78rem; }

/* ── Notes box ── */
.pde-notes {
    border: 1px solid var(--pde-amber);
    background: var(--pde-amber-bg);
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 14px;
}
.pde-notes-title { color: var(--pde-amber); font-weight: 700; font-size: 0.62rem; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.pde-notes-body { font-size: 0.78rem; color: #4b5563; white-space: pre-wrap; }
.pde-vat-note { font-style: italic; color: #6b7280; }

/* ── Line table ── */
.pde-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 0.78rem; }
.pde-table thead th {
    background: var(--pde-green-dark);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: .3px;
    padding: 6px 8px;
    text-align: left;
}
.pde-table thead th.num, .pde-table tbody td.num { text-align: right; }
.pde-table tbody td {
    padding: 7px 8px;
    border-bottom: 1px solid var(--pde-border);
    vertical-align: top;
}
.pde-table tbody tr:nth-child(even) td { background: var(--pde-mint); }
.pde-table .pde-line-name { font-weight: 600; color: #111827; }
.pde-table .pde-line-sub { color: #6b7280; font-size: 0.68rem; }
.pde-col-iznos { font-weight: 700; text-align: right; white-space: nowrap; }
.pde-row-actions { width: 36px; text-align: center !important; }
.pde-line-del { opacity: 0; transition: opacity .12s; }
.pde-table tbody tr:hover .pde-line-del { opacity: 1; }

/* add-line dashed row */
.pde-addline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px dashed var(--pde-border);
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 14px;
    color: var(--pde-green);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s;
}
.pde-addline:hover { background: var(--pde-mint); }

/* ── Totals block ── */
.pde-totals {
    border: 1px solid var(--pde-border);
    border-radius: 4px;
    overflow: hidden;
    max-width: 420px;
    margin-left: auto;
}
.pde-totals-title {
    background: var(--pde-mint);
    color: var(--pde-green-dark);
    font-weight: 700;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 6px 12px;
}
.pde-total-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 12px;
    font-size: 0.8rem;
}
.pde-total-row.strong { font-weight: 700; }
.pde-total-row.discount { color: var(--pde-green); }
.pde-tax-line { display: flex; justify-content: space-between; gap: 12px; padding: 2px 12px; font-size: 0.72rem; color: #4b5563; }
.pde-tax-head { padding: 4px 12px 2px; font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--pde-green); }
.pde-zaplatiti {
    background: var(--pde-green-dark);
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 12px;
    font-size: 1.05rem;
    font-weight: 800;
    margin-top: 4px;
}

/* ── Click-to-edit affordance ── */
.pde-editable {
    position: relative;
    cursor: pointer;
    border-radius: 4px;
    transition: outline-color .12s, background .12s;
    outline: 2px solid transparent;
    outline-offset: 2px;
}
.pde-editable:hover { outline-color: var(--pde-border); background: rgba(110, 231, 183, 0.10); }
.pde-editable:focus-visible { outline-color: var(--pde-green); }
.pde-edit-pencil {
    opacity: 0;
    transition: opacity .12s;
    margin-left: 4px;
    vertical-align: middle;
    color: var(--pde-green) !important;
}
.pde-editable:hover .pde-edit-pencil { opacity: 1; }
.pde-invalid { outline-color: #ef4444 !important; background: rgba(239, 68, 68, 0.08); }

/* ── Inline popover ── */
.pde-anchor { position: relative; display: inline-block; }
.pde-anchor.block { display: block; }
.pde-anchor.block > .pde-editable { display: block; }
.pde-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: transparent;
}
.pde-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1201;
    min-width: 240px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
    padding: 12px;
}
.pde-popover.right { left: auto; right: 0; }
.pde-popover-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 10px;
}

/* ── Mobile ── */
@media (max-width: 720px) {
    .pde-page { padding: 20px 16px 28px; }
    .pde-parties { grid-template-columns: 1fr; }
    .pde-header { grid-template-columns: 1fr; text-align: center; }
    .pde-header-right { display: none; }
    .pde-totals { max-width: none; }
    .pde-popover { min-width: 200px; }
}
