/* ==========================================================================
   eeiei quick add dialog
   Large two-column dialog that mirrors the product page: gallery on the left,
   title / price / options / quantity on the right.
   ========================================================================== */

.qa-modal .modal-content {
  position: relative;
  border: 1px solid var(--ee-line-strong);
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(20, 20, 19, 0.2);
}

.qa-modal .qa-dialog {
  width: calc(100vw - 48px);
  max-width: 1120px;
}

.qa-modal .modal-body {
  padding: 0;
}

.qa-close {
  position: absolute;
  z-index: 5;
  top: 16px;
  right: 16px;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--ee-line);
  opacity: 0.75;
}

.qa-close:hover,
.qa-close:focus-visible {
  opacity: 1;
}

/* ------------------------------------------------------------------ layout */

.qa-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 34px;
  padding: 28px;
}

.qa-media {
  min-width: 0;
}

.qa-main-image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 560px;
  overflow: hidden;
  background: var(--ee-wash);
  border: 1px solid var(--ee-line);
}

.qa-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qa-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.qa-gallery-thumb {
  display: block;
  width: 70px;
  height: 70px;
  padding: 2px;
  border: 1px solid var(--ee-line);
  background: #ffffff;
  line-height: 0;
}

.qa-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qa-gallery-thumb:hover,
.qa-gallery-thumb.is-active {
  border-color: var(--ee-ink);
  text-decoration: none;
}

.qa-info {
  min-width: 0;
  padding: 8px 4px 0 0;
}

/* ------------------------------------------------------------------ heading */

.qa-modal .qa-title {
  display: -webkit-box;
  margin: 0 40px 0 0;
  overflow: hidden;
  font-family: var(--ee-display);
  font-size: clamp(1.05rem, 1.45vw, 1.25rem);
  font-weight: 500;
  line-height: 1.25;
  color: var(--ee-ink);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.qa-head-price {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 12px 0 20px;
}

.qa-price-now {
  font-family: var(--ee-body);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ee-ink);
  font-variant-numeric: tabular-nums;
}

.qa-price-was {
  color: var(--ee-muted);
  font-size: 0.95rem;
  text-decoration: line-through;
}

.qa-price-was[hidden] {
  display: none;
}

/* ------------------------------------------------------------------ options */

.qa-options {
  margin-top: 4px;
}

.qa-option {
  margin-bottom: 18px;
}

.qa-option:last-child {
  margin-bottom: 4px;
}

.qa-label {
  display: block;
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ee-ink);
}

.qa-req {
  color: var(--ee-accent);
}

.qa-control {
  min-height: 44px;
}

.qa-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.qa-choice {
  margin: 0;
}

.qa-choice .form-check-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.qa-choice .form-check-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--ee-line-strong);
  background: #ffffff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.qa-choice .form-check-label:hover {
  border-color: var(--ee-ink-soft);
}

.qa-choice .form-check-input:checked + .form-check-label {
  border-color: var(--ee-ink);
  background: var(--ee-wash);
  box-shadow: inset 0 0 0 1px var(--ee-ink);
}

.qa-choice .form-check-input:focus-visible + .form-check-label {
  outline: 2px solid var(--ee-accent);
  outline-offset: 2px;
}

.qa-option-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 1px solid var(--ee-line);
  background: var(--ee-wash);
}

.qa-choice-name {
  line-height: 1.3;
}

.qa-choice-price {
  color: var(--ee-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.qa-upload {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qa-option.has-error .qa-control,
.qa-option.has-error .qa-choices .form-check-label {
  border-color: #b23a2a;
}

.qa-error {
  min-height: 0;
  margin-top: 5px;
  font-size: 0.8rem;
  color: #b23a2a;
}

.qa-error:empty {
  display: none;
}

.qa-alert {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-left: 3px solid #b23a2a;
  background: #fdf3f1;
  color: #8f2c1d;
  font-size: 0.86rem;
}

.qa-hint {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: var(--ee-muted);
}

.qa-notice {
  padding: 8px 0 24px;
}

.qa-notice p {
  margin-bottom: 16px;
}

/* ------------------------------------------------------------------ variant rows */

.qa-variant {
  margin-top: 4px;
}

.qa-variant-first {
  margin-bottom: 16px;
}

.qa-variant-list {
  margin-top: 10px;
  border-top: 1px solid var(--ee-line);
}

.qa-variant-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ee-line);
}

.qa-variant-thumb {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border: 1px solid var(--ee-line);
  background: var(--ee-wash);
}

.qa-variant-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qa-variant-name {
  flex: 1 1 120px;
  min-width: 0;
  font-size: 0.92rem;
  line-height: 1.3;
}

.qa-variant-unit {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ee-ink);
}

.qa-variant-qty {
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
  height: 36px;
  border: 1px solid var(--ee-line-strong);
}

.qa-variant-qty input {
  width: 42px;
  border: 0;
  border-inline: 1px solid var(--ee-line);
  text-align: center;
  font-size: 0.85rem;
  -moz-appearance: textfield;
}

