/* ==========================================================================
   folioList-theme.css
   Visual layer for Views/Folio/Index.cshtml (لیست فولیوها).

   Restyling only — no class is renamed, added or removed, so every hook in
   datepicker_folio.js keeps working: #filterFolio (the keyup row filter,
   which uses .toggle() and therefore owns `display` on tbody tr),
   .btnDeleteReserves, .btnDeleteFolio, .changeRoom, #folioBedehkar,
   #noReserve, #preReserve, #oldBedehi, and #tableFolio itself, which
   ExportToExcel() feeds straight into XLSX.utils.table_to_book().

   Because the Excel export serialises the live DOM table, no rule here may
   hide, reorder or inject cells — nothing below uses display:none,
   content, or order on a th/td.

   The table is Bootstrap 5.2.3 `.table.table-dark.table-hover`, which is
   driven entirely by --bs-table-* custom properties. Retheming through
   those variables keeps Bootstrap's own stripe/hover/border machinery
   intact and avoids !important everywhere.

   Perf note: long folio lists render hundreds of rows, so there are no
   per-row transitions, shadows or filters — only flat colour swaps.
   ========================================================================== */

:root {
  --fl-page-ink: #f2f5fa;
  --fl-card: #ffffff;
  --fl-card-border: #dfe4ec;
  --fl-ink: #1c222b;
  --fl-accent: #3b82f6;
  --fl-radius: 14px;
  --fl-radius-sm: 8px;

  --fl-head: #313947;
  --fl-head-ink: #e7ecf4;
}

/* ==========================================================================
   1. Page title
   ========================================================================== */

h3.text-center.text-white {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 2.25rem auto 1.5rem auto;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--fl-page-ink);
}

h3.text-center.text-white::before,
h3.text-center.text-white::after {
  content: "";
  flex: 1 1 0;
  max-width: 9rem;
  height: 1px;
  background: linear-gradient(
    to var(--fl-line-dir, left),
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.28) 100%
  );
}

h3.text-center.text-white::after {
  --fl-line-dir: right;
}

/* ==========================================================================
   2. Filter toolbar
   ========================================================================== */

/* The Vue datepicker popup (.pdp-picker, z-index 1001) must be able to
   overhang the table below it. Giving this bar its own stacking position
   lifts the popup above the sticky table header (z-index 20). Do not add
   overflow, transform, filter or backdrop-filter here — any of those would
   create a stacking context that traps the popup behind the grid. */
#filterBoxFolio {
  position: relative;
  z-index: 300;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--fl-radius);
  padding: 0.85rem 1rem 0.35rem 1rem;
  margin-bottom: 1rem;
}

#filterBoxFolio .pdp .pdp-overlay {
  z-index: 300;
}

#filterBoxFolio form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
}

/* The datepicker wrapper carries `mb-4` in the markup (a 1.5rem !important
   bottom margin). Against `align-items: flex-end` that margin lifted the
   whole picker 1.5rem above every other field. Zeroing the utility margins
   inside the toolbar puts all the controls on one baseline; the picker is
   still taller than its neighbours because it has its own label above the
   input, which is intended. */
#filterBoxFolio form .mb-4,
#filterBoxFolio form .mb-3,
#filterBoxFolio form .mb-2 {
  margin-bottom: 0 !important;
}

#filterBoxFolio .btnSearch {
  background-color: #4b5566;
  border-radius: var(--fl-radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.45rem 1.25rem;
}

#filterBoxFolio .btnSearch:hover {
  background-color: #5a6577;
}

#filterBoxFolio .form-control {
  background-color: #2b3240;
  border: 1px solid #3d4756;
  border-radius: var(--fl-radius-sm);
  color: #e8ecf3;
  font-size: 0.88rem;
  padding: 0.45rem 0.7rem;
}

#filterBoxFolio .form-control::placeholder {
  color: #8b95a5;
  opacity: 1;
}

#filterBoxFolio .form-control:focus {
  background-color: #2b3240;
  color: #fff;
  border-color: var(--fl-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

#filterBoxFolio label {
  font-size: 0.85rem;
  color: #cdd5e1;
  margin-inline-end: 0.35rem;
}

#filterBoxFolio .form-check-input {
  width: 1.05rem;
  height: 1.05rem;
  border: 1px solid #6b7686;
  background-color: #2b3240;
  vertical-align: middle;
}

#filterBoxFolio .form-check-input:checked {
  background-color: var(--fl-accent);
  border-color: var(--fl-accent);
}

