/* ================================
   T-Nut Tool Styles (fresh build)
   Targets only classes emitted by:
   - TnutLayout.js
   - TnutOrderTool.js
   ================================ */

/* ---- Optional debug (uncomment while tuning) ---- */
/*
.tnut-bottom-row .panel { outline: 1px dashed #cfd8dc; }
*/

/* ---- Panels / container rows ---- */
.tnut-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}

.tnut-bottom-row {
  display: flex;
  gap: 5px;              /* match main.css */
  align-items: flex-start;
}
/* Generic panel chrome */
.panel {
  background: #fff;
  border: 1px solid #e6e8eb;
  border-radius: 8px;
  padding: 4px;
}
.tnut-filter-panel {
  flex: 1;
  max-width: 1210px;
  min-width: 1200px;
  min-height: 84px;
  border: 1px solid #CCCCCC;
  padding: 5px;
  box-sizing: border-box;
  align-self: stretch;
  margin-top: 0px;
  margin-bottom: 0px;
  display: flex;
  flex-direction: column;
  align-items: center;
}


/* Left & right panels */
.tnut-details-panel {
  flex: 1;
  max-width: 44%;
  min-width: 486px;
  min-height: 800px;
  position: sticky;
  top: 12px;                /* keeps details visible while scrolling right panel */
  max-height: calc(100vh - 160px);
  overflow: auto;
}

.tnut-order-panel {
  flex: 1.8;
  min-width: 300px;        /* match main.css */
}

#tnutFilterPills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---- Details (left) ---- */

/* Image grid (2×2) */
.tnut-details-panel .image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.tnut-details-panel .image-grid .image-cell {
  aspect-ratio: 1 / 1;
  border: 1px solid #e9edf0;
  border-radius: 6px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #fafbfc;
}

.tnut-details-panel .image-grid .image-wrapper {
  width: 100%;
  height: 100%;
}

.tnut-details-panel .image-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Description block */
.tnut-details-panel .description h4 {
  margin: 0 0 6px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2932;
}

.tnut-details-panel .description .desc-html {
  font-size: 13px;
  line-height: 1.5;
  color: #38434b;
  min-height: 2000px;
}

.tnut-details-panel .description .desc-html p {
  margin: 0 0 8px 0;
}

/* ---- Order (right) ---- */

/* Temporary placeholder styling until table is wired */
.tnut-order-panel .order-placeholder {
  padding: 8px;
  font-size: 13px;
  color: #3d4851;
}

.tnut-order-panel .order-placeholder h4 {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 600;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .tnut-bottom-row {
    flex-direction: column;     /* match main.css mobile behavior */
  }
  .tnut-details-panel,
  .tnut-order-panel {
    max-width: none;
    min-width: auto;
  }
  .tnut-details-panel {
    position: static;           /* keep your existing mobile relaxation */
    max-height: none;
  }
}

.tnut-filter-panel .panel {
  flex: 1;
  max-width: 350px;
  min-height: 258px;
  min-width: 350px;
  border: 1px solid #CCCCCC;
  padding: 5px;
  box-sizing: border-box;
  align-self: stretch;
  margin-top: 0px;
  margin-bottom: 0px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tnut-filter-panel .panel-title {
  margin: 5px;
  text-align: center;
  font-size: 16px;
  color: var(--color-text-error-highlight);
  font-family: Helvetica, Arial, sans-serif !important;
  font-weight: bold;
}

.tnut-filter-panel .filter-group {
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
}
.tnut-filter-panel .filter-group strong {
  margin-right: 8px;
  color: #333;
}

#tnutFilterPills .filter-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-family: sans-serif;
  font-size: 14px;
  background-color: var(--color-boxes-default);
  color: var(--color-text-default);
  border: 1px solid var(--color-border-pills-boxes-tableborders);
  margin: 5px;
  cursor: pointer;
  user-select: none;
}

#tnutFilterPills .filter-pill:hover {
  background-color: #e0e0e0;
}

#tnutFilterPills .filter-pill.selected {
  background-color: var(--color-boxes-selected);
  color: var(--color-text-for-selected-boxes);
  border-color: var(--color-boxes-border-selected);
}

