/**
 * Module: /public/css/quote_builder.css
 * Updated: 2025-10-27
 * Batch #13 — “Design is not just what it looks like and feels like. Design is how it works.” — Steve Jobs
 * © Steam Factory — Built with ❤️ by the awesome crew at Steam Factory
 * chatGPT says, "and I helped!"
 *
 * Purpose:
 *   Restores the prototype’s elegant 3-column layout for Quote Builder inside portal tabs.
 *   Ensures dropdowns, grids, and build panels retain consistent spacing and style.
 */

body {
  font-family: "Zilla Slab", serif;
  margin: 0;
  background: #f8f9fa;
  color: #222;
}



/* Panels */
.left, .center, .right {
  background: #fff;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}

/* Headings */
h2 {
  margin-top: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

th, td {
  border: 1px solid #ddd;
  padding: 0.4rem 0.5rem;
  text-align: left;
}

th {
  background: #eee;
}

tr.disabled {
  background: #f5f5f5;
  color: #aaa;
}

tr.added {
  background: #fff7cc;
}

/* Buttons */
button.sf-btn-mini {
  background: #ffcc00;
  border: none;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-family: "Zilla Slab", serif;
}

button.sf-btn-mini:hover {
  background: #fff000;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Forms */
label {
  font-weight: 600;
}

input, select {
  width: 100%;
  padding: 0.3rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-top: 0.2rem;
  font-family: "Zilla Slab", serif;
  font-size: 0.95rem;
}

fieldset {
  border: 2px solid #ffcc00;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.8rem;
}

legend {
  font-weight: 600;
  font-size: 1.05rem;
}

.inline-radio {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.5rem 0;
}

.inline-radio label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 500;
}

.inline-radio input[type="radio"] {
  margin: 0;
}

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
  width: 100%;
}

.dropdown button {
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-family: "Zilla Slab", serif;
  font-size: 0.95rem;
}

.dropdown button::after {
  content: "▾";
  float: right;
  color: #999;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  z-index: 1000;
  max-height: 220px;
  overflow-y: auto;
  border-radius: 4px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  animation: dropdownFade 0.15s ease-out;
}

@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-menu table {
  width: 100%;
  border-collapse: collapse;
}

.dropdown-menu th, .dropdown-menu td {
  border-bottom: 1px solid #eee;
  padding: 6px 8px;
  text-align: left;
  font-size: 0.9rem;
}

.dropdown-menu tr:hover {
  background: #fffae6;
  cursor: pointer;
}

.dropdown-menu th {
  background: #ffcc00;
  color: #000;
  position: sticky;
  top: 0;
}

/* Two-column form rows */
.row-two {
  display: flex;
  gap: 1rem;
}
.row-two > div {
  flex: 1;
}

/* Build details panel */
.build-details {
  margin-top: 1rem;
  border-top: 3px solid #ffcc00;
  padding-top: 1rem;
}

#total_price {
  background: #ffcc00;
  color: #000;
  font-weight: 700;
  font-size: 1.2rem;
  border: none;
  text-align: center;
  border-radius: 6px;
  padding: 0.5rem;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.2);
}

#total_price::placeholder {
  color: #555;
  font-weight: 400;
  font-style: italic;
}

