/* ═══════════════════════════════════════════════
   MODALS & CART — Editorial Style
═══════════════════════════════════════════════ */

/* ── OVERLAYS ── */
.modal-overlay,
.cart-panel-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(10, 9, 7, 0.8);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease;
}
.modal-overlay.open,
.cart-panel-overlay.open { opacity: 1; pointer-events: all; }

/* ── MODAL BOX ── */
.modal {
  background: var(--warm-white);
  padding: 48px;
  max-width: 480px; width: 100%; position: relative;
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-d);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0,0,0,0.1);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal__close {
  position: absolute; top: 24px; right: 24px; z-index: 10;
  width: 44px; height: 44px; border: none;
  background: transparent; color: var(--text-2); cursor: pointer;
  font-size: 16px; font-weight: 300;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.3s;
  min-height: 44px;
  min-width: 44px;
}
.modal__close:hover { color: var(--black); }

/* Typography */
.modal__title {
  font-family: 'Cormorant Garant', serif;
  font-size: 32px; font-weight: 400; color: var(--text);
  margin-bottom: 8px; text-align: center;
  letter-spacing: -0.5px;
}
.modal__subtitle {
  font-size: 12px; color: var(--text-3);
  margin-bottom: 32px; text-align: center;
}
.modal__subtitle strong { color: var(--green); font-weight: 600; }

/* Forms in Modals */
.modal-form { display: flex; flex-direction: column; gap: 20px; }
.modal-form .form-group { margin-bottom: 0; }
.modal-form button[type="submit"] {
  margin-top: 12px;
  background: var(--black);
  color: var(--cream);
  border: none; padding: 14px;
  font-size: 12px; font-weight: 600; letter-spacing: 1.5px;
  text-transform: uppercase; cursor: pointer;
  transition: var(--transition);
  border-radius: var(--radius-sm);
  min-height: 44px;
}
.modal-form button[type="submit"]:hover { background: var(--green); transform: translateY(-2px); box-shadow: var(--shadow); }

/* Success State */
.modal__success { text-align: center; padding: 32px 0; }
.modal__success-icon {
  width: 48px; height: 48px; margin: 0 auto 24px;
  border: 1px solid var(--green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.modal__success-icon::after {
  content: '';
  width: 14px; height: 8px;
  border-bottom: 1px solid var(--green);
  border-left: 1px solid var(--green);
  transform: rotate(-45deg) translateY(-2px);
}
.modal__success p { font-size: 14px; color: var(--text-2); line-height: 1.7; }

/* ── CART PANEL ── */
.cart-panel-overlay {
  align-items: stretch; justify-content: flex-end; padding: 0;
}
.cart-panel {
  width: 400px; max-width: 100%;
  background: var(--cream); display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 1px solid var(--border-d);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  box-shadow: var(--shadow);
}
.cart-panel-overlay.open .cart-panel { transform: translateX(0); }

.cart-panel__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 32px 32px 24px; border-bottom: 1px solid var(--border-d);
}
.cart-panel__header h3 {
  font-family: 'Cormorant Garant', serif;
  font-size: 24px; font-weight: 400; color: var(--text);
  letter-spacing: -0.5px;
}
.cart-panel__header .modal__close {
  position: static; width: auto; height: auto;
}

.cart-panel__empty {
  padding: 48px 32px; text-align: center; color: var(--text-3);
  font-size: 13px; line-height: 1.8;
}

.cart-panel__list {
  flex: 1; overflow-y: auto; padding: 24px 32px;
  display: flex; flex-direction: column; gap: 16px;
}
.cart-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border-d);
}
.cart-item__info { display: flex; flex-direction: column; gap: 4px; }
.cart-item__info strong { font-size: 14px; font-weight: 600; color: var(--text); }
.cart-item__info span { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }

.cart-item__status {
  font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  padding: 6px 12px; border-radius: 100px;
  white-space: nowrap; flex-shrink: 0;
  border: 1px solid transparent;
  min-height: 28px;
  display: flex;
  align-items: center;
}
/* Status color variants — updated by admin */
.cart-status--new {
  color: #b57d00; background: rgba(181,125,0,0.08);
  border-color: rgba(181,125,0,0.25);
}
.cart-status--processing {
  color: #2563eb; background: rgba(37,99,235,0.08);
  border-color: rgba(37,99,235,0.25);
}
.cart-status--done {
  color: var(--green); background: rgba(100,160,80,0.08);
  border-color: rgba(100,160,80,0.3);
}

.cart-panel__footer { padding: 32px; border-top: 1px solid var(--border-d); }
.cart-panel__footer .btn {
  background: var(--black); color: var(--cream);
  padding: 14px; font-size: 12px; letter-spacing: 1.5px;
  width: 100%; border: none; text-transform: uppercase; cursor: pointer;
  transition: background 0.3s; text-align: center; display: block;
  min-height: 44px;
}
.cart-panel__footer .btn:hover { background: var(--green); }

/* ── PRODUCT DETAIL MODAL ──
   Phones only (js/detail.js blocks opening above 768px), so this is
   designed compact and single-column from the start — no separate
   wide desktop layout to maintain. No product photo here — the card
   in the grid already shows it; this modal is pure text info, so
   there's nothing left to overlap. */
