/* ==========================================================================
   product-theme.css
   Dark visual layer for every Product/* page (the stock manager). Linked from
   _Layout.cshtml, and every rule is scoped under `body.ctl-product`, so the
   page stylesheets the views link later (product.css, product2.css,
   reportTables.css) lose to it on specificity rather than on load order.

   Markup and the class names product.js / Product2.js / reportage.js rely on
   are untouched; only colour, spacing and shape change. Print views
   (PrintShoppingList) use Layout = null and never see this file.
   ========================================================================== */

body.ctl-product {
  --pm-card: #242a35;
  --pm-card-2: #2a303c;
  --pm-head: #313947;
  --pm-line: #39414f;
  --pm-ink: #e8ecf3;
  --pm-ink-soft: #a9b3c2;
  --pm-input: #2b3240;
  --pm-input-line: #3d4756;
  --pm-accent: #3b82f6;
  --pm-green: #22c55e;
  --pm-amber: #f59e0b;
  --pm-red: #ef4444;
  --pm-radius: 14px;
  --pm-radius-sm: 8px;
  --pm-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.75);
  color: var(--pm-ink);
}

/* ==========================================================================
   1. Page titles — every product page gets the same centred title with the
   thin rules either side that the report pages use.
   ========================================================================== */

body.ctl-product h1.text-white,
body.ctl-product h2.text-white,
body.ctl-product h2.text-light,
body.ctl-product h3.text-white {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 2rem auto 1.25rem auto !important;
  padding: 0 16px !important;
  font-size: 1.4rem;
  font-weight: 700;
  color: #f2f5fa !important;
}

body.ctl-product h1.text-white::before,
body.ctl-product h1.text-white::after,
body.ctl-product h2.text-white::before,
body.ctl-product h2.text-white::after,
body.ctl-product h2.text-light::before,
body.ctl-product h2.text-light::after {
  content: "";
  flex: 1 1 0;
  max-width: 9rem;
  height: 1px;
  background: linear-gradient(to left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.28) 100%);
}

body.ctl-product h1.text-white::after,
body.ctl-product h2.text-white::after,
body.ctl-product h2.text-light::after {
  background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.28) 100%);
}

/* ==========================================================================
   2. Product/Index — grouped card menu
   ========================================================================== */

.pmMenu {
  max-width: 1100px;
  margin: 0 auto 3rem auto;
  padding: 0 16px;
}

.pmGroup + .pmGroup {
  margin-top: 1.75rem;
}

.pmGroupTitle {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--pm-ink-soft);
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--pm-line);
}

.pmGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.85rem;
}

.pmCard {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 1.15rem;
  min-height: 7rem;
  border-radius: var(--pm-radius);
  background: var(--pm-card);
  border: 1px solid var(--pm-line);
  color: var(--pm-ink);
  text-decoration: none;
  box-shadow: var(--pm-shadow);
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.pmCard:hover {
  color: #fff;
  background: var(--pm-card-2);
  border-color: var(--pm-accent);
  transform: translateY(-2px);
}

.pmCard .bi {
  font-size: 1.5rem;
  color: var(--pm-accent);
  line-height: 1;
  margin-bottom: 0.35rem;
}

.pmCardTitle {
  font-size: 1rem;
  font-weight: 700;
}

.pmCardSub {
  font-size: 0.8rem;
  color: var(--pm-ink-soft);
  line-height: 1.6;
}

/* Shopping list has items waiting: red edge and dot, as the old red button did. */
.pmCardAlert {
  border-color: rgba(239, 68, 68, 0.7);
}

.pmCardAlert .bi,
.pmCardAlert .pmCardSub {
  color: #fca5a5;
}

.pmCardAlert::after,
.pmCardNew::after {
  content: "";
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--pm-red);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}

/* Something came in today: amber, as the old yellow button did. */
.pmCardNew {
  border-color: rgba(245, 158, 11, 0.7);
}

.pmCardNew .bi,
.pmCardNew .pmCardSub {
  color: #fcd34d;
}