.qa-variant-qty input::-webkit-outer-spin-button,
.qa-variant-qty input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.qa-variant-step {
  width: 30px;
  border: 0;
  background: transparent;
  color: var(--ee-ink);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.qa-variant-step:hover {
  background: var(--ee-wash);
}

.qa-variant-row.is-unavailable {
  opacity: 0.45;
}

.qa-variant-count {
  color: var(--ee-muted);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.qa-variant .qa-submit {
  width: 100%;
  margin-top: 14px;
}

.qa-variant .qa-total-line {
  margin-top: 16px;
}

.qa-total-review {
  width: 100%;
  padding: 14px 0 0;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--ee-line);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.qa-total-review .qa-total-value::after {
  content: "\203A";
  margin-left: 8px;
  color: var(--ee-muted);
  font-size: 1.1rem;
  font-weight: 400;
  vertical-align: 1px;
}

.qa-total-review:hover .qa-total-value {
  color: var(--ee-accent);
}

.qa-total-review:focus-visible,
.qa-summary-close:focus-visible {
  outline: 2px solid var(--ee-accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ selection summary */

.qa-summary-layer {
  position: fixed;
  z-index: 1085;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.qa-summary-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 19, 0.45);
}

.qa-summary-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: min(84vh, 760px);
  background: #ffffff;
  border: 1px solid var(--ee-line-strong);
  box-shadow: 0 30px 80px rgba(20, 20, 19, 0.24);
}

.qa-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 0;
}

.qa-summary-title {
  margin: 0;
  font-family: var(--ee-body);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ee-ink);
}

.qa-summary-note {
  margin: 6px 22px 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ee-muted);
}

.qa-summary-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--ee-line);
  background: #ffffff;
  color: var(--ee-ink);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.qa-summary-list {
  margin-top: 16px;
  padding: 0 22px;
  overflow-y: auto;
  border-top: 1px solid var(--ee-line);
}

.qa-summary-head-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 76px 104px 84px;
  align-items: center;
  gap: 0 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--ee-line);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ee-muted);
}

.qa-summary-head-row .qa-summary-col-price,
.qa-summary-head-row .qa-summary-col-total {
  text-align: right;
}

.qa-summary-head-row .qa-summary-col-qty {
  text-align: center;
}

.qa-summary-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 76px 104px 84px;
  align-items: center;
  gap: 0 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ee-line);
}

.qa-summary-thumb {
  display: block;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border: 1px solid var(--ee-line);
  background: var(--ee-wash);
}

.qa-summary-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qa-summary-info {
  min-width: 0;
}

.qa-summary-row-name {
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--ee-ink);
}

.qa-summary-unit {
  justify-self: end;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ee-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.qa-summary-row-total {
  justify-self: end;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ee-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.qa-summary-qty {
  display: inline-flex;
  align-items: stretch;
  justify-self: center;
  height: 34px;
  border: 1px solid var(--ee-line-strong);
}

.qa-summary-qty input {
  width: 40px;
  border: 0;
  border-inline: 1px solid var(--ee-line);
  text-align: center;
  font-size: 0.84rem;
  -moz-appearance: textfield;
}

.qa-summary-qty input::-webkit-outer-spin-button,
.qa-summary-qty input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.qa-summary-step {
  width: 30px;
  border: 0;
  background: transparent;
  color: var(--ee-ink);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}

.qa-summary-step:hover:not(:disabled) {
  background: var(--ee-wash);
}

.qa-summary-step:disabled,
.qa-summary-qty input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.qa-summary-row.is-zero .qa-summary-row-total {
  color: var(--ee-muted);
  font-weight: 400;
}

.qa-summary-row.is-unavailable {
  opacity: 0.45;
}

.qa-summary-foot {
  padding: 16px 22px 22px;
}

.qa-summary-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--ee-line-strong);
}

.qa-summary-total-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ee-muted);
}

.qa-summary-total-value {
  font-family: var(--ee-body);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ee-ink);
  font-variant-numeric: tabular-nums;
}

.qa-summary-add {
  width: 100%;
  margin-top: 16px;
}

/* ------------------------------------------------------------------ buy row */

.qa-buy {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--ee-line);
}

.qa-buy-qty > .qa-label {
  margin-bottom: 5px;
}

.qa-qty-box {
  display: inline-flex;
  align-items: stretch;
  height: 48px;
  border: 1px solid var(--ee-line-strong);
}

.qa-qty-box input {
  width: 58px;
  border: 0;
  border-inline: 1px solid var(--ee-line);
  text-align: center;
  font-size: 0.95rem;
  -moz-appearance: textfield;
}

.qa-qty-box input::-webkit-outer-spin-button,
.qa-qty-box input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.qa-step {
  width: 36px;
  border: 0;
  background: transparent;
  color: var(--ee-ink);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.qa-step:hover {
  background: var(--ee-wash);
}

.qa-submit {
  flex: 1 1 auto;
  min-height: 48px;
  white-space: nowrap;
}

.qa-total-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--ee-line);
}

.qa-total-label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ee-muted);
}