/* Toasts */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 15px;
  border-radius: 4px;
  color: #fff;
  z-index: 9999;
  font-weight: 600;
}
.toast.info { background: #333; }
.toast.success { background: #3c3; }
.toast.error { background: #c33; }


.auto-calc-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: #666;
  opacity: 0.8;
  transition: opacity 0.3s ease, color 0.3s ease;
  cursor: default;
}

.auto-calc-status:hover {
  opacity: 1;
  color: #000;
}

.auto-calc-status::before {
  content: "⚙️";
  animation: spin-slow 6s linear infinite;
  display: inline-block;
  transform-origin: center;
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.sf-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
}

.auto-calc-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: #666;
  opacity: 0.8;
  transition: opacity 0.5s ease, color 0.3s ease, filter 0.6s ease;
}

.auto-calc-status::before {
  content: "⚙️";
  animation: spin-slow 6s linear infinite;
  display: inline-block;
  transform-origin: center;
  filter: brightness(0.9);
}

.auto-calc-status:hover {
  opacity: 1;
  color: #000;
}

.auto-calc-status.sleep {
  opacity: 0.4;
  filter: grayscale(0.7);
}

.auto-calc-status.sleep::before {
  animation-play-state: paused; /* ⏸️ stop spinning while sleeping */
  filter: grayscale(1);
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
}


/* =======================================================
   🔷 BASE LAYOUT & GLOBAL ELEMENTS
======================================================= */
body {
  font-family: "Zilla Slab", serif;
  margin: 0;
  background: #f8f9fa;
  color: #222;
}


.left, .center, .right {
  background: #fff;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 0 10px rgba(0, 0, 0, .1);
  position: relative;
  overflow: visible;
  z-index: 1;
}

h1, h2 {
  margin-top: 0;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: .5rem;
  font-size: .95rem;
}

th, td {
  border: 1px solid #ddd;
  padding: .4rem .5rem;
  text-align: left;
}

th { background: #eee; }

button.sf-btn-mini {
  background: #ffcc00;
  border: none;
  padding: .3rem .6rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}
button.sf-btn-mini:hover { background: #ffe14a; }

fieldset {
  border: 2px solid #ffcc00;
  padding: .5rem 1rem;
  border-radius: 6px;
  margin-bottom: .8rem;
}
legend { font-weight: 600; }

.inline-radio {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  margin: .5rem 0;
}
.inline-radio label {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-weight: 500;
}

.sfp-total-row td {
  border-top: 2px solid #ffcc00;
  background: #fffbe6;
}

.sf-price-btn {
  background: var(--sf-gold, #ffcc00);
  color: #000;
  font-weight: 700;
  border: none;
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}
.sf-price-btn:hover {
  background: var(--sf-gold-light, #ffe14a);
  transform: translateY(-1px);
}

/* 💰 Pricing Modal */
.sf-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.sf-modal-content {
  background: #fff;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 480px;
}
.sf-modal-content h2 {
  margin-top: 0;
  border-bottom: 2px solid #ffcc00;
  padding-bottom: 0.3rem;
}
.sf-modal-content input {
  width: 100%;
  margin-bottom: 0.6rem;
  box-sizing: border-box;
}

.sf-modal.hidden { display: none !important; }
.sf-modal p { font-size: 1rem; text-align: center; margin: 1rem 0; }



/* =======================================================
   📁 RFQ FILES TABLE & QUANTITIES
======================================================= */
#rfqFiles td:nth-child(4),
#rfqFiles td:nth-child(5),
#rfqFiles td:nth-child(6) {
  text-align: center;
  font-weight: 600;
}
#rfqFiles td:nth-child(6) { color: #006400; } /* remaining */
#rfqFiles tr.over-assigned td:nth-child(6) {
  color: #a00;
  background: #ffe6e6;
}

/* Live update animations */
#rfqFiles td {
  transition: background 0.3s ease, color 0.3s ease;
}

/* File states */
#rfqFiles tr.fully-assigned td:nth-child(6) {
  color: #007700;
  background: #e8ffe8;
  font-weight: 700;
}
#buildTableBody tr.over-assigned {
  background: #fff0f0;
}

#rfqFiles tbody tr.disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(1);
  transition: opacity 0.2s ease, filter 0.2s ease;
}
#rfqFiles tbody tr:not(.disabled):hover {
  background: rgba(255, 204, 0, 0.08);
}


/* =======================================================
   🧩 BUILD PLANNER PANEL
======================================================= */
.build-planner {
  background: #fff;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 0 10px rgba(0, 0, 0, .1);
  border: 2px solid #ffcc00;
}
.build-planner h2 {
  margin-top: 0;
  color: #111;
  font-weight: 700;
  border-bottom: 2px solid #ffcc00;
  padding-bottom: .3rem;
  margin-bottom: .6rem;
}