.pmCardNew::after {
  background: var(--pm-amber);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
}

.pmCardMuted {
  min-height: 0;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.03);
}

.pmCardMuted .bi {
  font-size: 1.2rem;
  margin: 0;
  color: var(--pm-ink-soft);
}

.pmCardMuted .pmCardTitle {
  font-size: 0.9rem;
  font-weight: 600;
}

/* ==========================================================================
   3. Form controls and buttons
   ========================================================================== */

body.ctl-product main .form-control,
body.ctl-product > form .form-control,
body.ctl-product > div .form-control,
body.ctl-product > form .form-select,
body.ctl-product > div .form-select {
  background-color: var(--pm-input);
  border: 1px solid var(--pm-input-line);
  border-radius: var(--pm-radius-sm);
  color: var(--pm-ink);
}

body.ctl-product > form .form-control::placeholder,
body.ctl-product > div .form-control::placeholder {
  color: #8b95a5;
  opacity: 1;
}

body.ctl-product > form .form-control:focus,
body.ctl-product > div .form-control:focus,
body.ctl-product > form .form-select:focus,
body.ctl-product > div .form-select:focus {
  background-color: var(--pm-input);
  color: #fff;
  border-color: var(--pm-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

body.ctl-product .form-select option {
  background-color: var(--pm-input);
  color: var(--pm-ink);
}

/* The modal on ProductsList keeps Bootstrap's light dialog — its inputs are inside .modal. */
body.ctl-product .modal .form-control,
body.ctl-product .modal .form-select {
  background-color: #fff;
  color: #212529;
  border-color: #ced4da;
}

/* product.js marks an item that already has a stock count in orange. */
body.ctl-product .form-control.alreadyExist,
body.ctl-product .form-control.alreadyExist:focus {
  background-color: #c2410c;
  border-color: #ea580c;
  color: #fff;
}

body.ctl-product .btn {
  border-radius: var(--pm-radius-sm);
  font-weight: 700;
}

body.ctl-product .btn-primary {
  background-color: #2563eb;
  border-color: #2563eb;
}

body.ctl-product .btn-primary:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

body.ctl-product .btn-secondary {
  background-color: #4b5566;
  border-color: #4b5566;
}

body.ctl-product .btn-secondary:hover {
  background-color: #5a6577;
  border-color: #5a6577;
}

body.ctl-product .btn-success {
  background-color: #15803d;
  border-color: #15803d;
}

body.ctl-product .btn-success:hover {
  background-color: #166534;
}

body.ctl-product .btn-info {
  background-color: #0e7490;
  border-color: #0e7490;
  color: #fff;
}

body.ctl-product .btn-info:hover {
  background-color: #155e75;
  color: #fff;
}

body.ctl-product .btn-danger {
  background-color: #b91c1c;
  border-color: #b91c1c;
}

body.ctl-product .form-check-input {
  background-color: var(--pm-input);
  border-color: #6b7686;
}

body.ctl-product .form-check-input:checked {
  background-color: var(--pm-accent);
  border-color: var(--pm-accent);
}

/* ==========================================================================
   4. Entry rows — ShoppingList, Import (one row per product being entered)
   ========================================================================== */

body.ctl-product #frmShoppingList,
body.ctl-product #frmSubmitImportedProducts {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px !important;
}

body.ctl-product .shopping-item,
body.ctl-product .product-item {
  background: var(--pm-card);
  border: 1px solid var(--pm-line);
  border-radius: var(--pm-radius-sm);
  padding: 0.4rem 0.6rem;
  margin-top: 0.6rem !important;
  gap: 0.15rem;
}

body.ctl-product .lastImport {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #bbf7d0;
  padding: 0.15rem 0.5rem 0.15rem 0.6rem;
  margin: 0.3rem;
  border-radius: 999px;
  font-size: 0.8rem;
}

body.ctl-product .lastImport .last-count,
body.ctl-product .lastExist .last-count {
  background: transparent;
  padding: 0.1rem 0.3rem;
  margin: 0;
  font-weight: 700;
  color: inherit;
}

body.ctl-product .lastExist {
  display: inline-flex;
  align-items: center;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fecaca;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  margin: 0.3rem;
  font-size: 0.8rem;
}

body.ctl-product .deleteButton {
  color: #fca5a5;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: var(--pm-radius-sm);
}

body.ctl-product .deleteButton:hover {
  background: rgba(239, 68, 68, 0.15);
}

body.ctl-product .deleteButton i {
  font-style: normal;
}

body.ctl-product .UpDownArrow span {
  background-color: #2b3240;
  border: 1px solid var(--pm-input-line);
  font-size: 1.2rem;
}

body.ctl-product .UpDownArrow span:hover {
  background-color: var(--pm-accent);
}

/* ==========================================================================
   5. Export — quick +/- count keys
   ========================================================================== */

body.ctl-product #product-export {
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--pm-radius);
}

