/**
 * Shopping Cart Styles - Full Page Overlay
 *
 * Modern, clean full-page cart overlay with vintage apothecary theming.
 * Redesigned for better UX, clarity, and organization.
 */

/* CSS Variables - matches site theme */
:root {
  --parchment: #F5F1E8;
  --aged-white: #FAF8F3;
  --deep-brown: #3E2723;
  --warm-brown: #6D4C41;
  --sage: #8F9E8A;
  --sage-green: #8BB680;
  --gold: #B8935C;
  --copper: #C86D3C;
  --charcoal: #2C2119;
  --cream: #E8E3D6;
}

/* Prevent body scroll when cart is open */
body.cart-open {
  overflow: hidden;
}

/* ============================================
   CART PANEL CONTAINER
   ============================================ */
.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9999;
  pointer-events: none;
  -webkit-overflow-scrolling: touch;
}

.cart-panel.open {
  pointer-events: auto;
}

/* ============================================
   OVERLAY
   ============================================ */
.cart-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(44, 33, 25, 0.7);
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
}

.cart-panel.open .cart-overlay {
  opacity: 1;
}

/* ============================================
   CART CONTENT - FULL PAGE OVERLAY
   ============================================ */
.cart-content {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 680px;
  background: var(--aged-white);
  box-shadow: -8px 0 32px rgba(44, 33, 25, 0.2);
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.cart-panel.open .cart-content {
  transform: translateX(0);
}

/* ============================================
   CART HEADER
   ============================================ */
.cart-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 2px solid var(--gold);
  background: linear-gradient(135deg, var(--parchment) 0%, var(--aged-white) 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  position: relative;
}

.cart-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sage), transparent);
}

.cart-header-content h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--deep-brown);
  margin: 0 0 0.125rem 0;
  line-height: 1.2;
}

.cart-subtitle {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8125rem;
  color: var(--warm-brown);
  margin: 0;
  font-weight: 300;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.cart-close {
  background: transparent;
  border: 2px solid var(--warm-brown);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--warm-brown);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.cart-close:hover {
  background: var(--warm-brown);
  color: white;
  transform: rotate(90deg);
}

/* ============================================
   CART BODY
   ============================================ */
.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  background: #FDFCF9;
}

/* Custom scrollbar */
.cart-body::-webkit-scrollbar {
  width: 8px;
}

.cart-body::-webkit-scrollbar-track {
  background: var(--parchment);
}

.cart-body::-webkit-scrollbar-thumb {
  background: var(--sage);
  border-radius: 4px;
}

.cart-body::-webkit-scrollbar-thumb:hover {
  background: var(--warm-brown);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.cart-empty-message {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  min-height: 400px;
}

.cart-empty-message.show {
  display: flex;
}

.cart-empty-icon {
  color: var(--sage);
  margin-bottom: 1.5rem;
  opacity: 0.5;
}

.cart-empty-message h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.75rem;
  color: var(--deep-brown);
  margin: 0 0 0.75rem 0;
  font-weight: 500;
}

.cart-empty-message p {
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  color: var(--warm-brown);
  margin: 0 0 2rem 0;
  max-width: 300px;
}

.continue-shopping-empty {
  background: var(--sage-green);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}

.continue-shopping-empty:hover {
  background: var(--sage);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 158, 138, 0.3);
}

/* ============================================
   CART ITEMS
   ============================================ */
.cart-items-wrapper {
  display: none;
}

.cart-items-wrapper.show {
  display: block;
}

.cart-items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--cream);
}

.cart-items-header h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  color: var(--deep-brown);
  margin: 0;
  font-weight: 500;
  letter-spacing: 2px;
}

.clear-cart-btn {
  background: transparent;
  border: 1px solid var(--copper);
  color: var(--copper);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.clear-cart-btn:hover {
  background: var(--copper);
  color: white;
}

.cart-items-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ============================================
   CART ITEM
   ============================================ */
.cart-item {
  display: flex;
  gap: 1rem;
  background: white;
  border-radius: 10px;
  padding: 1rem;
  border: 2px solid var(--cream);
  transition: all 0.3s ease;
}

.cart-item:hover {
  border-color: var(--sage);
  box-shadow: 0 3px 12px rgba(139, 158, 138, 0.15);
}

.cart-item-image {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--parchment);
}

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

.cart-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cart-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.cart-item-details {
  flex: 1;
}

.cart-item-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--deep-brown);
  margin: 0 0 0.25rem 0;
  letter-spacing: 0.5px;
}

.cart-item-variant {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.875rem;
  color: var(--warm-brown);
  margin: 0;
}

.cart-item-remove {
  background: transparent;
  border: 1px solid var(--cream);
  color: var(--warm-brown);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.cart-item-remove:hover {
  background: #fee;
  border-color: #c33;
  color: #c33;
}

.cart-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* ============================================
   QUANTITY SELECTOR
   ============================================ */
.quantity-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--parchment);
  padding: 0.5rem;
  border-radius: 8px;
}

.qty-btn {
  background: white;
  border: 1px solid var(--cream);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--warm-brown);
  transition: all 0.2s ease;
}

.qty-btn:hover:not(:disabled) {
  background: var(--sage-green);
  border-color: var(--sage-green);
  color: white;
}

.qty-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.qty-display {
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--deep-brown);
  min-width: 28px;
  text-align: center;
}

/* ============================================
   CART ITEM PRICING
   ============================================ */
