/* ============================================
   Q FASHION — AI DESIGN STUDIO CSS
   Page-specific styles for template-design.php
   ============================================ */

/* Design Hero (override page-hero for design page) */
.design-hero {
  background: linear-gradient(135deg, var(--green-deep) 0%, var(--green) 50%, var(--green-dark) 100%);
  color: var(--white);
  padding: clamp(3rem, 8vw, 5rem) var(--gap);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.design-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.design-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 300;
  margin-bottom: .5rem;
  position: relative;
}
.design-hero p {
  font-size: clamp(.95rem, 1.5vw, 1.1rem);
  opacity: .85;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

/* Steps indicator */
.steps {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem var(--gap);
  display: flex;
  justify-content: center;
  gap: 0;
}
.step-item {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .9rem;
  border: 2px solid var(--gray-300);
  color: var(--gray-500);
  transition: all .3s cubic-bezier(.16,1,.3,1);
}
.step-item.active .step-num {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
}
.step-item.done .step-num {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: var(--white);
}
.step-label {
  font-size: .85rem;
  color: var(--gray-500);
  transition: all .3s cubic-bezier(.16,1,.3,1);
}
.step-item.active .step-label {
  color: var(--green-deep);
  font-weight: 600;
}
.step-item.done .step-label { color: var(--green-dark); }
.step-line {
  width: 60px;
  height: 2px;
  background: var(--gray-300);
  margin: 0 .75rem;
  transition: all .3s cubic-bezier(.16,1,.3,1);
}
.step-line.done { background: var(--green); }

/* Main content area */
.design-main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gap) 4rem;
}

/* Section panels */
.panel { display: none; animation: designFadeUp .5s ease; }
.panel.active { display: block; }
@keyframes designFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section titles */
.design-section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--green-deep);
  margin-bottom: 1.5rem;
  font-weight: 500;
}
.design-section-subtitle {
  color: var(--gray-500);
  margin-bottom: 2rem;
  font-size: .95rem;
}

/* Gallery grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.gallery-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: var(--white);
  box-shadow: 0 2px 16px rgba(0,0,0,.08);
  transition: all .3s cubic-bezier(.16,1,.3,1);
  aspect-ratio: 3/4;
}
.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}
.gallery-card.selected {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}
.gallery-card.selected::after {
  content: '\2713';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  background: var(--green);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  font-weight: 700;
  z-index: 2;
}
.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.gallery-card:hover img { transform: scale(1.05); }
.gallery-card .card-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: .75rem;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  color: var(--white);
  font-size: .85rem;
}
.gallery-card .card-label strong {
  display: block;
  font-size: .95rem;
  margin-bottom: 2px;
}
.gallery-load-more {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.form-card {
  background: var(--white);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 2px 16px rgba(0,0,0,.08);
}
.form-card h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--green-deep);
  margin-bottom: 1.25rem;
  font-weight: 500;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-bottom: .75rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.form-group label {
  font-size: .8rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: .65rem .85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: .95rem;
  transition: all .3s cubic-bezier(.16,1,.3,1);
  background: var(--white);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(9,149,71,.1);
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all .3s cubic-bezier(.16,1,.3,1);
  background: var(--gray-100);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--green);
  background: rgba(9,149,71,.05);
}
.upload-zone svg { width: 48px; height: 48px; color: var(--gray-500); }
.upload-zone p { color: var(--gray-500); font-size: .9rem; }
.upload-zone .upload-hint { font-size: .8rem; color: var(--gray-500); }
.upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}
.upload-preview .preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
}
.upload-preview .preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.upload-preview .preview-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: rgba(0,0,0,.6);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  cursor: pointer;
}

/* Style selector */
.style-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.style-option {
  padding: .75rem;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all .3s cubic-bezier(.16,1,.3,1);
  font-size: .85rem;
}
.style-option:hover { border-color: var(--green); }
.style-option.selected {
  border-color: var(--green);
  background: rgba(9,149,71,.08);
  color: var(--green-deep);
  font-weight: 600;
}

