// ============================================================
// GMPQCW – Product Quote Cart  |  Frontend Styles
// Design: clean jewellery-commerce aesthetic
// Palette: deep navy · warm gold · soft pearl · slate
// ============================================================

// ── Token map ───────────────────────────────────────────────
$gmpqcw-navy:       #1a2340;
$gmpqcw-gold:       var(--gm-btn-color,        #c9a84c);
$gmpqcw-gold-hover: var(--gm-hover-btn-color,  #a8883a);
$gmpqcw-pearl:      #f8f6f1;
$gmpqcw-slate:      #6b7280;
$gmpqcw-error-red:  #dc2626;
$gmpqcw-success-green: #16a34a;
$gmpqcw-radius-sm:  6px;
$gmpqcw-radius-md:  10px;
$gmpqcw-radius-lg:  16px;
$gmpqcw-shadow-sm:  0 2px 8px rgba(0,0,0,.08);
$gmpqcw-shadow-md:  0 8px 32px rgba(0,0,0,.15);
$gmpqcw-shadow-lg:  0 20px 60px rgba(0,0,0,.22);
$gmpqcw-transition: .22s cubic-bezier(.4,0,.2,1);

// ── Floating trigger button ──────────────────────────────────
.gmpqcw-floating-cart-button {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: $gmpqcw-gold;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(0,0,0,.28);
  cursor: pointer;
  z-index: 100000002;
  transition: background $gmpqcw-transition, transform $gmpqcw-transition, box-shadow $gmpqcw-transition;
  text-decoration: none;
  border: none;

  svg { width: 26px; height: 26px; fill: #fff; }

  .gmpqcw-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: $gmpqcw-navy;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid #fff;
  }

  &:hover {
    background: $gmpqcw-gold-hover;
    transform: scale(1.07);
    box-shadow: 0 8px 28px rgba(0,0,0,.32);
  }

  &:focus-visible { outline: 3px solid $gmpqcw-gold; outline-offset: 3px; }
}

// ── Overlay ──────────────────────────────────────────────────
.gmpqcw-floating-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,14,28,.55);
  z-index: 100000010;
  animation: gmpqcw-fade-in .22s ease;
  backdrop-filter: blur(2px);
}

// ── Panel ────────────────────────────────────────────────────
.gmpqcw-floating-cart-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  width: calc(100% - 32px);
  max-width: 840px;
  max-height: 88vh;
  background: #fff;
  border-radius: $gmpqcw-radius-lg;
  box-shadow: $gmpqcw-shadow-lg;
  z-index: 100000020;
  transform: translate(-50%, -48%) scale(.94);
  opacity: 0;
  transition: transform $gmpqcw-transition, opacity $gmpqcw-transition;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  &.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  .gmpqcw-floating-cart-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }
}

// ── Panel header ─────────────────────────────────────────────
.gmpqcw-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
  background: $gmpqcw-pearl;

  h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: $gmpqcw-navy;
    letter-spacing: .01em;
  }

  .gmpqcw-item-count {
    font-size: 12px;
    color: $gmpqcw-slate;
    background: #ede8dc;
    border-radius: 20px;
    padding: 2px 10px;
    margin-left: 10px;
    font-weight: 600;
  }
}

// ── Inner two-column layout ───────────────────────────────────
.gmpqcw-floating-cart-panel-inner {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;

  @media (max-width: 640px) {
    flex-direction: column;
    overflow-y: auto;
  }
}

// ── Cart items column ────────────────────────────────────────
.gmpqcw-cart-content {
  flex: 1 1 50%;
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid #f0ede6;

  @media (max-width: 640px) {
    border-right: none;
    border-bottom: 1px solid #f0ede6;
    overflow-y: visible;
  }

  .gmpqcw-empty-cart {
    text-align: center;
    padding: 40px 20px;
    color: $gmpqcw-slate;
    font-size: 14px;

    .gmpqcw-empty-icon {
      font-size: 40px;
      margin-bottom: 12px;
      display: block;
      opacity: .5;
    }
  }
}