.cart-item-pricing {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.cart-item-unit-price {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.875rem;
  color: var(--warm-brown);
}

.cart-item-line-total {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--deep-brown);
  letter-spacing: 0.5px;
}

/* ============================================
   CART FOOTER
   ============================================ */
.cart-footer {
  padding: 0.875rem 1.5rem 1rem;
  background: var(--parchment);
  border-top: 2px solid var(--gold);
  flex-shrink: 0;
}

/* ============================================
   SUBSCRIPTION SECTION
   ============================================ */
.subscription-section {
  margin-bottom: 0.75rem;
}

.subscription-toggle-container {
  background: white;
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  border: 2px solid var(--cream);
  transition: all 0.3s ease;
}

.subscription-toggle-container:has(.subscription-checkbox:checked) {
  border-color: var(--sage-green);
  background: rgba(139, 182, 128, 0.05);
}

.subscription-toggle {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
}

.subscription-checkbox {
  display: none;
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--cream);
  border-radius: 11px;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.toggle-switch::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 8px;
  top: 3px;
  left: 3px;
  background: white;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subscription-checkbox:checked + .toggle-switch {
  background: var(--sage-green);
}

.subscription-checkbox:checked + .toggle-switch::before {
  transform: translateX(18px);
}

.subscription-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.subscription-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--deep-brown);
  display: block;
  line-height: 1.2;
}

.subscription-benefits {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.75rem;
  color: var(--sage);
  display: block;
  font-weight: 500;
  line-height: 1.2;
}

.cart-tier-info {
  margin-top: 0.5rem;
  display: none; /* Hide tier info by default to save space */
}

.subscription-checkbox:checked ~ .cart-tier-info {
  display: block; /* Only show when subscription is active */
}

.tier-badge {
  background: linear-gradient(135deg, var(--sage-green) 0%, var(--sage) 100%);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  text-align: center;
}

.tier-badge strong {
  display: inline;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8125rem;
  margin-right: 0.375rem;
  letter-spacing: 0.25px;
  line-height: 1.2;
}

.tier-benefits {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.75rem;
  display: inline;
  opacity: 0.95;
  line-height: 1.2;
}

.tier-notice {
  background: rgba(139, 182, 128, 0.1);
  border: 1px solid var(--sage-green);
  color: var(--sage);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  text-align: center;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
}

/* ============================================
   CART SUMMARY
   ============================================ */
.cart-summary {
  background: white;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  font-family: 'Montserrat', sans-serif;
}

.cart-summary-row .label {
  color: var(--warm-brown);
  font-size: 0.8125rem;
}

.cart-summary-row .value {
  color: var(--deep-brown);
  font-weight: 600;
  font-size: 0.875rem;
}

.cart-discount-row .value {
  color: var(--sage-green);
}

.cart-summary-divider {
  height: 1px;
  background: var(--cream);
  margin: 0.25rem 0;
}

.cart-total-row {
  padding-top: 0.5rem;
  border-top: 2px solid var(--gold);
}

.cart-total-row .label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--deep-brown);
  letter-spacing: 0.25px;
}

.cart-total-row .value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--deep-brown);
  letter-spacing: 0.25px;
}

/* ============================================
   ACTION BUTTONS
   ============================================ */
.cart-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}

.checkout-button {
  background: var(--sage-green);
  color: white;
  border: none;
  padding: 0.8125rem 1.25rem;
  border-radius: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  letter-spacing: 0.25px;
  box-shadow: 0 3px 10px rgba(139, 182, 128, 0.3);
}

.checkout-button:hover:not(:disabled) {
  background: var(--sage);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(139, 182, 128, 0.4);
}

.checkout-button:disabled {
  background: var(--cream);
  color: var(--warm-brown);
  cursor: not-allowed;
  box-shadow: none;
}

.continue-shopping {
  background: transparent;
  color: var(--warm-brown);
  border: 1px solid var(--cream);
  padding: 0.625rem 1rem;
  border-radius: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.25px;
}

.continue-shopping:hover {
  background: var(--cream);
  border-color: var(--warm-brown);
}

/* ============================================
   TRUST BADGES
   ============================================ */
.cart-trust-badges {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  opacity: 0.8;
}

.trust-badge {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.6875rem;
  color: var(--warm-brown);
  line-height: 1.2;
}

.trust-badge svg {
  color: var(--sage);
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .cart-content {
    max-width: 100%;
  }

  .cart-header {
    padding: 1rem 1.25rem;
  }

  .cart-header-content h2 {
    font-size: 1.25rem;
  }

  .cart-body {
    padding: 0.875rem 1rem;
  }

  .cart-footer {
    padding: 0.75rem 1rem;
  }

  .cart-item {
    flex-direction: column;
    gap: 0.875rem;
  }

  .cart-item-image {
    width: 100%;
    height: 160px;
  }

  .cart-item-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .cart-item-pricing {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .cart-actions {
    gap: 0.5rem;
  }

  .checkout-button {
    font-size: 0.9375rem;
    padding: 0.75rem 1.25rem;
  }

  .trust-badges {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .cart-header-content h2 {
    font-size: 1.125rem;
    letter-spacing: 1.5px;
  }

  .cart-subtitle {
    font-size: 0.75rem;
  }

  .cart-item-title {
    font-size: 1rem;
  }

  .checkout-button {
    padding: 0.75rem 1rem;
  }
}
