/* Modal Root */
.modal-root {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1000;
  pointer-events: none;
}

.modal-root.show {
  display: block;
  pointer-events: auto;
}


.modal-root.show {
  display: block;
}

/* Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1;
}


/* Card */
.modal-card {
  position: relative;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  max-width: 980px;
  margin: 48px auto;
  padding: 16px;
  z-index: 2;
  height: 85%; /* 30% taller window */
  overflow-y: auto;
}



.modal-card--xl {
  max-width: 1140px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
}

/* Header */
.modal-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 6px 8px 14px 8px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-weight: 900;
  font-size: 1.25rem;
  margin: 0;
}

.modal-submeta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.meta-label {
  opacity: 0.8;
}

.meta-value {
  font-weight: 700;
}

.modal-header-right {
  display: grid;
  gap: 6px;
  justify-items: end;
  margin-right: 50px; /* moves price and stock left to avoid overlap with close button */
}

.modal-price {
  color: var(--accent);
  font-weight: 900;
  font-size: 1.15rem;
}

.modal-stock {
  color: var(--muted);
  font-weight: 600;
}

/* Body grid */
.modal-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 16px;
  padding: 16px 8px 8px 8px;
}

.modal-grid--balanced {
  grid-template-columns: 520px 1fr;
}

/* Gallery */
.modal-gallery .modal-image-frame {
  position: relative;
  background: #0b0f14;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-gallery .modal-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* ensures full image fits nicely inside the box */
  background-color: #0b0f14;
}



.modal-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-thumbs {
  display: flex;
  justify-content: center;           /* center the row */
  align-items: center;               /* keep vertically centered to the main image area */
  gap: 26px;                         /* spacing between thumbs */
  margin-top: 18px;
  width: 100%;
  flex-wrap: nowrap;                 /* keep them in one line under the main image */
}



.modal-thumbs button {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  background: var(--panel-2);
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  width: 22%;                        /* give each thumb a fixed fraction so centering works well */
  max-width: 140px;                  /* cap size so they don’t get too big on large screens */
  min-width: 80px;                   /* keep a sensible minimum */
  transform: scale(1.1);             /* slightly larger thumbnails */
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  transform-origin: center center;   /* scale from center so centering remains visually correct */
}




.modal-thumbs button:hover {
  border-color: var(--accent);
  transform: scale(1.05);
  box-shadow: 0 0 8px var(--accent);
}


.modal-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Info + sections */
.modal-info {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
}

.modal-section {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.section-title {
  margin: 0 0 8px 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
}

/* Summary */
.modal-short {
  color: var(--text);
  opacity: 0.95;
  line-height: 1.4;
}

/* Full details in its own scroll area */
.modal-full {
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
}

.modal-full--scroll {
  max-height: 432px; /* 50% taller details section */
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}


.modal-full--scroll::-webkit-scrollbar {
  width: 8px;
}

.modal-full--scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}

.modal-full--scroll:hover::-webkit-scrollbar-thumb {
  background: var(--accent);
}

/* Actions */
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 6px;
}

/* Responsive */
@media (max-width: 1100px) {
  .modal-grid,
  .modal-grid--balanced {
    grid-template-columns: 1fr;
  }
}
