/* ============================================
   ITEM MODAL
   ============================================ */

#item-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
  padding: 0 12px;
}

#item-modal.open { display: flex; }

/* ── Backdrop ── */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: backdropIn 0.28s ease both;
}

@keyframes backdropIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdropOut { to   { opacity: 0; } }

/* ── Sheet ── */
.modal-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  max-height: 90dvh;
  background: var(--white);
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: sheetUp 0.38s cubic-bezier(0.22,1,0.36,1) both;
  box-shadow: 0 -6px 40px rgba(0,0,0,0.2);
}

/* Gradient accent strip at top */
.modal-sheet::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(to left, var(--blush-dark), var(--sage-light));
  z-index: 2;
  pointer-events: none;
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0);    }
}

#item-modal.closing .modal-sheet    { animation: sheetDown   0.26s cubic-bezier(0.4,0,1,1) both; }
#item-modal.closing .modal-backdrop { animation: backdropOut 0.26s ease both; }

@keyframes sheetDown { to { transform: translateY(110%); } }

/* ── Drag handle ── */
.modal-handle {
  width: 36px; height: 4px;
  background: #dddbd6;
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

/* ── Scrollable body ── */
.modal-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

/* ── Image skeleton loader ── */
.modal-img-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    #ede9e4 0%,
    #f5f2ee 40%,
    #ede9e4 80%
  );
  background-size: 300% 100%;
  animation: modalImgShimmer 1.4s ease-in-out infinite;
  z-index: 1;
}

@keyframes modalImgShimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ── Image ── */
.modal-img-wrap {
  position: relative;
  width: 100%;
  background: #f0ede8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 180px;
}

.modal-img-wrap img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 55dvh;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

.modal-img-placeholder {
  width: 100%;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  background: linear-gradient(135deg, var(--offwhite), #e8e4de);
}

/* ── Close button ── */
.modal-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  transition: transform 0.15s, background 0.15s;
  z-index: 3;
}

.modal-close:hover  { background: #fff; }
.modal-close:active { transform: scale(0.86); }

/* ── Text content ── */
.modal-content { padding: 20px 20px 36px; }

.modal-category {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--sage-dark);
  letter-spacing: 0.05em;
  margin-bottom: 7px;
}

.modal-name {
  font-size: clamp(1.2rem, 5vw, 1.5rem);
  font-weight: 900;
  line-height: 1.25;
  color: var(--black);
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.modal-desc {
  font-size: clamp(0.82rem, 2.5vw, 0.92rem);
  color: #5a5a5a;
  line-height: 1.75;
  margin-bottom: 22px;
}

.modal-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blush-dark), transparent);
  margin-bottom: 20px;
}

/* ── Price ── */
.modal-price-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-price-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-discount-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  background: #fee2e2;
  color: #dc2626;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.modal-price-old {
  font-size: 0.85rem;
  color: #c4c2bd;
  text-decoration: line-through;
}

.modal-price-new {
  font-size: clamp(1.2rem, 4vw, 1.45rem);
  font-weight: 900;
  color: var(--sage-dark);
  display: inline-block;
  border-bottom: 2px solid var(--sage-light);
  padding-bottom: 2px;
}

@media (max-width: 480px) {
  .modal-price-new { font-size: 1.35rem; }
}
