/* ============================================================
   budgeting.css
   Style khusus halaman budgeting-v2.html
   Lokasi: /assets/css/budgeting.css
   ============================================================ */

/* Warna judul kop perusahaan pada PDF (bukan bawaan Bootstrap 5) */
.text-orange {
  color: #fd7e14;
}

/* Logo pada kop PDF */
.kop-logo {
  height: 56px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
}

/* Badge perusahaan di tabel */
.badge-company {
  color: #fff;
  font-weight: 600;
}

/* ============================================================
   MODAL FORM PENGAJUAN - RESPONSIVE
   Form berada di antara .modal-content dan .modal-body, jadi
   dijadikan flex column supaya body bisa scroll & footer tetap
   terlihat di bawah (tidak tertutup layar).
   ============================================================ */
#budgetingFormModal .modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

#budgetingFormModal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#budgetingFormModal .modal-footer {
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: .5rem;
  background: #fff;
  border-top: 1px solid var(--bs-border-color) !important;
  padding-bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
}

/* Tinggi modal mengikuti layar (dvh = aman untuk address bar HP) */
#budgetingFormModal .modal-dialog-scrollable .modal-content {
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
}

#pdfPreviewModal .modal-footer {
  flex-wrap: wrap;
  gap: .5rem;
}

/* ---------- Tablet & HP: tabel barang jadi kartu ---------- */
@media (max-width: 767.98px) {

  #budgetingFormModal .modal-fullscreen-md-down .modal-content {
    max-height: 100%;
  }

  #budgetingFormModal .modal-body {
    padding: 1rem !important;
  }

  .items-wrap {
    border: 0 !important;
    overflow: visible !important;
  }

  #formItemsTable,
  #formItemsTable tbody,
  #formItemsTable tfoot {
    display: block;
    width: 100%;
  }

  #formItemsTable thead {
    display: none;
  }

  #formItemsTable tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
    align-items: end;
    border: 1px solid var(--bs-border-color);
    border-radius: .75rem;
    padding: .75rem;
    margin-bottom: .75rem;
    background: #fff;
  }

  #formItemsTable tbody td {
    display: block;
    border: 0;
    padding: 0;
    min-width: 0;
  }

  #formItemsTable td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: .75rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: .15rem;
  }

  #formItemsTable .td-no     { grid-column: 1;    grid-row: 1; text-align: left !important; font-weight: 700; }
  #formItemsTable td.td-no[data-label]::before { content: "Barang #"; display: inline; margin: 0; font-size: .85rem; color: #6c757d; }
  #formItemsTable .td-del    { grid-column: 2;    grid-row: 1; justify-self: end; }
  #formItemsTable .td-nama   { grid-column: 1 / -1; grid-row: 2; }
  #formItemsTable .td-qty    { grid-column: 1;    grid-row: 3; }
  #formItemsTable .td-satuan { grid-column: 2;    grid-row: 3; }
  #formItemsTable .td-harga  { grid-column: 1 / -1; grid-row: 4; }
  #formItemsTable .td-sub    { grid-column: 1 / -1; grid-row: 5; text-align: right !important; }

  #formItemsTable tfoot tr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem .75rem;
    border-radius: .75rem;
  }

  #formItemsTable tfoot th {
    display: block;
    border: 0;
    padding: 0;
    width: auto;
  }

  #formItemsTable tfoot th:last-child {
    display: none; /* kolom kosong untuk tombol hapus */
  }

  #budgetingFormModal .modal-footer .btn {
    flex: 1 1 auto;
  }
}