// ── Cart card ────────────────────────────────────────────────
.gmpqcw-cart-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  background: $gmpqcw-pearl;
  border-radius: $gmpqcw-radius-md;
  margin-bottom: 10px;
  border: 1px solid #ede8dc;
  transition: box-shadow $gmpqcw-transition;

  &:last-child { margin-bottom: 0; }
  &:hover { box-shadow: $gmpqcw-shadow-sm; }

  img.gmpqcw-cart-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: $gmpqcw-radius-sm;
    background: #fff;
    border: 1px solid #e8e3d8;
    flex-shrink: 0;
  }

  .gmpqcw-cart-info {
    flex: 1;
    min-width: 0;

    h4 {
      margin: 0 0 8px;
      font-size: 13.5px;
      font-weight: 600;
      color: $gmpqcw-navy;
      line-height: 1.35;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .gmpqcw-meta-row {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }
  }

  .gmpqcw-qty-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #d8d2c4;
    border-radius: $gmpqcw-radius-sm;
    padding: 2px 6px;

    .gmpqcw-qty-label {
      font-size: 11px;
      font-weight: 600;
      color: $gmpqcw-slate;
      text-transform: uppercase;
      letter-spacing: .05em;
    }

    .gmpqcw-qty-input {
      width: 44px;
      border: none;
      outline: none;
      font-size: 13px;
      font-weight: 600;
      color: $gmpqcw-navy;
      text-align: center;
      background: transparent;
      padding: 2px 0;
    }
  }

  .gmpqcw-remove-btn {
    background: none;
    border: none;
    padding: 3px 6px;
    cursor: pointer;
    color: $gmpqcw-slate;
    font-size: 11.5px;
    border-radius: $gmpqcw-radius-sm;
    transition: color $gmpqcw-transition, background $gmpqcw-transition;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;

    &::before { content: "✕"; font-size: 10px; }

    &:hover { color: $gmpqcw-error-red; background: #fef2f2; }
    &:disabled { opacity: .5; cursor: not-allowed; }
  }
}

// ── Form column ──────────────────────────────────────────────
.gmpqcw-form {
  flex: 1 1 50%;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;

  @media (max-width: 640px) {
    overflow-y: visible;
  }

  .gmpqcw-form-before-content,
  .gmpqcw-form-after-content {
    font-size: 13px;
    color: $gmpqcw-slate;
    margin-bottom: 12px;
  }
}

// ── Form groups ──────────────────────────────────────────────
.gmpqcw-form-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;

  .gmpqcw-label {
    font-size: 12.5px;
    font-weight: 600;
    color: $gmpqcw-navy;
    margin-bottom: 5px;
    letter-spacing: .02em;

    .gmpqcw-required-star {
      color: $gmpqcw-error-red;
      margin-left: 2px;
    }
  }

  .gmpqcw-input,
  .gmpqcw-textarea,
  .gmpqcw-select {
    padding: 9px 12px;
    border: 1.5px solid #ddd8cc;
    border-radius: $gmpqcw-radius-sm;
    font-size: 13.5px;
    color: $gmpqcw-navy;
    background: $gmpqcw-pearl;
    width: 100%;
    box-sizing: border-box;
    transition: border-color $gmpqcw-transition, box-shadow $gmpqcw-transition;
    -webkit-appearance: none;

    &:focus {
      outline: none;
      border-color: $gmpqcw-gold;
      box-shadow: 0 0 0 3px rgba(201,168,76,.13);
      background: #fff;
    }

    &::placeholder { color: #b0a890; }
  }

  .gmpqcw-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
  }

  .gmpqcw-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
  }

  .gmpqcw-radio-container,
  .gmpqcw-checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13.5px;
    color: $gmpqcw-navy;
    cursor: pointer;

    input {
      accent-color: $gmpqcw-gold;
      width: 15px;
      height: 15px;
      cursor: pointer;
    }
  }
}