.qa-total-value {
  font-family: var(--ee-body);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ee-ink);
  font-variant-numeric: tabular-nums;
}

.qa-detail-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--ee-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.qa-detail-link:hover {
  color: var(--ee-ink);
}

/* ------------------------------------------------------------------ toast */

.qa-loading {
  opacity: 0.6;
  cursor: wait;
}

.qa-toast {
  position: fixed;
  z-index: 1090;
  left: 50%;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.qa-toast-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--ee-ink);
  color: #ffffff;
  font-size: 0.86rem;
  line-height: 1.5;
  box-shadow: 0 18px 40px rgba(20, 20, 19, 0.24);
  pointer-events: auto;
}

.qa-toast-item.is-error {
  background: #8f2c1d;
}

.qa-toast-item .fa-solid {
  margin-top: 2px;
}

.qa-toast-text {
  flex: 1;
}

.qa-toast-text a {
  color: #ffffff;
  text-decoration: underline;
}

.qa-toast-close {
  border: 0;
  background: transparent;
  color: #ffffff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}

.qa-toast-close:hover {
  opacity: 1;
}

/* ------------------------------------------------------------------ responsive */

@media (min-width: 992px) {
  .qa-modal .modal-body {
    overflow: hidden;
  }

  .qa-layout {
    align-items: start;
    max-height: calc(100vh - 2 * var(--bs-modal-margin) - 2px);
  }

  .qa-main-image {
    max-height: min(560px, calc(100vh - 300px));
  }

  .qa-media {
    position: sticky;
    top: 0;
    align-self: start;
    padding-top: 10px;
  }

  .qa-info {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2 * var(--bs-modal-margin) - 58px);
    min-height: 0;
    padding-right: 10px;
    overflow: hidden;
  }

  .qa-info > .qa-title,
  .qa-info > .qa-head-price,
  .qa-info > .qa-notice {
    flex: 0 0 auto;
  }

  #qa-variant,
  #qa-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
  }

  .qa-variant-first,
  .qa-buy,
  .qa-total-line,
  .qa-detail-link,
  .qa-alert,
  .qa-hint,
  #qa-variant > .qa-submit {
    flex: 0 0 auto;
  }

  .qa-variant-list,
  .qa-options {
    flex: 1 1 auto;
    min-height: 0;
    padding-right: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--ee-line-strong) var(--ee-wash);
    scrollbar-gutter: stable;
  }

  .qa-variant-list::-webkit-scrollbar,
  .qa-options::-webkit-scrollbar {
    width: 8px;
  }

  .qa-variant-list::-webkit-scrollbar-track,
  .qa-options::-webkit-scrollbar-track {
    background: var(--ee-wash);
  }

  .qa-variant-list::-webkit-scrollbar-thumb,
  .qa-options::-webkit-scrollbar-thumb {
    background: var(--ee-line-strong);
  }

  .qa-variant-list::-webkit-scrollbar-thumb:hover,
  .qa-options::-webkit-scrollbar-thumb:hover {
    background: var(--ee-muted);
  }
}

@media (max-width: 991.98px) {
  .qa-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    padding: 22px;
  }

  .qa-main-image {
    max-height: 440px;
  }

  .qa-info {
    padding: 0;
  }

  .qa-modal .qa-title {
    margin-right: 36px;
  }
}

@media (max-width: 575.98px) {
  .qa-modal .qa-dialog {
    width: 100%;
    max-width: none;
    margin: 0;
    min-height: 100%;
  }

  .qa-modal .modal-content {
    min-height: 100vh;
    border: 0;
    box-shadow: none;
  }

  .qa-layout {
    gap: 18px;
    padding: 18px;
  }

  .qa-main-image {
    max-height: 340px;
  }

  .qa-close {
    top: 10px;
    right: 10px;
  }

  .qa-buy {
    flex-wrap: wrap;
    gap: 12px;
  }

  .qa-buy-qty {
    width: 100%;
  }

  .qa-qty-box {
    width: 100%;
  }

  .qa-qty-box input {
    flex: 1 1 auto;
    width: auto;
  }

  .qa-submit {
    width: 100%;
    flex-basis: 100%;
  }

  .qa-gallery-thumb {
    width: 58px;
    height: 58px;
  }

  .qa-summary-layer {
    align-items: flex-end;
    padding: 0;
  }

  .qa-summary-card {
    width: 100%;
    max-height: 88vh;
    border: 0;
  }

  .qa-summary-head-row {
    display: none;
  }

  .qa-summary-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    grid-template-areas:
      "thumb info total"
      "thumb unit qty";
    gap: 3px 12px;
  }

  .qa-summary-thumb {
    grid-area: thumb;
  }

  .qa-summary-info {
    grid-area: info;
    align-self: end;
  }

  .qa-summary-unit {
    grid-area: unit;
    justify-self: start;
    align-self: center;
    font-size: 0.78rem;
  }

  .qa-summary-row-total {
    grid-area: total;
    align-self: end;
  }

  .qa-summary-qty {
    grid-area: qty;
    justify-self: end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .qa-choice .form-check-label {
    transition: none;
  }
}