/* ==== T-Nut Order Table — basic styling (matches renderTnutTable.js) ==== */

/* Card wrapper and scroller */
.tnut-order-table-card.panel {
  padding: 0.5rem;
  border: none;
  min-height: 1000px;
}
.tnut-order-table-scroll {
  overflow-x: auto;
}

/* Table + cells */
.tnut-order-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 4px 0;
  table-layout: fixed;
}
.tnut-order-table th,
.tnut-order-table td {
  border: 1px solid var(--color-border-pills-boxes-tableborders);
  padding: 8px 4px;
  text-align: center;
  vertical-align: middle;
  font-size: 14px;
}
.tnut-order-table th {
  background: #0c3a73;
  color: #fff;
  font-weight: 600;
}

/* Light numeric alignment for money columns (basic only) */
.tnut-order-table td.col-price-applied,
.tnut-order-table td.col-cost-payable {
  text-align: right;
}

/* Quantity input sizing (basic) */
.tnut-order-table td.col-qty input[type="number"] {
  width: 80px;
  max-width: 100%;
  padding: 4px 6px;
  box-sizing: border-box;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  box-shadow: none; /* remove default shadows */
}
.tnut-order-table td.col-qty input[type="number"]::placeholder {
  color: #888;
  font-size: 13px;
}
/* Remove browser number spinners */
.tnut-order-table td.col-qty input[type=number]::-webkit-inner-spin-button,
.tnut-order-table td.col-qty input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.tnut-order-table td.col-qty input[type=number] {
  -moz-appearance: textfield; /* Firefox */
}

/* ==== Qty input simple focus boundary (no animation, input-only) ==== */
.tnut-order-table td.col-qty input[data-role="qty-input"] {
  outline: none;              /* reset browser default */
  box-shadow: none;           /* ensure clean base */
  transition: none;           /* no animation */
}

.tnut-order-table td.col-qty input[data-role="qty-input"]:focus {
  outline: 2px solid rgba(0, 0, 0, 0.35);  /* light boundary while focused */
  outline-offset: 2px;                     /* small breathing room */
  border-radius: 4px;                      /* match input shape */
}

/* Keep showing focus even if the cell has error styling */
.tnut-order-table td.col-qty.field-error input[data-role="qty-input"]:focus {
  outline: 2px solid rgba(0, 0, 0, 0.35);
  outline-offset: 2px;
}


/* ==== T-Nut Order Table Column Widths ==== */

/* Product name column */
.tnut-order-table th.col-product,
.tnut-order-table td.col-product {
  font-size: 14px;   /* adjust wider if names wrap */
}

/* Thread / option value column */
.tnut-order-table th.col-thread,
.tnut-order-table td.col-thread {
  text-align: center;
}

/* Price per pc (tier string) */
.tnut-order-table th.col-price-tier {font-size: 14px;}
.tnut-order-table td.col-price-tier {
  font-size: 12px; /* smaller font so long tiers fit */
  line-height: 1.3;
  text-align: center;
}

/* Qty input */
.tnut-order-table th.col-qty,
.tnut-order-table td.col-qty {
  text-align: center;
}

/* Total (applied cost) */
.tnut-order-table th.col-cost-payable,
.tnut-order-table td.col-cost-payable {
  text-align: center;
}

/* T-Nut order table product name styling */
.tnut-order-table td.col-product a {
  text-decoration: none;  /* remove underline */
  color: inherit;         /* use normal table text color */
  font-weight: bold;      /* make it bold */
  cursor: pointer;        /* indicate it's clickable */
}


/* ==== T-Nut Order Table — hover affordances (Option B) ==== */

/* Subtle hover on individual variant rows */
.tnut-order-table tbody tr:hover {
  background: #e0e0e0;              /* very light tint */
}

/* Stronger affordance on product name link */
.tnut-order-table td.col-product a:hover,
.tnut-order-table td.col-product a:focus-visible {
  text-decoration: none;            /* keep clean */
  opacity: 0.85;                    /* slight emphasis */
}

/* Optional: focus ring for accessibility when tabbing */
.tnut-order-table td.col-product a:focus-visible {
  outline: 2px solid #cfe3ff;
  outline-offset: 2px;
  border-radius: 2px;
}