// ── Phone field ──────────────────────────────────────────────
.gmpqcw-phone-wrapper {
  display: flex;
  gap: 6px;

  .gmpqcw-phone-country {
    width: 90px;
    flex-shrink: 0;
  }

  .gmpqcw-phone-input { flex: 1; }
}

// ── Submit button ────────────────────────────────────────────
.gmpqcw-submit-btn {
  background: $gmpqcw-gold;
  color: #fff;
  padding: 11px 20px;
  border: none;
  border-radius: $gmpqcw-radius-sm;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: background $gmpqcw-transition, transform $gmpqcw-transition;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  &:hover:not(:disabled) { background: $gmpqcw-gold-hover; transform: translateY(-1px); }
  &:active:not(:disabled) { transform: translateY(0); }
  &:disabled { opacity: .6; cursor: not-allowed; transform: none; }

  .gmpqcw-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gmpqcw-spin .7s linear infinite;
    display: inline-block;
  }
}

// ── Add-to-cart button (shop loop / single) ──────────────────
.gmpqcw_inquirybtn .gmpqcw_inq_addtocart {
  background: $gmpqcw-gold;
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: $gmpqcw-radius-sm;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 8px 0 !important;
  text-decoration: none;
  transition: background $gmpqcw-transition, transform $gmpqcw-transition;
  letter-spacing: .04em;

  &:hover { background: $gmpqcw-gold-hover; color: #fff; transform: translateY(-1px); }
  &:active { transform: translateY(0); }
}

// ── Success / error banners ───────────────────────────────────
.gmpqcw-success,
.gmpqcw-error {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: $gmpqcw-radius-sm;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: gmpqcw-slide-up .25s ease;

  &::before { font-size: 16px; flex-shrink: 0; line-height: 1.2; }
}

.gmpqcw-success {
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  color: $gmpqcw-success-green;
  &::before { content: "✓"; }
}

.gmpqcw-error {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  color: $gmpqcw-error-red;
  &::before { content: "!"; font-weight: 900; }
}

// ── Success full-panel state ─────────────────────────────────
.gmpqcw-success-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  flex: 1;

  .gmpqcw-success-icon {
    width: 56px;
    height: 56px;
    background: #f0fdf4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
    color: $gmpqcw-success-green;
    border: 2px solid #bbf7d0;
  }

  h4 {
    font-size: 18px;
    font-weight: 700;
    color: $gmpqcw-navy;
    margin: 0 0 8px;
  }

  p {
    font-size: 14px;
    color: $gmpqcw-slate;
    margin: 0;
  }
}

// ── Close button ─────────────────────────────────────────────
.gmpqcw-close-button {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 30px;
  height: 30px;
  border: none;
  background: #ede8dc;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: $gmpqcw-navy;
  font-size: 16px;
  line-height: 1;
  transition: background $gmpqcw-transition, color $gmpqcw-transition;
  z-index: 10;

  &::before { content: "✕"; }
  &:hover { background: #e8dfc8; color: $gmpqcw-error-red; }
  &:focus-visible { outline: 3px solid $gmpqcw-gold; }
}

// ── Inline shortcode layout ──────────────────────────────────
.gmpqcw-container {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;

  .gmpqcw-cart { flex: 1 1 340px; }
  .gmpqcw-form { flex: 1 1 320px; }
}

// ── Loading skeleton ─────────────────────────────────────────
.gmpqcw-skeleton {
  background: linear-gradient(90deg, #f0ede6 25%, #e8e4da 50%, #f0ede6 75%);
  background-size: 200% 100%;
  animation: gmpqcw-shimmer 1.4s infinite;
  border-radius: $gmpqcw-radius-sm;
  height: 70px;
  margin-bottom: 10px;
}

// ── Animations ───────────────────────────────────────────────
@keyframes gmpqcw-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes gmpqcw-slide-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes gmpqcw-spin {
  to { transform: rotate(360deg); }
}
@keyframes gmpqcw-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