/* Render area */
.render-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
.render-config {
  background: var(--white);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 2px 16px rgba(0,0,0,.08);
}
.render-config h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--green-deep);
  margin-bottom: 1rem;
  font-weight: 500;
}
.render-result {
  background: var(--white);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 2px 16px rgba(0,0,0,.08);
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.render-result.has-image { justify-content: flex-start; }
.render-placeholder { text-align: center; color: var(--gray-500); }
.render-placeholder svg { width: 80px; height: 80px; margin-bottom: 1rem; opacity: .4; }
.render-placeholder p { font-size: .95rem; }
.rendered-image { width: 100%; border-radius: 12px; margin-bottom: 1rem; }
.rendered-video { width: 100%; border-radius: 12px; margin-bottom: 1rem; }

/* Prompt preview */
.prompt-preview {
  background: var(--gray-100);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  font-size: .85rem;
  color: var(--gray-700);
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
}

/* Design buttons */
.btn-design {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.75rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: all .3s cubic-bezier(.16,1,.3,1);
  border: none;
  cursor: pointer;
}
.btn-design-primary { background: var(--green); color: var(--white); }
.btn-design-primary:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(9,149,71,.3); }
.btn-design-primary:disabled { background: var(--gray-300); cursor: not-allowed; transform: none; box-shadow: none; }
.btn-design-secondary { background: var(--white); color: var(--green); border: 2px solid var(--green); }
.btn-design-secondary:hover { background: rgba(9,149,71,.06); }
.btn-design-orange { background: var(--orange); color: var(--white); }
.btn-design-orange:hover { background: var(--orange-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(244,121,32,.3); }
.btn-design-orange:disabled { background: var(--gray-300); cursor: not-allowed; transform: none; box-shadow: none; }
.btn-design-ghost { color: var(--gray-700); padding: .5rem 1rem; background: none; border: none; }
.btn-design-ghost:hover { color: var(--green); }
.btn-design-group { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* Loading spinner */
.design-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: var(--white);
  animation: designSpin .8s linear infinite;
}
@keyframes designSpin { to { transform: rotate(360deg); } }

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
  margin: 1rem 0;
}
.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--orange));
  border-radius: 3px;
  transition: width .5s ease;
  width: 0;
}

/* API Key input */
.api-key-bar {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: .75rem var(--gap);
}
.api-key-bar .inner {
  display: flex;
  gap: .75rem;
  align-items: center;
  background: var(--white);
  padding: .75rem 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 16px rgba(0,0,0,.08);
}
.api-key-bar label {
  font-size: .8rem;
  color: var(--gray-500);
  white-space: nowrap;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.api-key-bar input {
  flex: 1;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: .5rem .75rem;
  font-size: .85rem;
  font-family: monospace;
}
.api-key-bar input:focus { outline: none; border-color: var(--green); }
.api-key-bar .status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gray-300);
  flex-shrink: 0;
}
.api-key-bar .status.ok { background: #22c55e; }

/* Toast */
.design-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--gray-900);
  color: var(--white);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  font-size: .9rem;
  transform: translateY(120%);
  opacity: 0;
  transition: all .3s cubic-bezier(.16,1,.3,1);
  z-index: 999;
  max-width: 400px;
}
.design-toast.show { transform: translateY(0); opacity: 1; }
.design-toast.error { background: #dc2626; }
.design-toast.success { background: var(--green); }

/* Persistent comparison strip */
.compare-strip {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gap);
  display: none;
}
.compare-strip.visible { display: block; }
.compare-strip .inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--white);
  border-radius: 12px;
  padding: .75rem 1rem;
  box-shadow: 0 2px 16px rgba(0,0,0,.08);
  border-left: 4px solid var(--green);
}
.compare-strip .thumb {
  width: 64px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.compare-strip .info { flex: 1; min-width: 0; }
.compare-strip .info h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--green-deep);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compare-strip .info p { font-size: .8rem; color: var(--gray-500); }
.compare-strip .change-btn {
  font-size: .8rem;
  color: var(--green);
  cursor: pointer;
  text-decoration: underline;
  flex-shrink: 0;
}

/* Side-by-side comparison */
.compare-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  align-items: start;
}
.compare-card {
  background: var(--gray-100);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}
.compare-card img {
  width: 100%;
  max-height: 500px;
  object-fit: contain;
  border-radius: 8px;
}
.compare-card .label {
  display: inline-block;
  margin-bottom: .5rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .25rem .75rem;
  border-radius: 20px;
  font-weight: 600;
}
.compare-card .label.original { background: rgba(9,149,71,.1); color: var(--green); }
.compare-card .label.ai { background: rgba(244,121,32,.1); color: var(--orange); }

/* Feedback section */
.feedback-section {
  background: var(--white);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 2px 16px rgba(0,0,0,.08);
  margin-top: 1.5rem;
  display: none;
}
.feedback-section.visible { display: block; }
.feedback-section h4 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--green-deep);
  margin-bottom: .75rem;
}
.feedback-section textarea {
  width: 100%;
  min-height: 80px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: .75rem;
  font-size: .9rem;
  resize: vertical;
  font-family: var(--font-body);
}
.feedback-section textarea:focus { outline: none; border-color: var(--green); }
.feedback-actions { display: flex; gap: .75rem; margin-top: .75rem; flex-wrap: wrap; }

/* Responsive */
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .render-area { grid-template-columns: 1fr; }
  .compare-side { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .step-label { display: none; }
  .step-line { width: 30px; }
}
@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .style-options { grid-template-columns: 1fr 1fr; }
  .compare-strip .thumb { width: 48px; height: 60px; }
}
