/**
 * Frontend Styles — WooCommerce Quick Quotes (Divi Enhanced)
 * Scope: WCQQ containers only to avoid clashing with Divi/theme styles.
 * Notes:
 * - Uses CSS variables for easy theming.
 * - Avoids color-mix(); provides :has() with class fallback for older browsers.
 */

/* ============================
   Variables (scoped)
   ============================ */
.wcqq-quote-module-inner,
.wcqq-quote-cart-module,
.wcqq-customer-details-module,
div.product .wcqq-child-products-container {
  --wcqq-radius: 12px;
  --wcqq-border: 1px;
  --wcqq-pad: 22px;
  --wcqq-gap: 16px;
  --wcqq-bg: #fff;
  --wcqq-border-color: rgba(0,0,0,.08);
  --wcqq-shadow: 0 6px 18px rgba(0,0,0,.06);
  --wcqq-text: #1d1d1f;
  --wcqq-muted: #6b7280;
  --wcqq-primary: #1a73e8;         /* ← brand colour */
  --wcqq-primary-ink: #fff;
  --wcqq-outline: var(--wcqq-primary);
}

/* ============================
   Child Product Groups
   ============================ */
div.product .wcqq-child-products-container {
  border-top: 1px solid #eee;
  margin-top: 2em;
  padding-top: 2em;
  background: #fff;
  border-radius: var(--et_pb_button_border_radius, 8px);
}

div.product .wcqq-child-products-container h3 {
  margin: 0 0 1.1em;
  font-size: clamp(20px, 2.2vw, 22px);
}

/* Grid list */
div.product .wcqq-child-products-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 14px !important;
}
@media (max-width: 768px) {
  div.product .wcqq-child-products-list { grid-template-columns: 1fr !important; }
}

div.product .wcqq-child-products-list li {
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  width: 100% !important;
}

div.product .wcqq-child-products-list label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  padding: 12px 14px;
  border: 1px solid #e8e8e8;
  border-radius: var(--et_pb_button_border_radius, 8px);
  width: 100%;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
  background: #fff;
  gap: 12px;
}

div.product .wcqq-child-products-list label:hover {
  background-color: #f9fbff;
  border-color: #dbe7ff;
  box-shadow: 0 4px 14px rgba(26,115,232,.06);
}

div.product .wcqq-child-products-list input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}

/* Price at right edge inside label, if present */
div.product .wcqq-child-products-list label strong {
  margin-left: auto;
  padding-left: 12px;
  text-align: right;
  white-space: nowrap;
}

/* Checked/focus states
   - Modern: :has()
   - Fallback: add .is-checked (optional via JS)
*/
div.product .wcqq-child-products-list label.is-checked,
div.product .wcqq-child-products-list label:has(input[type="checkbox"]:checked) {
  border-color: var(--wcqq-primary);
  box-shadow: 0 0 0 2px rgba(26,115,232,.18);
}
div.product .wcqq-child-products-list input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--wcqq-primary);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  div.product .wcqq-child-products-list label { transition: none; }
}

/* ============================
   Quote Cart Module (container)
   ============================ */
.wcqq-quote-cart-module {
  border: var(--wcqq-border) solid var(--wcqq-border-color);
  border-radius: var(--et_pb_button_border_radius, var(--wcqq-radius));
  background: var(--wcqq-bg);
  padding: 16px;
  box-shadow: var(--wcqq-shadow);
}
.wcqq-quote-cart-module h3 {
  margin: 0 0 12px;
  font-size: clamp(18px, 2vw, 20px);
}

/* Content area + loading shimmer */
.wcqq-quote-cart-module .wcqq-quote-module-content {
  position: relative;
  min-height: 40px;
}
.wcqq-quote-cart-module .wcqq-quote-module-content.is-loading {
  opacity: .65;
}
.wcqq-quote-cart-module .wcqq-quote-module-content.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--et_pb_button_border_radius, 8px);
  background:
    linear-gradient(110deg, rgba(26,115,232,0) 0%, rgba(26,115,232,.08) 18%, rgba(26,115,232,0) 33%) 0 0 / 200% 100%,
    rgba(255,255,255,.6);
  animation: wcqq-shimmer 1.2s linear infinite;
}
@keyframes wcqq-shimmer {
  0%   { background-position: 200% 0, 0 0; }
  100% { background-position: -200% 0, 0 0; }
}

/* ============================
   Quote Module Inner layout
   ============================ */
.wcqq-quote-module-inner{
  background: var(--wcqq-bg);
  color: var(--wcqq-text);
  border: var(--wcqq-border) solid var(--wcqq-border-color);
  border-radius: var(--et_pb_button_border_radius, var(--wcqq-radius));
  box-shadow: var(--wcqq-shadow);
  padding: var(--wcqq-pad);
}

/* Items list (matches template classes) */
.wcqq-quote-items{
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}
.wcqq-quote-item{
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px 14px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(0,0,0,.06);
}
.wcqq-quote-item:last-child{ border-bottom: 0; }

.wcqq-item-name{ font-weight: 600; min-width: 0; }

