/* ==========================================================================
   Editorial Cart & Buying Window
   ========================================================================== */

body.cart-body {
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
}

.cart-viewport {
  max-width: 1200px;
  margin: 0 auto;
  padding: 120px 24px 80px;
}

.cart-page-header {
  margin-bottom: 40px;
}

.cart-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-main);
  line-height: 1;
}

/* Two-Column Grid: min-width: 0 prevents flex children from blowing out grid tracks */
.cart-content-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 40px;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
}

.cart-item-showcase,
.cart-summary-column {
  min-width: 0;
  width: 100%;
}

/* Stacked List for up to 4 Artworks (Capped at 2 visible, then scrolls internally) */
.cart-items-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 380px; /* Fits exactly two stacked cards comfortably */
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-coral) transparent;
}

.cart-items-list::-webkit-scrollbar {
  width: 5px;
}

.cart-items-list::-webkit-scrollbar-track {
  background: transparent;
}

.cart-items-list::-webkit-scrollbar-thumb {
  background: rgba(242, 65, 93, 0.35);
  border-radius: 999px;
}

.cart-items-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent-coral);
}

.cart-artwork-card {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(1, 35, 80, 0.04);
}

.cart-limit-notice {
  margin-top: 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-coral);
  background: rgba(242, 65, 93, 0.1);
  border: 1px solid rgba(242, 65, 93, 0.25);
  padding: 10px 14px;
  border-radius: 10px;
  text-align: center;
}

[data-theme="dark"] .cart-artwork-card {
  background: #041938;
  border-color: #12376d;
}

.cart-thumb-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: #111;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  position: relative;
}

.cart-thumb-box:hover .cart-thumb-img {
  transform: scale(1.04);
}

.cart-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-item-details {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.item-artist-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-coral);
  margin-bottom: 4px;
}

.item-artwork-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 6px;
}

.item-specs-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.btn-remove-item {
  background: transparent;
  border: none;
  color: var(--accent-coral);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  width: fit-content;
}

/* Bespoke Cream Valuation Card */
.catalogue-valuation-card {
  background: #fdfad9;
  border: 1px solid #e4e0ba;
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 16px 36px rgba(1, 35, 80, 0.08);
}

[data-theme="dark"] .catalogue-valuation-card {
  background: #fdfad9; /* Inverted: interior remains light cream in dark mode */
  border-color: #e4e0ba;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
}

.valuation-top-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.valuation-heading {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #012350;
}

.valuation-total-price {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  color: #012350;
}

.valuation-divider {
  width: 100%;
  height: 1px;
  background: #e4e0ba;
  margin-bottom: 16px;
}

.split-line-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: #3a4b63;
  margin-bottom: 10px;
}

.split-value {
  font-weight: 700;
  color: #012350;
}

.btn-buy-art {
  width: 100%;
  background: #012350;
  color: #fdfad9;
  border: none;
  border-radius: 999px;
  padding: 16px 24px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 18px;
  box-shadow: 0 8px 24px rgba(1, 35, 80, 0.25);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.btn-buy-art:hover {
  background: var(--accent-coral);
  color: #FFFFFF;
  transform: translateY(-2px);
}

.cart-trust-note {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-top: 16px;
  text-align: center;
  padding: 0 12px;
}

/* Empty State */
.cart-empty-view {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 60px 24px;
  text-align: center;
  max-width: 580px;
  margin: 0 auto;
}

.empty-lead {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.btn-return-gallery {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-coral);
  color: #fff;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none !important;
}

/* Live Countdown Hold Pill */
.cart-hold-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(2, 155, 189, 0.12);
  border: 1px solid rgba(2, 155, 189, 0.35);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 16px;
}

.hold-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

.hold-countdown {
  font-family: monospace;
  font-size: 0.88rem;
  font-weight: 800;
  color: #012350;
}

[data-theme="dark"] .hold-countdown {
  color: #fdfad9;
}

/* ==========================================================================
   Streamlined Buying Window & Checkout Modal
   ========================================================================== */
.buying-window-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(1, 15, 35, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.buying-window-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.buying-sheet-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  max-width: 460px;
  width: 100%;
  padding: 24px;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  transform: translateY(14px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.buying-window-backdrop.is-open .buying-sheet-container {
  transform: translateY(0) scale(1);
}

[data-theme="dark"] .buying-sheet-container {
  background: #041938;
  border-color: #12376d;
}

.buying-sheet-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.buying-sheet-close:hover {
  background: var(--accent-coral);
  border-color: var(--accent-coral);
  color: #fff;
  transform: scale(1.05);
}

/* Header Row: Title & Sleek Timer */
.buying-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-right: 28px; /* Clearance for close button */
}

.buying-sheet-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: var(--text-main);
  margin: 0 0 2px;
  line-height: 1.1;
}

.buying-sheet-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.35;
}