.modal--detail {
  max-width: 400px; width: 100%; padding: 0;
  display: flex; flex-direction: column;
  max-height: 88vh;
  overflow: hidden;
}

.detail-body {
  /* Extra top padding clears the ✕ button in the corner (top:24/right:24)
     since the header text now starts right at the top of the card. */
  padding: 52px 22px 28px;
  flex: 1; min-height: 0; /* required so this flex child can actually scroll */
  display: flex; flex-direction: column;
  overflow-y: auto;
}

.detail-header { margin-bottom: 12px; text-align: center; }
.detail-header .product-card__cat {
  font-size: 9px; font-weight: 600; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text-3); display: block; margin-bottom: 8px;
}
.detail-title {
  font-family: 'Cormorant Garant', serif; font-size: 26px;
  font-weight: 400; color: var(--text); line-height: 1.15;
  letter-spacing: -0.3px;
}

.detail-desc {
  font-size: 13.5px; color: var(--text-2); line-height: 1.7;
  text-align: center; margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-d);
}

/* Variants */
.detail-variants {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 18px;
}
.detail-variant-tag {
  padding: 5px 10px; border: 1px solid var(--border-d);
  font-size: 10px; color: var(--text-3); background: var(--cream);
  border-radius: var(--radius-sm);
  min-height: 28px;
  display: flex;
  align-items: center;
}

/* All info at once — stacked sections, no tabs, no extra taps */
.detail-sections {
  display: flex; flex-direction: column; gap: 16px;
}
.detail-section {
  padding-top: 14px;
  border-top: 1px solid var(--border-d);
}
.detail-section:first-child {
  padding-top: 0;
  border-top: none;
}
.detail-section__title {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--green);
  margin-bottom: 8px;
}
.detail-section__body { animation: fadeIn 0.3s ease; }

.detail-benefits { display: flex; flex-direction: column; gap: 8px; }
.detail-benefit-item {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 12.5px; color: var(--text-2); line-height: 1.55;
}
.detail-benefit-item::before {
  content: '—'; color: var(--green); font-weight: 400; flex-shrink: 0;
}

.detail-composition {
  font-size: 12.5px; color: var(--text-2); line-height: 1.7;
}

.detail-storage { display: flex; flex-direction: column; gap: 10px; }
.detail-storage-item { border-left: 2px solid var(--green); padding-left: 10px; }
.detail-storage-item strong {
  display: block; font-size: 9px; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-3); margin-bottom: 3px;
}
.detail-storage-item span { font-size: 12.5px; color: var(--text); }

/* ════════════════════════════════════════════════
   MOBILE ADJUSTMENTS
════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .modal {
    padding: 40px 32px;
    max-width: 90vw;
  }
  
  .modal__close {
    width: 40px;
    height: 40px;
  }

  /* Cart panel on tablet */
  .cart-panel {
    width: 90vw;
    max-width: 480px;
    border-radius: 0;
  }
}

@media (max-width: 600px) {
  .modal { 
    padding: 32px 24px;
    max-width: 100%;
    margin: 20px;
    border-radius: var(--radius);
    max-height: 85vh;
  }
  
  .modal__title {
    font-size: 24px;
  }
  
  .modal__subtitle {
    font-size: 11px;
    margin-bottom: 24px;
  }

  .modal--detail {
    max-width: 100%;
    margin: 0;
  }

  /* Cart panel on mobile */
  .cart-panel { 
    width: 100%;
    border-radius: 0;
    border-left: none;
  }
  
  .cart-panel__header {
    padding: 24px 20px 16px;
  }
  
  .cart-panel__header h3 {
    font-size: 20px;
  }
  
  .cart-panel__list {
    padding: 16px 20px;
  }
  
  .cart-panel__footer {
    padding: 24px 20px;
  }
  
  .cart-panel__empty {
    padding: 40px 20px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .modal { 
    padding: 28px 20px;
    margin: 16px;
  }
  
  .modal__close {
    width: 36px;
    height: 36px;
    top: 16px;
    right: 16px;
  }

  .modal__title {
    font-size: 20px;
  }

  .modal-form {
    gap: 16px;
  }

  .modal--detail {
    border-radius: 0;
  }

  .detail-body { 
    padding: 46px 18px 22px;
  }
  
  .detail-title { 
    font-size: 20px;
  }
  
  .detail-header {
    margin-bottom: 16px;
  }

  .detail-desc {
    font-size: 12px;
    margin-bottom: 16px;
  }

  .cart-panel__header {
    padding: 20px 16px 12px;
  }

  .cart-panel__list {
    padding: 12px 16px;
  }

  .cart-panel__footer {
    padding: 20px 16px;
  }

  .cart-item__status {
    font-size: 8px;
    padding: 4px 8px;
  }
}

@media (max-width: 360px) {
  .modal {
    padding: 24px 16px;
    margin: 12px;
    border-radius: 8px;
  }

  .modal__title {
    font-size: 18px;
  }

  .detail-title {
    font-size: 18px;
  }

  .detail-body {
    padding: 42px 14px 18px;
  }
}