.planner-fieldset {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: .75rem;
  margin-bottom: 1rem;
}
.planner-fieldset legend { font-weight: 600; color: #000; }
.planner-fieldset p { margin: .5rem 0; }
.planner-fieldset input[type="text"],
.planner-fieldset input[type="number"] {
  width: 100%;
  padding: .3rem .4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: "Zilla Slab", serif;
  font-size: .9rem;
  box-sizing: border-box;
}

/* === Build Planner Table === */
#plannerParts {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  margin-top: .5rem;
}
#plannerParts th, #plannerParts td {
  border: 1px solid #ddd;
  padding: .3rem .4rem;
  text-align: center;
  vertical-align: middle;
}
#plannerParts th {
  background: #ffcc00;
  color: #000;
  font-weight: 700;
  white-space: nowrap;
}
#plannerParts th:first-child, #plannerParts td:first-child {
  text-align: left;
  padding-left: 0.6rem;
  width: 55%;
}
#plannerParts th:nth-child(2),
#plannerParts th:nth-child(3),
#plannerParts th:nth-child(4),
#plannerParts td:nth-child(2),
#plannerParts td:nth-child(3),
#plannerParts td:nth-child(4) {
  width: 50px;
  text-align: center;
  white-space: nowrap;
  padding: .25rem;
}

/* Numeric inputs */
#plannerParts td input[type="number"] {
  width: 100%;
  max-width: 55px;
  padding: 0.25rem;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: "Zilla Slab", serif;
  font-size: .85rem;
  box-sizing: border-box;
}
#plannerParts td.calc {
  font-weight: 700;
  background: #fffbe6;
  color: #111;
}

/* Summary & Actions */
.planner-summary {
  background: #fff8dc;
  border: 1px dashed #ffcc00;
  border-radius: 6px;
  padding: .6rem;
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
}
.planner-actions { text-align: right; margin-top: 1rem; }

#savePlannerBtn {
  background: #28a745;
  color: #fff;
  font-weight: 600;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}
#savePlannerBtn:hover { background: #32c85e; }

/* =======================================================
   ⚙️ BUILD DETAILS PANEL
======================================================= */
.build-details-box {
  background: #fff;
  border-radius: 8px;
  padding: 1rem;
  border: 2px solid #ffcc00;
  box-shadow: 0 0 10px rgba(0, 0, 0, .1);
}
.build-details-box h2 {
  border-bottom: 2px solid #ffcc00;
  padding-bottom: .3rem;
  margin-bottom: .75rem;
}
.build-details {
  margin-top: 1rem;
  border-top: 3px solid #ffcc00;
  padding-top: 1rem;
}

.full-span { width: 100%; box-sizing: border-box; }
.row-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  width: 98%;
  box-sizing: border-box;
}
label { display: block; font-weight: 600; margin-top: 0.75rem; }
input {
  width: 98%;
  padding: 0.4rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: "Zilla Slab", serif;
  font-size: 0.95rem;
}

#total_price.gold-box {
  background: #ffcc00;
  color: #000;
  font-weight: 700;
  font-size: 1.2rem;
  border: none;
  text-align: center;
  border-radius: 6px;
  padding: 0.5rem;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.2);
}
#total_price.gold-box::placeholder {
  color: #555;
  font-style: italic;
  font-weight: 400;
}

/* =======================================================
   🧱 BUILDS IN QUOTE PANEL
======================================================= */
.quote-builds-box {
  background: #fff;
  border-radius: 8px;
  padding: 1rem;
  border: 2px solid #ffcc00;
  box-shadow: 0 0 10px rgba(0, 0, 0, .1);
}