/* ==========================================================================
   3. The table
   Bootstrap 5.2.3 reads all of these from custom properties.
   ========================================================================== */

#tableFolio {
  --bs-table-color: #e6eaf0;
  --bs-table-bg: #262b34;
  --bs-table-border-color: #39414f;
  --bs-table-striped-bg: #2b313b;
  --bs-table-striped-color: #e6eaf0;
  --bs-table-hover-bg: #39424f;
  --bs-table-hover-color: #ffffff;
  --bs-table-active-bg: #39424f;
  --bs-table-active-color: #ffffff;

  /* No `overflow` here on purpose: it would make the table its own
     scrollport and the sticky thead below would then scroll away with the
     table instead of pinning to the viewport. */
  font-variant-numeric: tabular-nums;
  margin-top: 0;
}

#tableFolio > :not(caption) > * > * {
  padding: 0.4rem 0.45rem;
  vertical-align: middle;
}

/* --- header ----------------------------------------------------------- */

/* Sticky so the 23 column labels stay readable on long lists. Under
   `border-collapse: collapse` a sticky cell drops its borders, so the
   bottom rule is drawn with an inset shadow instead. */
#tableFolio thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: var(--fl-head);
  color: var(--fl-head-ink);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 0 var(--fl-accent);
}

/* --- body ------------------------------------------------------------- */

#tableFolio tbody td {
  font-size: 0.82rem;
  text-align: center;
}

/* Money columns read as numbers, not prose. */
#tableFolio tbody td.priceFormat {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Folio code chip — the status colours (.folioRed, .neutral,
   .allPaymentsConfirmed, .allPeymentsConfirmedAndCheckout,
   .peymentsMoreThanBedehi) come from index.css with !important and are
   deliberately left untouched; only the chip's shape changes. */
#tableFolio .folioCode {
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

/* --- in-cell action buttons -------------------------------------------
   The originals are all solid Bootstrap fills, which turns each row into a
   wall of colour. These become quieter, uniform controls so the data reads
   first and destructive actions still stand out. */

#tableFolio tbody .btn {
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  min-width: 3.1rem;
  white-space: nowrap;
}

#tableFolio tbody .btn-secondary {
  background-color: transparent;
  border: 1px solid #59636f;
  color: #cbd3de;
}

#tableFolio tbody .btn-secondary:hover {
  background-color: #59636f;
  color: #fff;
}

/* Delete-reserves stays clearly destructive but stops shouting. */
#tableFolio tbody .btnDeleteReserves {
  background-color: transparent;
  border: 1px solid #c2568f;
  color: #e79ec1;
}

#tableFolio tbody .btnDeleteReserves:hover {
  background-color: #b8437f;
  color: #fff;
}

#tableFolio tbody .btnDeleteFolio {
  background-color: transparent !important;
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
  line-height: 1;
}

#tableFolio tbody .btnDeleteFolio:hover {
  background-color: rgba(220, 53, 69, 0.18) !important;
}

/* Room-change chip keeps its warning colour but gains a readable shape.
   `.dontChangeRoom` (a 6px blue ring from index.css) still wins. */
#tableFolio tbody .btnChangeRoom {
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.28rem 0.4rem;
  color: #4a3a00;
}

/* Minibar / expense cells are links that fill the cell — keep the semantic
   colours from index.css, just soften the corners. */
#tableFolio tbody .minibar a,
#tableFolio tbody .FolioExpense a {
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
}

#tableFolio tbody .totalPayments {
  cursor: pointer;
}

/* Flagged folios (.folioCheck, purple) */
#tableFolio tbody .folioCheck {
  border-radius: 6px;
  font-weight: 700;
}

/* ==========================================================================
   4. Export button
   ========================================================================== */

#folioTableContainer .btn-success {
  border-radius: var(--fl-radius-sm);
  background-color: #15803d;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.55rem 1.5rem;
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.9);
}

#folioTableContainer .btn-success:hover {
  background-color: #166534;
}

/* ==========================================================================
   5. Responsive
   ========================================================================== */

@media only screen and (max-width: 1200px) {
  h3.text-center.text-white {
    font-size: 1.15rem;
    margin: 1.5rem auto 1rem auto;
  }

  h3.text-center.text-white::before,
  h3.text-center.text-white::after {
    max-width: 3rem;
  }

  #filterBoxFolio {
    padding: 0.75rem;
  }

  #tableFolio tbody td,
  #tableFolio thead th {
    font-size: 0.75rem;
  }
}