/* NEW: Quantity and Remove controls */
.wcqq-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.wcqq-item-qty {
    width: 60px;
    text-align: center;
    border: 1px solid var(--wcqq-border-color);
    border-radius: 6px;
    padding: 4px;
}
.wcqq-remove-item {
    background: transparent;
    border: 0;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    opacity: .5;
    padding: 0 4px;
}
.wcqq-remove-item:hover { opacity: 1; color: #d9534f; }


.wcqq-item-subtotal{
  color: var(--wcqq-text);
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
}

/* Totals row (matches template .wcqq-quote-total-row) */
.wcqq-quote-total-row{
  display:flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 8px;
  margin: 6px 0 18px;
  border-top: 1px solid rgba(0,0,0,.06);
}
.wcqq-total-label{ color: var(--wcqq-muted); font-weight: 600; }
.wcqq-total-amount{ font-weight: 800; }

/* ============================
   Actions & Buttons
   ============================ */
.wcqq-quote-actions{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

/* Base button look (scoped) */
.wcqq-quote-actions .button,
.wcqq-email-wrap .button,
.wcqq-quote-empty .button {
  width: 100%;
  text-align: center;
  padding: 14px 16px;
  border-radius: 8px;
  font-weight: 700;
  letter-spacing: .2px;
  border: 2px solid var(--wcqq-outline);
  background: transparent;
  color: var(--wcqq-outline);
  transition: transform .06s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}
.wcqq-quote-actions .button:hover{
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(26,115,232,.18);
}

/* Primary action */
.wcqq-quote-actions .wcqq-submit-quote{
  background: var(--wcqq-primary);
  color: var(--wcqq-primary-ink);
  border-color: var(--wcqq-primary);
}
.wcqq-quote-actions .wcqq-submit-quote:hover{
  box-shadow: 0 10px 18px rgba(26,115,232,.25);
}

/* Secondary / Tertiary */
.wcqq-quote-actions .wcqq-generate-pdf{ }
.wcqq-quote-actions .wcqq-clear-quote{
  border-color: rgba(0,0,0,.25);
  color: #2f2f2f;
}
.wcqq-quote-actions .wcqq-clear-quote:hover{
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
}

/* ============================
   Email Row
   ============================ */
.wcqq-email-wrap{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.wcqq-email-wrap input[type="email"]{
  border: 1px solid var(--wcqq-border-color);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px;
}
.wcqq-email-wrap .button.wcqq-email-quote{
  padding: 12px 18px;
  border-radius: 8px;
  background: #eef5ff;
  border-color: #b7d2ff;
  color: #1a57d6;
}
.wcqq-email-wrap .button.wcqq-email-quote:hover{ background: #e3eeff; }

/* ============================
   Empty state & feedback
   ============================ */
.wcqq-quote-empty { text-align: center; }
.wcqq-quote-empty .button { margin-top: 8px; }

.wcqq-quote-feedback{
  display:none;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
  margin-top: 8px;
}
.wcqq-quote-feedback.is-success { display:block; background:#e7f7ec; color:#0a6b2b; border:1px solid #bfe8ca; }
.wcqq-quote-feedback.is-error   { display:block; background:#fde8e7; color:#9a1f1f; border:1px solid #f5b7b1; }

/* ============================
   Re-add camper subtle text link
   ============================ */
.wcqq-readd-link { font-size: .95em; color: #555; }
.wcqq-readd-link a { color: var(--wcqq-outline); text-decoration: underline; }
.wcqq-readd-link a:hover { color: #0d47a1; }

/* ============================
   Notes Module
   ============================ */
.wcqq-notes-module h3 { margin-bottom: 0.5em; }
.wcqq-notes-module .wcqq-notes-field,
.wcqq-notes-module .et_pb_text_inner textarea {
  border: 1px solid rgba(0,0,0,.12);
  border-radius: var(--et_pb_button_border_radius, 8px);
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.4;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}

.wcqq-notes-module .wcqq-notes-field:focus {
  border-color: var(--wcqq-primary);
  box-shadow: 0 0 0 2px rgba(26,115,232,.2);
  outline: none;
}

/* ============================
   CUSTOMER DETAILS — unified, Divi-styled
   ============================ */
.wcqq-customer-details-module {
  border: var(--wcqq-border) solid var(--wcqq-border-color);
  border-radius: var(--et_pb_button_border_radius, var(--wcqq-radius));
  background: var(--wcqq-bg);
  padding: var(--wcqq-pad);
  box-shadow: var(--wcqq-shadow);
}
.wcqq-customer-details-module h3 {
  margin: 0 0 1.1em;
  font-size: clamp(20px, 2.2vw, 22px);
}

/* Preferred (new) markup */
.wcqq-grid { display: grid; grid-template-columns: 1fr; gap: 10px 12px; }
@media (min-width: 980px) { .wcqq-grid.two-col { grid-template-columns: 1fr 1fr; } }

.wcqq-form-row { display: flex; flex-direction: column; gap: 6px; }
.wcqq-form-row label { font-size: 12px; letter-spacing: .02em; opacity: .9; }
.wcqq-form-row input[type="text"],
.wcqq-form-row input[type="email"],
.wcqq-form-row input[type="tel"],
.wcqq-form-row input[type="search"],
.wcqq-form-row select {
  width: 100%;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.wcqq-form-row input:focus,
.wcqq-form-row select:focus {
  outline: none;
  border-color: var(--wcqq-primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}

.wcqq-customer-details-form .wcqq-fieldset {
  border: 1px dashed var(--wcqq-border-color);
  border-radius: 12px;
  padding: 12px;
  margin: 0 0 14px 0;
}
.wcqq-customer-details-form .wcqq-legend,
.wcqq-customer-details-form fieldset legend {
  font-weight: 600;
  font-size: 14px;
  padding: 0 6px;
  opacity: .85;
}

/* ============================
   Custom Additions UI (cards + list)
   ============================ */
.wcqq-custom-additions { position: relative; margin-top: 1.5rem; }
.wcqq-custom-additions .wcqq-custom-header { margin-bottom: .5rem; }
.wcqq-custom-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: .75rem; }
.wcqq-custom-card {
  border: 1px solid var(--wcqq-border, #e5e7eb);
  border-radius: var(--wcqq-radius, 12px);
  padding: .75rem;
  background: #fff;
  display: flex; flex-direction: column; gap: .5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.wcqq-card-fields { display: grid; grid-template-columns: 1fr 140px 84px; gap: .5rem; align-items: center; }
.wcqq-input { width: 100%; border: 1px solid #d1d5db; border-radius: 8px; padding: .5rem .6rem; }
.wcqq-card-actions { display:flex; gap:.5rem; align-items:center; justify-content: flex-start; }
.wcqq-btn { border-radius: 999px; }
.wcqq-icon-btn { background: transparent; border: 0; font-size: 20px; line-height: 1; cursor: pointer; opacity: .7; }
.wcqq-icon-btn:hover { opacity: 1; }
.wcqq-fab {
  position: sticky; bottom: 12px; left: calc(100% - 56px);
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--wcqq-primary, #111827); color:#fff; font-size: 24px; cursor: pointer;
  display:flex; align-items:center; justify-content:center; box-shadow: 0 6px 16px rgba(0,0,0,.2);
}

.wcqq-section-title { margin:1rem 0 .5rem; font-size:1.1rem; }
.wcqq-custom-list .wcqq-line { display:flex; gap:.5rem; justify-content:space-between; padding:.25rem 0; border-bottom:1px dashed #eee; }
.wcqq-custom-list .wcqq-line:last-child { border-bottom:0; }
.wcqq-line-qty { opacity:.7; margin:0 .35rem; }

/* ============================
   Toggle second contact
   ============================ */
.wcqq-toggle-second { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; }
.wcqq-second-contact[hidden] { display: none !important; }

/* Keep spacing between modules */
.wcqq-customer-details-module + .wcqq-quote-cart-module,
.wcqq-quote-cart-module + .wcqq-customer-details-module { margin-top: 14px; }

/* Back-compat for older markup using Woo classes */
.wcqq-customer-details-form .form-row { margin-bottom: 1em; }
.wcqq-customer-details-form .form-row label { display:block; margin-bottom: .5em; font-weight: 500; }
.wcqq-customer-details-form .form-row .required { color: red; font-weight: 700; }
.wcqq-customer-details-form .input-text {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd;
  border-radius: var(--et_pb_button_border_radius, 6px); transition: border-color .2s ease;
}
.wcqq-customer-details-form .input-text:focus {
  border-color: var(--wcqq-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(26,115,232,.2);
}
@media (min-width: 768px) {
  .wcqq-customer-details-form .form-row-first { grid-column: 1; }
  .wcqq-customer-details-form .form-row-last  { grid-column: 2; }
  .wcqq-customer-details-form .form-row-wide  { grid-column: 1 / -1; }
}

/* ============================
   Acceptance Modal (NEW)
   ============================ */
.wcqq-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.wcqq-modal-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.wcqq-modal-content {
  position: relative;
  background: #fff;
  border-radius: var(--wcqq-radius, 12px);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 10px 25px rgba(0,0,0,.1);
  transform: translateY(20px);
  transition: transform .2s ease;
}
.wcqq-modal-overlay.is-visible .wcqq-modal-content {
    transform: translateY(0);
}

.wcqq-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: 0;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.7;
}
.wcqq-modal-close:hover { opacity: 1; }

.wcqq-modal-content h3 { margin-top: 0; }
.wcqq-acceptance-terms { display: flex; align-items: flex-start; gap: 8px; font-size: 0.9em; cursor: pointer; }
.wcqq-modal-content .wcqq-form-row { margin-bottom: 1rem; }
.wcqq-modal-content #wcqq-finalize-acceptance-btn { width: 100%; margin-top: 1rem; }
.wcqq-modal-feedback { font-size: 0.9em; color: #d9534f; margin-top: 0.5rem; min-height: 1.2em; }