body.ctl-product #product-export > div {
  align-items: center;
  flex-wrap: wrap;
}

body.ctl-product #product-export > div span.editCount {
  background-color: #3a3222;
  border: 1px solid #6b5a2e;
  color: #fcd34d;
  border-radius: var(--pm-radius-sm);
  padding: 1.15rem 1.35rem;
}

body.ctl-product #product-export > div span.editCount:hover {
  background-color: #5b4a22;
}

body.ctl-product .days-btn {
  margin: 0.2rem;
}

body.ctl-product div:has(> .days-btn) {
  text-align: center;
}

/* ==========================================================================
   6. Tables — every product table becomes the same dark card. On a narrow
   screen the table scrolls sideways inside itself instead of widening the page.
   ========================================================================== */

body.ctl-product .existingProduct-table,
body.ctl-product .importedProduct-table,
body.ctl-product .exportedProduct-table,
body.ctl-product .table-reportage,
body.ctl-product .table-all-product-statistic,
body.ctl-product .add-or-edit-report table {
  display: block;
  width: max-content !important;
  max-width: calc(100% - 32px);
  overflow-x: auto;
  margin: 1rem auto !important;
  background: var(--pm-card) !important;
  color: var(--pm-ink) !important;
  border-collapse: collapse;
  border-radius: var(--pm-radius-sm);
  box-shadow: var(--pm-shadow);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

body.ctl-product .existingProduct-table thead,
body.ctl-product .importedProduct-table thead {
  background: transparent;
}

body.ctl-product .existingProduct-table th,
body.ctl-product .importedProduct-table th,
body.ctl-product .exportedProduct-table th,
body.ctl-product .table-reportage th,
body.ctl-product .table-all-product-statistic th,
body.ctl-product .add-or-edit-report table thead th {
  background: var(--pm-head) !important;
  color: #e7ecf4 !important;
  border: 0 !important;
  box-shadow: inset 0 -2px 0 0 var(--pm-accent);
  padding: 0.65rem 0.6rem !important;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  height: auto;
}

body.ctl-product .existingProduct-table td,
body.ctl-product .importedProduct-table td,
body.ctl-product .exportedProduct-table td,
body.ctl-product .table-reportage td,
body.ctl-product .table-all-product-statistic td,
body.ctl-product .add-or-edit-report table td {
  background: transparent !important;
  color: var(--pm-ink) !important;
  border: 0 !important;
  border-bottom: 1px solid var(--pm-line) !important;
  padding: 0.5rem 0.6rem !important;
}

body.ctl-product .existingProduct-table tbody tr:nth-child(odd),
body.ctl-product .importedProduct-table tbody tr:nth-child(odd),
body.ctl-product .exportedProduct-table tbody tr:nth-child(odd),
body.ctl-product .table-reportage tbody tr:nth-child(odd),
body.ctl-product .table-all-product-statistic tr:nth-child(odd),
body.ctl-product .add-or-edit-report table tbody tr:nth-child(odd) {
  background-color: var(--pm-card) !important;
}

body.ctl-product .existingProduct-table tbody tr:nth-child(even),
body.ctl-product .importedProduct-table tbody tr:nth-child(even),
body.ctl-product .exportedProduct-table tbody tr:nth-child(even),
body.ctl-product .table-reportage tbody tr:nth-child(even),
body.ctl-product .table-all-product-statistic tr:nth-child(even),
body.ctl-product .add-or-edit-report table tbody tr:nth-child(even) {
  background-color: var(--pm-card-2) !important;
}

body.ctl-product .existingProduct-table tbody tr:hover,
body.ctl-product .importedProduct-table tbody tr:hover,
body.ctl-product .exportedProduct-table tbody tr:hover,
body.ctl-product .table-reportage tbody tr:hover,
body.ctl-product .table-all-product-statistic tr:hover,
body.ctl-product .table-reportage tr:hover td {
  background-color: #323b4a !important;
}

/* Imports read green and exports blue — the colour the old row stripes carried. */
body.ctl-product .importedProduct-table {
  border-top: 3px solid var(--pm-green);
}

body.ctl-product .exportedProduct-table {
  border-top: 3px solid var(--pm-accent);
}

body.ctl-product .table-all-product-statistic td span.days {
  display: inline-block;
  width: auto;
  min-width: 1.6rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background-color: rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
  text-align: center;
}

/* ExistingPruductReport: the counting grid has inputs in its cells. */
body.ctl-product .add-or-edit-report table tbody tr input,
body.ctl-product .add-or-edit-report table tbody tr:nth-child(even) input {
  background-color: var(--pm-input) !important;
  border: 1px solid var(--pm-input-line) !important;
  border-radius: 6px;
  color: var(--pm-ink);
}

body.ctl-product .add-or-edit-report table tbody tr td i {
  color: #fca5a5 !important;
}

body.ctl-product #frmExistingProductReport {
  padding-bottom: 4rem;
}