/* === Group hover via <tbody> (affects every row in the product block) === */
.tnut-order-table tbody[data-product-group]:hover tr {
  background: #f0f0f0; /* subtle tint across the whole group */
}
/* Ensure group-hover wins over the per-row :hover rule */
.tnut-order-table tbody[data-product-group]:hover tr:hover {
  background: #f0f0f0;
}

/* ===== Shared sizing so totals can match the last three columns ===== */
:root {
  /* Column widths for the order table (tweak as you like) */
  --tnut-col-product: 20%;
  --tnut-col-thread: 14%;
  --tnut-col-tier:   28%;
  --tnut-col-qty:    15%;
  --tnut-col-price:  13%;
  --tnut-col-cost:   14%;

  /* Totals table should span the last three columns (Qty + Price + Cost) */
  --tnut-totals-span: calc(var(--tnut-col-product) + var(--tnut-col-thread) + var(--tnut-col-tier));
}

.tnut-order-table {
  /* removed duplicate block */
}
.tnut-order-table thead th.col-product      { width: var(--tnut-col-product); }
.tnut-order-table thead th.col-thread       { width: var(--tnut-col-thread); }
.tnut-order-table thead th.col-price-tier   { width: var(--tnut-col-tier); }
.tnut-order-table thead th.col-qty          { width: var(--tnut-col-qty); }
.tnut-order-table thead th.col-price-applied{ width: var(--tnut-col-price); }
.tnut-order-table thead th.col-cost-payable { width: var(--tnut-col-cost); }

/* ===== Totals block ===== */
.tnut-totals-wrap {
  /* align the totals block's RIGHT EDGE with the order table */
  width: var(--tnut-totals-span);  /* equals last 3 cols */
  margin-left: 1px;               /* pushes it to the right edge */
  margin-top: 2px;
}

/* Totals table visuals */
.tnut-totals-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--color-border-pills-boxes-tableborders);
  table-layout: fixed;
  margin-top: 4px;
  margin-bottom: 4px;
}
.tnut-totals-table thead th {
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  color: #333;
  background: #fafafa;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border-pills-boxes-tableborders);
}
.tnut-totals-table td {
  text-align: right;
  padding: 10px;
  font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--color-border-pills-boxes-tableborders);
}
/* Emphasize the Total cell */
.tnut-totals-table .val-total {
  font-weight: 700;
  border-left-color: #e8e8e8;
}
.tnut-totals-table th,
.tnut-totals-table td {
  width: 33.3333%;
}

/* Button row */
.totals-actions {
  text-align: left;
  margin-top: 4px;
}
.totals-actions .btn.btn-primary[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

/* ===== Responsive nicety ===== */
@media (max-width: 720px) {
  /* On small screens, let totals take full width and stack naturally */
  :root {
    --tnut-totals-span: 100%;
  }
  .tnut-totals-wrap {
    width: 100%;
  }
  .tnut-totals-table thead th { font-size: 12px; }
  .tnut-totals-table td       { padding: 8px; }
}

/* Discount text styling inside Price Applied column */
.tnut-order-table td.col-price-applied .discount-text {
  color: #777;          /* grey */
  font-size: 12px;      /* slightly smaller than main price */
  margin-left: 4px;     /* small spacing from the price */
  font-weight: normal;  /* keep it lighter than main price */
}

.moq-hint {
  margin-top: 6px;   /* tweak as needed, e.g., 6px, 8px */
  font-size: 0.9em;  /* optional, make it slightly smaller */
  color: var(--color-text-error-highlight);    /* optional, dim the text */
}

/* ==== Out of Stock Badges ==== */
.oos-badge {
  margin-top: 6px;
  font-size: 0.9em;
  font-weight: 600;
  color: #b00020;      /* strong red for fully out of stock */
}

.oos-badge.oos-partial {
  color: #996c00;      /* amber tone for partial availability */
  font-weight: 500;
}

/* Style for the Add All to Cart button */
.tnut-checkout-btn {
  display: inline-block;   /* keeps it sized to content */
  width: 200px; 
  height: 70px;           /* about twice the current size, adjust as needed */
  padding: 10px 16px;      /* more comfortable padding */
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin: 1px
}