/* Sleek In-Header Countdown Pill */
.buying-sheet-header .cart-hold-pill {
  flex-shrink: 0;
  margin: 0;
  padding: 4px 10px;
  font-size: 0.72rem;
  background: rgba(2, 155, 189, 0.1);
  border: 1px solid rgba(2, 155, 189, 0.3);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.buying-sheet-header .cart-hold-pill .hold-label {
  display: none; /* Hide verbose label in header to reduce clutter */
}

.buying-sheet-header .cart-hold-pill .hold-countdown {
  font-size: 0.76rem;
  font-weight: 800;
}

/* Collector Email Form */
.collector-details-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-field-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.form-field-input {
  background: var(--bg-page);
  border: 1.5px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(2, 155, 189, 0.12);
}

/* Stacked Accordion Payment Tiles */
.settlement-options-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settlement-tile {
  background: var(--bg-page);
  border: 1.5px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  user-select: none;
}

.settlement-tile:hover {
  border-color: rgba(2, 155, 189, 0.4);
  transform: translateY(-1px);
}

.settlement-tile.is-active {
  border-color: var(--accent-cyan);
  background: rgba(2, 155, 189, 0.04);
}

[data-theme="dark"] .settlement-tile.is-active {
  background: rgba(2, 155, 189, 0.08);
}

.tile-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Custom Minimalist Radio Indicator */
.tile-radio-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.settlement-tile.is-active .tile-radio-indicator {
  border-color: var(--accent-cyan);
}

.settlement-tile.is-active .tile-radio-indicator::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
}

.tile-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tile-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.tile-caption {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Expandable Action / Detail Bodies */
.tile-collapsible-body {
  display: none;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  cursor: default;
}

.settlement-tile.is-active .tile-collapsible-body {
  display: block;
}

.btn-settle-action {
  width: 100%;
  background: var(--accent-coral);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-settle-action:hover {
  background: #fee451;
  color: #012350;
  transform: translateY(-1px);
}

.btn-settle-action.is-secondary {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-main);
}

.btn-settle-action.is-secondary:hover {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #fff;
}

/* Minimalist Wire Breakdown */
.wire-banking-details {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.74rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wire-data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wire-data-row span {
  color: var(--text-muted);
}

.highlight-code {
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--accent-coral);
  font-weight: 800;
  background: rgba(242, 65, 93, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Mobile Bottom Sheet Adaptation */
@media (max-width: 540px) {
  .buying-window-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .buying-sheet-container {
    max-width: 100%;
    max-height: 85dvh;
    overflow-y: auto;
    border-radius: 24px 24px 0 0;
    padding: 24px 18px 36px;
    border-bottom: none;
    transform: translateY(100%);
  }

  .buying-window-backdrop.is-open .buying-sheet-container {
    transform: translateY(0);
  }
}

/* --- Quick Add Tray: Downsized & Contained --- */
.cart-quick-add-wrap {
  margin-top: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 16px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

[data-theme="dark"] .cart-quick-add-wrap {
  background: #041938;
  border-color: #12376d;
}

.quick-add-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.quick-add-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-coral);
}

.quick-add-status {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.quick-add-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  width: 100%;
  min-width: 0;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-coral) transparent;
}

.quick-add-strip::-webkit-scrollbar {
  height: 4px;
}

.quick-add-strip::-webkit-scrollbar-thumb {
  background: rgba(242, 65, 93, 0.35);
  border-radius: 999px;
}

/* Compact Chip Card */
.quick-add-card {
  flex: 0 0 152px;
  width: 152px;
  max-width: 152px;
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-sizing: border-box;
}

[data-theme="dark"] .quick-add-card {
  background: #01142e;
  border-color: #12376d;
}

.quick-add-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  background: #111;
}

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

.quick-add-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quick-add-title {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  line-height: 1.15;
}

.quick-add-artist {
  font-size: 0.64rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-add-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
}

.quick-add-price {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--accent-cyan);
  white-space: nowrap;
  line-height: 1.2;
}

.btn-quick-add {
  background: var(--accent-coral);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-quick-add:hover {
  background: #fee451;
  color: #012350;
  transform: translateY(-1px);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 860px) {
  .cart-viewport {
    padding: 90px 18px 60px;
  }
  .cart-content-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .cart-items-list {
    max-height: 340px;
  }
}

@media (max-width: 540px) {
  .cart-viewport {
    padding: 80px 14px 48px;
  }
  .cart-page-header {
    margin-bottom: 24px;
  }
  .cart-title {
    font-size: 2.2rem;
  }
  .cart-artwork-card {
    grid-template-columns: 90px 1fr;
    gap: 14px;
    padding: 14px;
  }
  .item-artwork-title {
    font-size: 1.35rem;
  }
  .catalogue-valuation-card {
    padding: 24px 18px;
  }
  .valuation-total-price {
    font-size: 1.8rem;
  }
  /* Bottom sheet modal styling for phones */
  .buying-sheet-container {
    max-height: 90dvh;
    overflow-y: auto;
    padding: 28px 18px;
    border-radius: 20px;
  }
  .buying-sheet-title {
    font-size: 1.7rem;
  }
  .wire-data-row {
    flex-direction: column;
    gap: 2px;
    margin-bottom: 6px;
  }
  .quick-add-card {
    flex: 0 0 160px;
  }
}

/* ==========================================================================
   Artwork-Only Inspection Lightbox Modal
   ========================================================================== */
.artwork-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(1, 15, 35, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.artwork-lightbox-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.artwork-lightbox-frame {
  position: relative;
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.artwork-lightbox-backdrop.is-open .artwork-lightbox-frame {
  transform: scale(1);
}

.artwork-lightbox-img {
  max-width: min(88vw, 1100px);
  max-height: 84vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Circle Glass Exit Button */
.artwork-lightbox-close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  z-index: 10;
  padding: 0;
}

.artwork-lightbox-close:hover {
  background: var(--accent-coral);
  border-color: var(--accent-coral);
  transform: scale(1.08) rotate(90deg);
}

.artwork-lightbox-close svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2.2;
}

@media (max-width: 640px) {
  .artwork-lightbox-close {
    top: -12px;
    right: -12px;
    width: 34px;
    height: 34px;
  }
}