/* AddOrEditReportStatusProduct — one card. product.css still sizes the form at 20rem and
   paints #submit red; the id selectors here win over both. */
body.ctl-product #frmReportStatusProduct.scCard {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 560px;
  max-width: calc(100% - 32px);
  margin: 0 auto 3rem auto;
  padding: 1.25rem 1.35rem 1.35rem 1.35rem;
  background: var(--pm-card);
  border: 1px solid var(--pm-line);
  border-radius: var(--pm-radius);
  box-shadow: var(--pm-shadow);
  color: var(--pm-ink);
}

.scHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--pm-line);
}

.scBack {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--pm-ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.scBack:hover {
  color: #fff;
}

.scState {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
}

.scStateOpen {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fcd34d;
}

.scStateDone {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.5);
  color: #86efac;
}

.scInfo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.scField {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.scField label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--pm-ink-soft);
  margin: 0;
}

body.ctl-product #frmReportStatusProduct .form-control {
  width: 100%;
  background-color: var(--pm-input);
  border: 1px solid var(--pm-input-line);
  border-radius: var(--pm-radius-sm);
  color: var(--pm-ink);
}

body.ctl-product #frmReportStatusProduct .form-control[readonly] {
  background-color: rgba(255, 255, 255, 0.04);
  color: #cdd5e1;
  text-align: right;
}

body.ctl-product #frmReportStatusProduct .form-control:focus {
  border-color: var(--pm-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

body.ctl-product #frmReportStatusProduct textarea.form-control {
  resize: vertical;
  min-height: 6rem;
}

.scFinish {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0;
  padding: 0.8rem 0.9rem;
  border: 1px dashed rgba(239, 68, 68, 0.45);
  border-radius: var(--pm-radius-sm);
  background: rgba(239, 68, 68, 0.06);
  cursor: pointer;
}

