/**
 * ProductComposer - Product PopUp preview (demo data)
 * Simplified replica of the product PopUp of the ProductComposer admin
 */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 18, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

.modal-window {
  background: #ffffff;
  color: #1e293b;
  width: 100%;
  max-width: 980px;
  max-height: 90vh;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal-window {
  transform: translateY(0) scale(1);
}

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.modal-header-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-modal-action {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn-modal-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: #64748b;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  overflow-x: auto;
  scrollbar-width: thin;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 1.5rem;
}

.modal-tab-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0.85rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #64748b;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.modal-tab-btn.active {
  color: var(--primary);
}

.modal-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary);
}

/* Modal Body */
.modal-content-body {
  padding: 1.75rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  background: #f8fafc;
}

/* Left Image Column */
.modal-img-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-product-img-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.btn-add-gallery {
  border: 1px dashed #f97316;
  background: #fff7ed;
  color: #ea580c;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  cursor: pointer;
  text-align: center;
}

.btn-highlight-product {
  background: #52637a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-highlight-product:hover {
  background: #334155;
}

/* Right Details Column */
.modal-info-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.modal-status-badge {
  align-self: flex-start;
  background: #047857;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
}

.modal-prod-price {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
}

.modal-meta-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #475569;
}

.modal-meta-row strong {
  color: #0f172a;
}

.modal-plugin-hint {
  margin-top: 1rem;
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  color: #6b21a8;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

@media (max-width: 768px) {
  .modal-content-body {
    grid-template-columns: 1fr;
  }
  .modal-product-img-box {
    height: 200px;
  }
}

/* Demo artwork inside the product PopUp preview */
.modal-product-art {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-product-art .demo-art {
  max-height: 240px;
}

.modal-demo-note {
  font-size: 0.75rem;
  color: #64748b;
}

.modal-tab-btn[aria-disabled="true"] {
  cursor: default;
}

@media (max-width: 768px) {
  .modal-tabs {
    padding: 0 0.75rem;
  }

  .modal-tab-btn {
    padding: 0.75rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* Only the content area shrinks and scrolls; header and tabs keep their height */
.modal-header,
.modal-tabs {
  flex-shrink: 0;
}

.modal-content-body {
  min-height: 0;
}

/* Narrow phones: the header must fit, otherwise focusing the close button scrolls the window content sideways */
.modal-window {
  min-width: 0;
  overflow: clip;
}

.modal-header {
  gap: 0.75rem;
}

.modal-header-title {
  min-width: 0;
  overflow-wrap: break-word;
}

.modal-header-actions {
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .modal-backdrop {
    padding: 0.75rem;
  }

  /* Title gets its own row, the action button wraps below it, close stays top right */
  .modal-header {
    position: relative;
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 0.75rem 3rem 0.75rem 0.9rem;
    gap: 0.5rem;
  }

  .modal-header-title {
    flex: 1 1 100%;
    font-size: 1rem;
  }

  .modal-close-btn {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
  }

  .btn-modal-action {
    padding: 0.35rem 0.55rem;
    font-size: 0.72rem;
  }

  .modal-content-body {
    padding: 1rem;
    gap: 1.25rem;
  }
}
