/* ============================================================
   Tichet Cântar — stiluri aplicație + print
   ============================================================ */

:root {
  --c-cream: #F7F4EF;
  --c-ink:   #1A1A1A;
  --c-brand: #1B3A2D;
  --c-amber: #C17F24;
}

html, body { height: 100%; }
body { background: var(--c-cream); color: var(--c-ink); }

/* -------- Nav links din sidebar -------- */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  border-radius: 0.5rem;
  font-size: 0.92rem;
  color: rgba(255,255,255,0.85);
  transition: background-color .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-link.active {
  background: var(--c-amber);
  color: #fff;
  font-weight: 600;
}
.nav-link.active svg { color: #fff; }

/* -------- Form controls (custom, peste Tailwind) -------- */
.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #5a5a5a;
  margin-bottom: 0.35rem;
}
.field-input,
.field-select,
.field-textarea {
  width: 100%;
  background: #fff;
  border: 1px solid #d8d4cc;
  border-radius: 0.5rem;
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  color: var(--c-ink);
  transition: border-color .15s, box-shadow .15s;
}
.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(27,58,45,0.12);
}
.field-input[readonly],
.field-input:disabled {
  background: #efece6;
  color: #444;
  cursor: not-allowed;
}
.field-textarea { min-height: 80px; resize: vertical; }

