/* ===================================================================
   cart-public.css — styles for /pages/cart/
   Phase 3.7 — supplements courses-public.css
   Brand: dark navy + #ff8c00 gold accents (same vars defined upstream)
   =================================================================== */

/* ============= LAYOUT ============= */

.cart-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 32px;
  align-items: start;
  margin: 24px auto 60px;
  padding: 0 24px;
  max-width: 1320px;
}

@media (max-width: 920px) {
  .cart-wrap {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 16px;
  }
}

/* ============= ITEMS COLUMN ============= */

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-items-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--pc-border-soft);
  margin-bottom: 4px;
}

.cart-items-header h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--pc-text);
  margin: 0;
}

.cart-items-count {
  font-size: 13px;
  color: var(--pc-text-muted);
}

.cart-clear-btn {
  background: none;
  border: none;
  color: var(--pc-text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.cart-clear-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

/* ============= CART ITEM ============= */

.cart-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px;
  background: var(--pc-bg-1);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius);
  transition: border-color 0.15s ease;
}

.cart-item:hover {
  border-color: var(--pc-border-gold);
}

.cart-item-thumb {
  width: 120px;
  height: 68px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--pc-bg-2);
  flex-shrink: 0;
}

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

.cart-item-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.cart-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--pc-text);
  margin: 0 0 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cart-item-title a {
  color: inherit;
  text-decoration: none;
}

.cart-item-title a:hover {
  color: var(--pc-gold-light);
}

.cart-item-meta {
  font-size: 12px;
  color: var(--pc-text-muted);
  margin: 0;
}

.cart-item-tagline {
  font-size: 12px;
  color: var(--pc-text-dim);
  margin: 2px 0 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  text-align: right;
  min-width: 70px;
}

.cart-item-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--pc-text);
  white-space: nowrap;
}

.cart-item-price.b-free {
  color: var(--pc-success);
  font-size: 13px;
}

.cart-item-remove {
  background: transparent;
  border: 1px solid var(--pc-border);
  color: var(--pc-text-dim);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cart-item-remove:hover {
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
}

@media (max-width: 600px) {
  .cart-item {
    grid-template-columns: 80px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 10px;
    padding: 12px;
  }
  .cart-item-thumb {
    width: 80px;
    height: 48px;
    grid-row: span 2;
  }
  .cart-item-side {
    grid-column: 2;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }
}

/* ============= SUMMARY (sticky sidebar) ============= */

.cart-summary {
  position: sticky;
  top: 20px;
  background: var(--pc-bg-1);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius-lg);
  padding: 22px;
  box-shadow: var(--pc-shadow-card);
}

.cart-summary h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--pc-text);
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--pc-border-soft);
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  font-size: 14px;
  color: var(--pc-text);
}

.cart-summary-row.muted {
  color: var(--pc-text-muted);
  font-size: 13px;
}

.cart-summary-row.discount {
  color: var(--pc-gold);
  font-weight: 600;
}

.cart-summary-row.total {
  border-top: 1px solid var(--pc-border-soft);
  margin-top: 8px;
  padding-top: 14px;
  font-size: 17px;
  font-weight: 700;
  color: var(--pc-text);
}

.cart-summary-row.total .amount {
  color: var(--pc-gold);
}

.cart-bundle-hint {
  background: var(--pc-gold-glow);
  border: 1px solid var(--pc-border-gold);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--pc-gold-light);
  margin: 14px 0 4px;
  line-height: 1.4;
}

.cart-bundle-hint strong {
  color: var(--pc-gold);
  font-weight: 700;
}

.cart-checkout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
}

/* [batch3z-continue-shopping] Green secondary CTA, same shape as the
   gold Checkout button above. Anchor element so it acts as a plain
   navigation link to /pages/courses/. */
.cart-continue-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  border: 1px solid rgba(34, 197, 94, 0.55);
  border-radius: 8px;            /* matches .pc-btn base radius */
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.cart-continue-btn:hover {
  background: linear-gradient(180deg, #34d877 0%, #1ea34a 100%);
  color: #ffffff;
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.35);
  border-color: #34d877;
  transform: translateY(-1px);
}
.cart-continue-btn:active {
  transform: translateY(0) scale(0.99);
}

.cart-summary-meta {
  text-align: center;
  font-size: 11px;
  color: var(--pc-text-dim);
  margin-top: 10px;
  line-height: 1.5;
}

.cart-summary-meta a {
  color: var(--pc-text-muted);
  text-decoration: underline;
}

@media (max-width: 920px) {
  .cart-summary {
    position: static;
  }
}

/* ============= EMPTY STATE ============= */

.cart-empty {
  text-align: center;
  padding: 60px 24px;
  background: var(--pc-bg-1);
  border: 1px dashed var(--pc-border);
  border-radius: var(--pc-radius-lg);
  margin: 24px auto;
  max-width: 600px;
}

.cart-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.cart-empty h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  color: var(--pc-text);
  margin: 0 0 8px 0;
}

.cart-empty p {
  color: var(--pc-text-muted);
  margin: 0 0 20px 0;
  font-size: 14px;
}

/* ============= LOADING ============= */

.cart-loading {
  text-align: center;
  padding: 60px 24px;
  color: var(--pc-text-muted);
}

.cart-loading .pc-spinner {
  margin-bottom: 16px;
}