/* Nested builds view */
.build-details-box {
  background: #fffbe6;
  border: 1px solid #ffcc00;
  border-radius: 6px;
  padding: 0.5rem;
  margin-top: 0.25rem;
  box-shadow: inset 0 0 5px rgba(0,0,0,0.1);
}
.nested-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.nested-table th, .nested-table td {
  border: 1px solid #ddd;
  padding: 4px 6px;
  text-align: left;
}
.nested-table th {
  background: #fff3b0;
  color: #222;
}
.build-row {
  cursor: pointer;
  transition: background 0.2s ease;
}
.build-row:hover { background: #fff8cc; }

/* =======================================================
   💰 PRICING BUTTON (Quote Builder Only)
======================================================= */
.sf-price-btn {
  background: #ffcc00;
  color: #000;
  font-weight: 700;
  border: none;
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}
.sf-price-btn:hover {
  background: #ffe14a;
  transform: translateY(-1px);
}
.sf-price-btn::after {
  content: " ✎";
  font-size: 0.8em;
  color: #444;
  opacity: 0.7;
}

/* =========================================================
   QUOTE BUILDER — TOTALS TABLE (FULL WIDTH)
   ========================================================= */
.qb-totals-table {
  width: 100%;
  margin-top: 1rem;
  border-collapse: collapse;
  background: #fff8ed; /* matching brass panel background */
  border: 2px solid #d4a76a;
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    inset 0 0 6px rgba(212,167,106,0.6),
    0 2px 4px rgba(0,0,0,0.08),
    0 0 10px rgba(212,167,106,0.3);
}

/* Cells */
.qb-totals-table td {
  padding: 0.65rem 1rem;
  font-family: "Zilla Slab", serif;
  font-size: 1rem;
  border-bottom: 1px solid #e6d3b7;
}

.qb-label-td {
  text-align: right;
  font-weight: 600;
  color: #6b4a1c;
  width: 45%;
}

.qb-value-td {
  text-align: left;
  font-weight: 700;
  width: 55%;
  color: #333;
}

/* Shipping input */
.qb-shipping-input {
  width: 120px;
  text-align: right;
  padding-right: .5rem;
}

/* Divider Row */
.qb-divider-row td {
  padding: 0;
  border: none;
}

.qb-divider {
  border: none;
  border-top: 1px solid #d4a76a;
  margin: 0;
}

/* TOTAL row */
.qb-total-row td {
  border-bottom: none;
}

.qb-total-label {
  font-size: 1.2rem;
  font-weight: 700;
}

.qb-total-value {
  font-size: 1.3rem;
  color: #000;
}





/* =========================================================
   QUOTE BUILDER — TOTALS BOX (Brass Panel Styling)
   ========================================================= */
.qb-totals-box {
  margin-top: 1.25rem;
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  background: #fff8ed;
  border: 2px solid #d4a76a;
  box-shadow:
    inset 0 0 6px rgba(212,167,106,0.6),
    0 2px 4px rgba(0,0,0,0.08),
    0 0 10px rgba(212,167,106,0.3);
  max-width: 420px;
}

.qb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: .35rem 0;
  font-family: "Zilla Slab", serif;
}

.qb-label {
  font-weight: 600;
  color: #6b4a1c;
}

.qb-value {
  font-weight: 700;
  color: #333;
}

.qb-input {
  width: 120px;
  text-align: right;
}

.qb-total-row .qb-value {
  font-size: 1.25rem;
  color: #000;
}

.qb-divider {
  border: none;
  border-top: 1px solid #d4a76a;
  margin: 0.75rem 0;
}



/* ==========================================================
   🎯 Quote Builder — Hide tab scrollbars but keep scroll active
========================================================== */

.sf-quote-builder {
    height: 80%;
}
/* 3-column grid */
.container {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 1rem;
  padding: 1rem;
  align-items: start;
  min-height: 80%;
}
.sf-tab-content:has(.sf-quote-builder) {
  overflow-y: auto !important;      /* keep functional scroll */
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* Edge/IE */
}

.sf-tab-content:has(.sf-quote-builder)::-webkit-scrollbar {
  display: none !important;         /* Chrome, Safari, Opera */
}



.sf-main {
  overflow: hidden !important;
  padding-bottom:  3rem;                   /* avoid clipping bottom shadows */
  box-sizing: border-box;
}



/* =======================================================
   ✨ MISC EFFECTS & TOASTS
======================================================= */
.flash { animation: flash .8s ease; }
@keyframes flash {
  0% { background: #fff3cd; }
  100% { background: transparent; }
}

tr.added { background: #fff7cc; }
tr.disabled { background: #f5f5f5; color: #aaa; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 15px;
  border-radius: 4px;
  color: #fff;
  z-index: 9999;
  font-weight: 600;
}
.toast.info { background: #333; }
.toast.success { background: #3c3; }
.toast.error { background: #c33; }

