/* ==========================================================================
   reportTables-theme.css
   Visual layer for the report pages. Loaded AFTER reportTables.css.

   Currently linked from Views/Report/Peyments.cshtml. The other eight report
   views share the same shell (#filterContainer / #tableContainer /
   #tableReportReserve.tableData), so they can adopt this by adding the same
   one-line <link> — but they still need a <thead>/<tbody> split for the
   sticky header and the row filter to behave (see note below).

   CONTRACTS THAT MUST NOT BE BROKEN
   - shared_report.js writes an inline pixel `width` onto `#filterContainer
     form` on load and on resize, so width is owned by the script here.
   - shared_report.js filters rows with $('tbody tr').toggle(...), so
     `display` on data rows belongs to the script — nothing here may set it.
   - datePicker_report_peyment.js binds the two pickers BY DOM ORDER:
     .pdp-input eq(0) = تاریخ ثبت, eq(1) = تاریخ تایید. Their order in the
     markup is load-bearing.
   - `.confim span` is absolutely positioned against `.confim`, and the
     confirmed badge carries an inline `font-size:.1px` that hides its
     "تایید" text visually while keeping it in the DOM for the XLSX export
     (ExportToExcel serialises #tableReportReserve). Never override that
     font-size, and never add overflow to the cell.
   ========================================================================== */

:root {
  --rp-page-ink: #f2f5fa;
  --rp-head: #313947;
  --rp-head-ink: #e7ecf4;
  --rp-row: #ffffff;
  --rp-row-alt: #f4f6f9;
  --rp-grid: #dfe4ec;
  --rp-ink: #1c222b;
  --rp-ink-soft: #5b6472;
  --rp-accent: #3b82f6;
  --rp-radius: 14px;
  --rp-radius-sm: 8px;
  --rp-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.75);
}

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

h3.text-center.text-white {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 2rem auto 1.25rem auto;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--rp-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(--rp-line-dir, left),
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.28) 100%
  );
}

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

/* ==========================================================================
   2. Filter toolbar
   The datepicker popup must be able to overhang the table, so the bar gets
   its own stacking position above the sticky header (z-index 20). Do NOT
   add overflow, transform, filter or backdrop-filter here — each creates a
   stacking context that would trap the popup behind the grid.
   ========================================================================== */

#filterContainer form {
  position: relative;
  z-index: 300;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--rp-radius);
  padding: 0.85rem 1rem;

  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem 0.75rem;
}

/* Utility margins fight flex-end alignment the same way `mb-4` did in the
   other toolbars. */
#filterContainer form .mb-4,
#filterContainer form .mb-3,
#filterContainer form .mb-2 {
  margin-bottom: 0 !important;
}

#filterContainer label {
  display: block;
  margin: 0 0 0.3rem 0 !important;
  font-size: 0.82rem;
  font-weight: 600;
  color: #cdd5e1;
}

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

/* .form-select paints its chevron as a background image and reserves
   `padding-right: 2.25rem` for it; the shorthand above would flatten that
   and the text would run under the arrow. Physical sides on purpose — the
   LTR bootstrap.min.css is used under dir="rtl", so the chevron stays
   physically right. */
#filterContainer .form-select {
  padding-right: 2.25rem;
  padding-left: 0.7rem;
}

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

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

#filterContainer .form-select option {
  background-color: #2b3240;
  color: #e8ecf3;
}

/* The confirm-status radios read as one segmented control. */
.reportRadioGroup {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #3d4756;
  border-radius: var(--rp-radius-sm);
  padding: 0.28rem 0.4rem;
}

.reportRadioGroup .form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0.35rem;
  padding: 0;
  min-height: 0;
}

.reportRadioGroup .form-check-input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  float: none;
  border: 1px solid #6b7686;
  background-color: #2b3240;
}

.reportRadioGroup .form-check-input:checked {
  background-color: var(--rp-accent);
  border-color: var(--rp-accent);
}

.reportRadioGroup .form-check-label {
  margin: 0 !important;
  font-size: 0.82rem;
  color: #cdd5e1;
  cursor: pointer;
}

#filterContainer .btn {
  border-radius: var(--rp-radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.45rem 1.1rem;
  white-space: nowrap;
}

#filterContainer .btn-secondary {
  background-color: #4b5566;
  border-color: #4b5566;
}

#filterContainer .btn-secondary:hover {
  background-color: #5a6577;
}

#filterContainer .btn-success {
  background-color: #15803d;
  border-color: #15803d;
}

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

#filterContainer .btn-info {
  background-color: #0e7490;
  border-color: #0e7490;
  color: #fff;
}

#filterContainer .btn-info:hover {
  background-color: #155e75;
  color: #fff;
}

/* ==========================================================================
   3. The table
   ========================================================================== */

#tableContainer {
  padding-top: 0.25rem;
}

#tableReportReserve {
  background-color: var(--rp-row);
  border-radius: var(--rp-radius-sm);
  box-shadow: var(--rp-shadow);
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  /* No `overflow` here: it would make the table its own scrollport and the
     sticky thead below would scroll away with it instead of pinning. */
}

/* Sticky header. Requires the <thead>/<tbody> split in the view — without
   it the browser puts the header row inside the auto-generated tbody, where
   it is neither stickable nor safe from the row filter. */
#tableReportReserve thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: var(--rp-head);
  color: var(--rp-head-ink);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.65rem 0.5rem;
  white-space: nowrap;
  /* border-collapse drops borders on sticky cells, so the rule under the
     header is drawn as an inset shadow. */
  box-shadow: inset 0 -2px 0 0 var(--rp-accent);
}

#tableReportReserve tbody td {
  font-size: 0.85rem;
  color: var(--rp-ink);
  padding: 0.5rem;
  border-bottom: 1px solid var(--rp-grid);
}

/* Re-stated because reportTables.css stripes with :nth-child on a tbody
   that used to include the header row; with a real <thead> the parity
   flips, so the colours are redefined here rather than inherited. */
#tableReportReserve tbody tr:nth-child(odd) {
  background-color: var(--rp-row);
}

#tableReportReserve tbody tr:nth-child(even) {
  background-color: var(--rp-row-alt);
}

#tableReportReserve tbody tr:hover {
  background-color: #e4ebf6;
}

#tableReportReserve tbody td.priceFormat {
  font-weight: 700;
  letter-spacing: 0.01em;
}

#tableReportReserve tbody td a {
  color: var(--rp-accent);
  font-weight: 600;
  text-decoration: none;
}

#tableReportReserve tbody td a:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

/* Confirm badge cell — `.confim` keeps its own relative/absolute pairing
   from reportTables.css; only the badge's colour and shape change. The
   inline font-size:.1px on the confirmed span is deliberately untouched. */
#tableReportReserve .confim span {
  border-radius: var(--rp-radius-sm);
  width: 2.2rem;
  height: 2.2rem;
  box-shadow: 0 6px 14px -8px rgba(0, 0, 0, 0.6);
}

#tableReportReserve .confim span.bg-success {
  background-color: #15803d !important;
}

#tableReportReserve .confim span.bg-danger {
  background-color: #b91c1c !important;
}

#tableReportReserve .confim span:hover {
  filter: brightness(1.12);
}

#tableReportReserve .confim span::before {
  font-size: 1.5rem;
}

/* ==========================================================================
   4. 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;
  }

  #filterContainer form {
    padding: 0.75rem;
  }

  #tableReportReserve thead th,
  #tableReportReserve tbody td {
    font-size: 0.76rem;
  }
}