.scFinish span {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.scFinish strong {
  font-size: 0.92rem;
}

.scFinish small {
  font-size: 0.78rem;
  color: var(--pm-ink-soft);
  line-height: 1.7;
}

body.ctl-product #frmReportStatusProduct #submit {
  flex: 0 0 auto;
  width: 1.3rem;
  height: 1.3rem;
  margin: 0.1rem 0 0 0;
  background-color: var(--pm-input) !important;
  border: 1px solid #6b7686;
  border-radius: 5px;
  cursor: pointer;
}

body.ctl-product #frmReportStatusProduct #submit:checked {
  background-color: #dc2626 !important;
  border-color: #dc2626;
}

.scActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.scActions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
}

@media only screen and (max-width: 480px) {
  .scActions {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   7. ExportMinibar — one card per folio
   ========================================================================== */

body.ctl-product .minibar-export {
  background: var(--pm-card);
  color: var(--pm-ink);
  border: 1px solid var(--pm-line);
  border-radius: var(--pm-radius-sm);
  box-shadow: var(--pm-shadow);
}

body.ctl-product .minibar-export .folio-info .rooms a {
  background-color: rgba(245, 158, 11, 0.18);
  color: #fcd34d !important;
}

body.ctl-product .minibar-export .folio-minibar .minibar-exported-item label {
  color: var(--pm-ink);
}

body.ctl-product .minibar-export .folio-minibar .minibar-exported-item span {
  background-color: #7f1d1d;
  border-radius: 4px;
}

/* ==========================================================================
   8. Report-shell tables (.tableData): ProductsList and the three
   deleted/changed logs. reportTables.css paints their rows light grey, and
   the light page ink this theme sets would vanish on them — so they get the
   dark card instead.
   ========================================================================== */

/* A wide log scrolls sideways inside its container instead of running off a phone screen. */
body.ctl-product #tableContainer {
  max-width: 100%;
  overflow-x: auto;
  padding: 0 16px;
}

body.ctl-product .tableData {
  min-width: 100%;
  background: var(--pm-card);
  border-radius: var(--pm-radius-sm);
  box-shadow: var(--pm-shadow);
  border-collapse: collapse;
  overflow: hidden;
}

body.ctl-product .tableData th {
  background: var(--pm-head) !important;
  color: #e7ecf4 !important;
  box-shadow: inset 0 -2px 0 0 var(--pm-accent);
  padding: 0.7rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

body.ctl-product .tableData td {
  color: var(--pm-ink) !important;
  border-bottom: 1px solid var(--pm-line);
  font-size: 0.88rem;
  padding: 0.55rem 0.6rem;
}

body.ctl-product .tableData tbody tr:nth-child(odd) {
  background-color: var(--pm-card) !important;
}

body.ctl-product .tableData tbody tr:nth-child(even) {
  background-color: var(--pm-card-2) !important;
}

body.ctl-product .tableData tbody tr:hover {
  background-color: #323b4a !important;
}

/* ProductsList: the name reads first, the row's quiet columns stay readable but softer. */
body.ctl-product .crudTable .crudName {
  font-weight: 600;
  color: #f2f5fa !important;
}

body.ctl-product .crudTable tr.crudInactive td {
  color: #7c8696 !important;
}

body.ctl-product .crudNote {
  color: var(--pm-ink-soft);
}

body.ctl-product .crudCount {
  color: var(--pm-ink-soft);
}

/* ==========================================================================
   9. Responsive
   ========================================================================== */

@media only screen and (max-width: 768px) {
  body.ctl-product h1.text-white,
  body.ctl-product h2.text-white,
  body.ctl-product h2.text-light,
  body.ctl-product h3.text-white {
    font-size: 1.15rem;
    margin: 1.5rem auto 1rem auto !important;
  }

  .pmGrid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.6rem;
  }

  .pmCard {
    min-height: 0;
    padding: 0.85rem;
  }

  .pmCardSub {
    display: none;
  }

  body.ctl-product .shopping-item input,
  body.ctl-product .product-item input {
    max-width: 100%;
  }

  body.ctl-product #frmReportStatusProduct {
    width: auto;
  }
}