/* ============= INLINE SPINNER ============= */

.cart-btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: cart-spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes cart-spin {
  to { transform: rotate(360deg); }
}

/* ===============================================================
   PROMO CODE UI (Phase 4.3)
   =============================================================== */

/* Section wrapper — separates promo block from the rest */
.cart-promo-section {
  margin: 14px 0 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.cart-promo-section.is-applied {
  background: linear-gradient(180deg, rgba(120, 200, 130, 0.10), rgba(120, 200, 130, 0.04));
  border-color: rgba(120, 200, 130, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cart-promo-section.is-stale {
  background: linear-gradient(180deg, rgba(255, 200, 0, 0.10), rgba(255, 200, 0, 0.04));
  border-color: rgba(255, 200, 0, 0.35);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Disclosure toggle ("Have a promo code?") */
.cart-promo-toggle[open] .cart-promo-summary {
  margin-bottom: 10px;
}

.cart-promo-summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--pc-gold-light, #ffd07a);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-promo-summary::-webkit-details-marker { display: none; }
.cart-promo-summary::after {
  content: '▾';
  font-size: 11px;
  margin-left: auto;
  opacity: 0.6;
  transition: transform 0.15s ease;
}
.cart-promo-toggle[open] .cart-promo-summary::after {
  transform: rotate(180deg);
}

.cart-promo-summary:hover {
  color: #ffe09c;
}

/* Input + button row */
.cart-promo-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.cart-promo-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 6px;
  color: var(--pc-text, #f0f0f5);
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cart-promo-input:focus {
  outline: none;
  border-color: rgba(255, 140, 0, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.15);
}

.cart-promo-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cart-promo-input.is-invalid {
  border-color: rgba(255, 80, 80, 0.6);
  box-shadow: 0 0 0 2px rgba(255, 80, 80, 0.18);
}

.cart-promo-apply {
  padding: 8px 14px;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
}

/* Inline error message */
.cart-promo-error {
  display: none;
  margin-top: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: #ff8080;
  background: rgba(255, 80, 80, 0.06);
  border-left: 3px solid rgba(255, 80, 80, 0.5);
  border-radius: 0 4px 4px 0;
  line-height: 1.4;
}

.cart-promo-error.show {
  display: block;
  animation: cart-promo-shake 0.25s ease;
}

@keyframes cart-promo-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  75%      { transform: translateX(3px); }
}

/* Applied state */
.cart-promo-applied-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #b8e8c0;
}

.cart-promo-applied-label strong {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #d8f5dc;
}

.cart-promo-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: rgba(120, 200, 130, 0.25);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #d8f5dc;
}

.cart-promo-stale-label {
  font-size: 12.5px;
  color: #ffd24a;
  line-height: 1.4;
  flex: 1;
}

.cart-promo-stale-label strong {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.cart-promo-remove-link {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--pc-text-muted, rgba(240, 240, 245, 0.65));
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cart-promo-remove-link:hover {
  border-color: rgba(255, 80, 80, 0.5);
  color: #ff9090;
  background: rgba(255, 80, 80, 0.05);
}

/* Promo line in summary (with the inline × button) */
.cart-summary-row.discount.promo {
  color: #b8e8c0;
}

.cart-promo-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cart-promo-remove {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--pc-text-muted, rgba(240, 240, 245, 0.6));
  width: 20px;
  height: 20px;
  border-radius: 999px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.cart-promo-remove:hover {
  border-color: rgba(255, 80, 80, 0.5);
  color: #ff9090;
  background: rgba(255, 80, 80, 0.08);
}

/* Mobile */
@media (max-width: 600px) {
  .cart-promo-section.is-applied,
  .cart-promo-section.is-stale {
    flex-direction: column;
    align-items: stretch;
  }
  .cart-promo-row {
    flex-direction: column;
  }
  .cart-promo-apply {
    width: 100%;
  }
}

/* [batch3y-back-button-polish] Ported from detail-polish.css so the
   cart's "Back to Courses" matches the detail page's nicer pill button:
   SVG chevron icon (instead of the bare "←" literal), stronger gold
   gradient, hover state, active press feedback. The literal "←" in the
   HTML is hidden via ::first-letter so we don't need to touch markup. */
.pc-back-link {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 7px 16px 7px 12px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, rgba(255, 140, 0, 0.1), rgba(255, 140, 0, 0.03));
  border: 1px solid rgba(255, 140, 0, 0.4);
  border-radius: 999px;
  color: #ffa733 !important;
  text-decoration: none !important;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  max-width: fit-content;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.pc-back-link::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'><path d='M9 3L5 7L9 11' stroke='%23ffa733' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  margin-right: 2px;
  transition: transform 0.18s ease;
}
/* Hide the literal "←" / "&larr;" from the HTML so the SVG above is
   the only arrow visible. Uses ::first-letter so we don't have to
   edit the markup. */
.pc-back-link::first-letter {
  font-size: 0;
  margin: 0;
  letter-spacing: -0.6em;
}
.pc-back-link:hover {
  background: linear-gradient(180deg, rgba(255, 140, 0, 0.22), rgba(255, 140, 0, 0.08));
  border-color: #ff8c00;
  transform: translateX(-2px);
}
.pc-back-link:hover::before {
  transform: translateX(-2px);
}
.pc-back-link:active {
  transform: translateX(-2px) scale(0.98);
}