.field-error {
  font-size: 0.78rem;
  color: #b91c1c;
  margin-top: 0.25rem;
}
.field-required::after { content: " *"; color: #b91c1c; }

/* -------- Butoane -------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.1rem;
  border-radius: 0.5rem;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background-color .15s, color .15s, border-color .15s, transform .05s;
  cursor: pointer;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--c-brand); color: #fff; }
.btn-primary:hover { background: #142a21; }
.btn-accent  { background: var(--c-amber); color: #fff; }
.btn-accent:hover  { background: #a06a1d; }
.btn-secondary { background: #fff; color: var(--c-ink); border-color: #d8d4cc; }
.btn-secondary:hover { background: #f1ede5; }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn-ghost { background: transparent; color: #444; }
.btn-ghost:hover { background: rgba(0,0,0,0.06); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
.btn-icon { padding: 0.4rem; }

/* -------- Card / Section -------- */
.card {
  background: #fff;
  border: 1px solid #e6e2d8;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #ede9df;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-body { padding: 1.25rem; }

/* -------- Tabel -------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
.tbl thead th {
  text-align: left;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #5a5a5a;
  padding: 0.65rem 0.85rem;
  background: #faf7f0;
  border-bottom: 1px solid #ede9df;
}
.tbl tbody td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid #f1ede4;
  vertical-align: middle;
}
.tbl tbody tr:hover { background: #fbf8f1; }
.tbl tbody tr:last-child td { border-bottom: 0; }

/* -------- Badge greutate (NET evidențiat) -------- */
.weight-readonly {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
  background: #efece6 !important;
}
.net-input {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 1.15rem;
}

/* Număr tichet în header formular */
.ticket-number {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: 0.04em;
  color: var(--c-brand);
}

/* Variantă editabilă a numărului */
.ticket-number-input {
  width: 6.5ch;
  text-align: right;
  background: transparent;
  border: 1.5px dashed #c9c4b6;
  border-radius: 0.4rem;
  padding: 0.15rem 0.4rem;
  transition: border-color .15s, background-color .15s;
}
.ticket-number-input:hover { border-color: var(--c-amber); }
.ticket-number-input:focus {
  outline: none;
  background: #fff;
  border-color: var(--c-brand);
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(27,58,45,0.12);
}
/* Ascunde săgețile de spin de la input number */
.ticket-number-input::-webkit-outer-spin-button,
.ticket-number-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ticket-number-input { -moz-appearance: textfield; }

/* Câmpuri HH / MM pentru oră (format 24h, fără AM/PM) */
.time-part {
  width: 4.2rem;
  text-align: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.55rem 0.5rem;
}
.time-part::-webkit-outer-spin-button,
.time-part::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.time-part { -moz-appearance: textfield; }

/* -------- Toast -------- */
.toast {
  min-width: 260px;
  max-width: 380px;
  padding: 0.7rem 0.9rem;
  border-radius: 0.6rem;
  background: #fff;
  border: 1px solid #e6e2d8;
  box-shadow: 0 10px 25px -10px rgba(0,0,0,0.25);
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.9rem;
  animation: toast-in .18s ease-out;
}
.toast.success { border-left: 4px solid #166534; }
.toast.error   { border-left: 4px solid #b91c1c; }
.toast.info    { border-left: 4px solid #1B3A2D; }
@keyframes toast-in { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* -------- Modal -------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fade-in .12s ease-out;
}
.modal-box {
  background: #fff;
  border-radius: 0.85rem;
  max-width: 640px;
  width: 100%;
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 25px 60px -15px rgba(0,0,0,0.35);
  animation: modal-in .18s ease-out;
}
.modal-box.wide { max-width: 900px; }
.modal-header {
  display:flex; align-items:center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #ede9df;
}
.modal-body  { padding: 1.25rem; }
.modal-footer{
  display:flex; gap: 0.6rem; justify-content: flex-end;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid #ede9df;
  background: #faf7f0;
  border-bottom-left-radius: 0.85rem;
  border-bottom-right-radius: 0.85rem;
}
@keyframes fade-in { from { opacity:0; } to { opacity:1; } }
@keyframes modal-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* -------- Pagination -------- */
.pager { display:flex; gap: 0.35rem; align-items:center; }
.pager button {
  min-width: 34px; height: 34px;
  border: 1px solid #d8d4cc; background: #fff; border-radius: 0.4rem;
  font-size: 0.85rem;
}
.pager button.active { background: var(--c-brand); color:#fff; border-color: var(--c-brand); }
.pager button:disabled { opacity: 0.45; cursor: not-allowed; }

/* -------- Banner / Checklist -------- */
.banner {
  background: #fffbed;
  border: 1px solid #f1d97a;
  color: #5a4500;
  padding: 0.9rem 1.1rem;
  border-radius: 0.6rem;
}

/* ============================================================
   TICHET PRINTAT — layout A4 portrait, identic cu modelul
   ============================================================ */

.ticket-paper {
  background: #fff;
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  line-height: 1.35;
  width: 210mm;
  min-height: 297mm;
  padding: 14mm 14mm;
  margin: 0 auto;
  box-sizing: border-box;
}

.ticket-paper .t-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 11.5px;
  margin-bottom: 12px;
}
.ticket-paper .t-header .col { max-width: 50%; }
.ticket-paper .t-header .col p { margin: 0 0 2px 0; }
.ticket-paper .t-header strong { font-weight: 700; }

.ticket-paper .t-title {
  text-align: center;
  margin: 6px 0 14px 0;
}
.ticket-paper .t-title h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 0 0 4px 0;
}
.ticket-paper .t-title .meta {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 2px 18px;
  font-size: 12px;
  margin-top: 2px;
}
.ticket-paper .t-title .meta .lbl { text-align: right; font-weight: 400; }
.ticket-paper .t-title .meta .val { text-align: left; font-weight: 600; }

.ticket-paper table.t-grid {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
  font-size: 12px;
}
.ticket-paper table.t-grid th,
.ticket-paper table.t-grid td {
  border: 1px solid #000;
  padding: 5px 8px;
  vertical-align: middle;
}
.ticket-paper table.t-grid th {
  background: #f0f0f0;
  font-weight: 700;
  text-align: center;
}
.ticket-paper table.t-grid td.lbl-cell {
  background: #fafafa;
  width: 28%;
  font-weight: 400;
}
.ticket-paper table.t-grid td.val-cell {
  background: #fff;
  font-weight: 600;
}

/* Tabel cu două secțiuni (Vehicul | Client) */
.ticket-paper .t-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 6px 0 10px 0;
}
.ticket-paper .t-two-col .t-side { }
.ticket-paper .t-two-col .t-side + .t-side { margin-left: -1px; }
.ticket-paper .t-two-col table { width: 100%; border-collapse: collapse; }
.ticket-paper .t-two-col table th {
  background: #f0f0f0;
  border: 1px solid #000;
  text-align: center;
  font-weight: 700;
  padding: 4px 6px;
  font-size: 12px;
}
.ticket-paper .t-two-col table td {
  border: 1px solid #000;
  padding: 4px 8px;
  font-size: 12px;
}
.ticket-paper .t-two-col table td.lbl {
  width: 40%;
  background: #fafafa;
  font-weight: 400;
}
.ticket-paper .t-two-col table td.val {
  font-weight: 600;
  background: #fff;
}

/* Tabel greutăți */
.ticket-paper .t-weights {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 4px 0;
}
.ticket-paper .t-weights th,
.ticket-paper .t-weights td {
  border: 1px solid #000;
  padding: 6px 10px;
  text-align: center;
  font-size: 12px;
}
.ticket-paper .t-weights th {
  background: #f0f0f0;
  font-weight: 700;
  text-align: left;
}
.ticket-paper .t-weights .col-prod { width: 25%; text-align: left; }
.ticket-paper .t-weights .row-total td {
  border: none;
  font-weight: 700;
  padding-top: 12px;
  text-align: left;
}
.ticket-paper .t-weights .row-total td.col-prod { font-weight: 700; }
.ticket-paper .t-weights .row-total td.num { text-align: center; }

.ticket-paper .t-observ {
  margin: 10px 0 14px 0;
  font-size: 12px;
}

.ticket-paper .t-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 26px;
  font-size: 12px;
}
.ticket-paper .t-signatures div { width: 45%; }

.ticket-paper .t-footer {
  margin-top: 30px;
  font-size: 9.5px;
  color: #555;
  text-align: center;
  border-top: 1px dashed #999;
  padding-top: 6px;
}

/* Print preview pe ecran — afișează tichetul ca foaie A4 cu umbră */
.print-preview-screen {
  background: #555;
  padding: 18px 0;
  display: flex;
  justify-content: center;
}
.print-preview-screen .ticket-paper,
.print-preview-screen .centralizator-paper,
.print-preview-screen .aviz-paper {
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
}

/* ============================================================
   AVIZ DE ÎNSOȚIRE A MĂRFII — layout A4 portrait
   ============================================================ */

.aviz-paper {
  background: #fff;
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10.5px;
  line-height: 1.35;
  width: 210mm;
  min-height: 297mm;
  padding: 10mm 10mm;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Header cu 3 coloane */
.aviz-paper .a-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border: 1px solid #000;
  margin-bottom: 0;
}
.aviz-paper .a-col {
  padding: 6px 8px;
  font-size: 10px;
  line-height: 1.35;
}
.aviz-paper .a-col + .a-col {
  border-left: 1px solid #000;
}
.aviz-paper .a-furnizor > div,
.aviz-paper .a-client > div {
  margin-bottom: 1px;
}
.aviz-paper .a-furnizor strong,
.aviz-paper .a-client strong {
  font-weight: 700;
}

/* Coloana din mijloc — titlul avizului */
.aviz-paper .a-title {
  text-align: center;
  padding: 8px 8px;
}
.aviz-paper .a-title-h1 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.aviz-paper .a-title-box {
  border: 1px solid #000;
  padding: 4px 6px;
  font-size: 10.5px;
  display: inline-block;
  min-width: 85%;
}
.aviz-paper .a-title-box > div {
  padding: 1px 0;
}

/* Tabel produse */
.aviz-paper .a-products {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 10px;
}
.aviz-paper .a-products th,
.aviz-paper .a-products td {
  border: 1px solid #000;
  padding: 4px 6px;
  vertical-align: middle;
}
.aviz-paper .a-products th {
  background: #fff;
  font-weight: 700;
  text-align: center;
  font-size: 10px;
  line-height: 1.15;
}
.aviz-paper .a-products .a-cols-num td {
  text-align: center;
  font-weight: 400;
  font-size: 9.5px;
  padding: 2px 4px;
}
.aviz-paper .a-products .a-prod-row td {
  text-align: center;
  font-size: 10.5px;
  padding: 5px 6px;
}
.aviz-paper .a-products .a-prod-row td:nth-child(2) { text-align: left; }
.aviz-paper .a-products .a-prod-row td:nth-child(4),
.aviz-paper .a-products .a-prod-row td:nth-child(5),
.aviz-paper .a-products .a-prod-row td:nth-child(6),
.aviz-paper .a-products .a-prod-row td:nth-child(7) { text-align: right; padding-right: 8px; }
.aviz-paper .a-products .a-empty-row td {
  height: 16px;
  border-left: 1px solid #000;
  border-right: 1px solid #000;
  border-top: none;
  border-bottom: none;
}
.aviz-paper .a-products .a-empty-row:last-child td {
  border-bottom: 1px solid #000;
}

/* Footer în 3 coloane */
.aviz-paper .a-footer {
  display: grid;
  grid-template-columns: 90px 1fr 260px;
  border: 1px solid #000;
  border-top: none;
  font-size: 10px;
}
.aviz-paper .a-footer > div {
  padding: 6px 8px;
}
.aviz-paper .a-footer > div + div {
  border-left: 1px solid #000;
}

.aviz-paper .a-foot-left {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.aviz-paper .a-vertical-label {
  font-size: 10px;
  line-height: 1.3;
}
.aviz-paper .a-foot-middle > div {
  padding: 1px 0;
}

/* Blocul de totaluri (dreapta jos) */
.aviz-paper .a-totals {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 4px;
}
.aviz-paper .a-totals td {
  border: 1px solid #000;
  padding: 4px 6px;
  font-size: 10px;
}
.aviz-paper .a-totals tr:first-child td:first-child,
.aviz-paper .a-totals tr:nth-child(2) td:first-child {
  font-weight: 700;
  width: 40%;
}
.aviz-paper .a-totals tr td:not(:first-child) {
  text-align: right;
}
.aviz-paper .a-primire-box {
  border: 1px solid #000;
  border-top: none;
  padding: 8px 6px;
  font-size: 10px;
  min-height: 22px;
}
.aviz-paper .a-primire-box + .a-primire-box {
  border-top: none;
  min-height: 24px;
}

/* ============================================================
   CENTRALIZATOR — layout A4 portrait
   ============================================================ */

.centralizator-paper {
  background: #fff;
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  line-height: 1.45;
  width: 210mm;
  min-height: 297mm;
  padding: 14mm 14mm;
  margin: 0 auto;
  box-sizing: border-box;
}

.centralizator-paper .c-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1.5px solid #000;
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.centralizator-paper .c-party {
  flex: 1;
  font-size: 11px;
}
.centralizator-paper .c-party-right { text-align: right; }
.centralizator-paper .c-party-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #555;
  margin-bottom: 3px;
}
.centralizator-paper .c-party-name {
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 2px;
}

.centralizator-paper .c-title-block {
  text-align: center;
  margin: 8px 0 16px 0;
}
.centralizator-paper .c-title-block h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.8px;
  margin: 0 0 6px 0;
  text-transform: uppercase;
}
.centralizator-paper .c-meta-line {
  font-size: 11.5px;
  margin-top: 2px;
}

.centralizator-paper .c-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.8px;
  margin-top: 6px;
}
.centralizator-paper .c-table th,
.centralizator-paper .c-table td {
  border: 1px solid #000;
  padding: 5px 7px;
  vertical-align: middle;
}
.centralizator-paper .c-table th {
  background: #e8e8e8;
  font-weight: 700;
  text-align: center;
  font-size: 10.5px;
}
.centralizator-paper .c-table tbody tr:nth-child(even) td {
  background: #fafafa;
}
.centralizator-paper .c-table .c-num    { text-align: center; }
.centralizator-paper .c-table .c-right  { text-align: right; }
.centralizator-paper .c-table .c-mono   { font-family: 'Courier New', monospace; font-weight: 600; }

.centralizator-paper .c-total-row td {
  background: #d8d8d8 !important;
  font-weight: 700;
  font-size: 12px;
  padding: 7px 9px;
}

.centralizator-paper .c-summary {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 11px;
  padding: 8px 10px;
  background: #f5f5f5;
  border: 1px solid #ccc;
}

.centralizator-paper .c-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  font-size: 11.5px;
}
.centralizator-paper .c-signatures > div {
  width: 45%;
  text-align: center;
}
.centralizator-paper .c-sig-label {
  font-weight: 700;
  margin-bottom: 26px;
}
.centralizator-paper .c-sig-line {
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.centralizator-paper .c-sig-stamp {
  font-size: 10px;
  color: #555;
}

/* ============================================================
   MEDIA PRINT — ascunde tot, lasă doar tichetul (2 exemplare)
   ============================================================ */
@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { background: #fff !important; }
  body * { visibility: hidden !important; }
  #print-root, #print-root * { visibility: visible !important; }
  #print-root {
    position: absolute;
    left: 0; top: 0; right: 0;
    margin: 0; padding: 0;
  }
  .no-print, .no-print * { display: none !important; }

  .ticket-paper {
    box-shadow: none !important;
    width: 210mm;
    min-height: 0;
    height: auto;
    padding: 12mm 14mm;
    margin: 0;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  /* Page break între documente (tichet → aviz), dar NU după ultimul */
  .ticket-paper + .ticket-paper,
  .ticket-paper + .aviz-paper {
    page-break-before: always;
    break-before: page;
  }

  /* Aviz: o singură pagină A4 portrait */
  .aviz-paper {
    box-shadow: none !important;
    width: 210mm;
    min-height: 0;
    height: auto;
    padding: 8mm 10mm;
    margin: 0;
    page-break-inside: avoid;
    page-break-after: avoid;
  }
  .aviz-paper .a-products tr,
  .aviz-paper .a-footer {
    page-break-inside: avoid;
  }

  /* Centralizator: poate fi pe mai multe pagini, repetăm header-ul */
  .centralizator-paper {
    box-shadow: none !important;
    width: 210mm;
    min-height: 0;
    height: auto;
    padding: 10mm 12mm;
    margin: 0;
  }
  .centralizator-paper .c-table thead {
    display: table-header-group; /* repetă header-ul pe fiecare pagină */
  }
  .centralizator-paper .c-table tbody tr,
  .centralizator-paper .c-total-row {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .centralizator-paper .c-signatures,
  .centralizator-paper .c-summary {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .print-preview-screen { background: #fff !important; padding: 0 !important; }
}
