/* ==========================================================================
   استایل‌های اختصاصی ابزار استودیو هوش مصنوعی تصویر (AI Image Studio)
   ========================================================================== */

.tool-page-container {
  max-width: 1120px;
  margin: 0 auto;
  padding-bottom: 50px;
}

.tool-hero-section {
  padding: 36px 16px 20px;
}

.ai-badge {
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  color: #7c3aed;
  border-color: #ddd6fe;
}

/* --------------------------------------------------------------------------
   سوئیچر تب‌های حالت تولید و ویرایش
   -------------------------------------------------------------------------- */
.mode-tabs-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
  padding: 0 14px;
}

.mode-tabs-nav {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 30px;
  padding: 5px;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  max-width: 100%;
  overflow-x: auto;
}

.mode-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: transparent;
  border: none;
  border-radius: 24px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.mode-tab-btn:hover {
  color: var(--text-main);
}

.mode-tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(25, 75, 251, 0.12);
}

/* --------------------------------------------------------------------------
   پنل استودیو
   -------------------------------------------------------------------------- */
.ai-studio-panel {
  margin-bottom: 35px;
}

.studio-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.prompt-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
}

.label-hint {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.prompt-textarea {
  width: 100%;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text-main);
  background: var(--bg-subtle);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  box-sizing: border-box;
  resize: vertical;
  min-height: 100px;
  transition: var(--transition);
}

.prompt-textarea:focus {
  outline: none;
  border-color: #8b5cf6;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.prompt-chips-section {
  margin-top: 14px;
}

.chips-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.chips-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.prompt-chip, .prompt-chip-i2i {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 4px 12px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.prompt-chip:hover, .prompt-chip-i2i:hover {
  background: #ede9fe;
  border-color: #ddd6fe;
  color: #7c3aed;
  transform: translateY(-1px);
}

.studio-footer-action {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}

.btn-generate-ai {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 36px;
  background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.3);
  transition: var(--transition);
}

.btn-generate-ai:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.4);
  filter: brightness(1.08);
}

.btn-sparkle {
  font-size: 1.2rem;
  animation: pulse-sparkle 1.8s infinite;
}

@keyframes pulse-sparkle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

/* --------------------------------------------------------------------------
   حالت Image-to-Image (آپلود و دو ستونه)
   -------------------------------------------------------------------------- */
.img2img-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 860px) {
  .img2img-grid {
    grid-template-columns: 1fr 1.3fr;
  }
}

.upload-dropzone {
  position: relative;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  background: #f8fafc;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
  padding: 16px;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: #8b5cf6;
  background: #f5f3ff;
}

.file-hidden-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}

.dropzone-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  pointer-events: none;
}

.dropzone-icon-box {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #ede9fe;
  color: #7c3aed;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.dropzone-btn-text {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dropzone-preview-state {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 10;
}

.preview-thumb-img {
  max-width: 100%;
  max-height: 220px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  object-fit: contain;
}

.preview-overlay-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
}

.btn-remove-image {
  background: #ef4444;
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  transition: var(--transition);
}

.btn-remove-image:hover {
  background: #dc2626;
}

/* --------------------------------------------------------------------------
   بخش نمایش نتیجه خروجی هوش مصنوعی
   -------------------------------------------------------------------------- */
.ai-result-section {
  margin: 20px 0 35px;
  animation: fadeIn 0.3s ease;
}

.ai-result-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-items: center;
}

.single-result-box {
  max-width: 640px;
  width: 100%;
  background: #0f172a;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.final-ai-img {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.comparison-container {
  width: 100%;
  max-width: 780px;
}

.comparison-box {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

@media (max-width: 640px) {
  .comparison-box {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .comp-arrow {
    transform: rotate(90deg);
  }
}

.comp-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.comp-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.comp-label.ai-glow {
  color: #7c3aed;
}

.comp-img-wrap {
  width: 100%;
  aspect-ratio: 1;
  background: #0f172a;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.comp-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.comp-arrow {
  font-size: 1.5rem;
  font-weight: 900;
  color: #7c3aed;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   مودال و انیمیشن لودینگ زمان انتظار
   -------------------------------------------------------------------------- */
.ai-processing-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
}

.ai-modal-card {
  position: relative;
  z-index: 10;
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 36px 28px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ai-anim-orbit {
  position: relative;
  width: 90px;
  height: 90px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.orbit-center {
  font-size: 2.5rem;
  z-index: 2;
  animation: pulse-brain 2s ease-in-out infinite;
}

@keyframes pulse-brain {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.orbit-particle {
  position: absolute;
  font-size: 1.2rem;
}

.orbit-particle.p1 {
  animation: orbit1 3s linear infinite;
}
.orbit-particle.p2 {
  animation: orbit2 3.5s linear infinite;
}
.orbit-particle.p3 {
  animation: orbit3 4s linear infinite;
}

@keyframes orbit1 {
  0% { transform: rotate(0deg) translateX(42px) rotate(0deg); }
  100% { transform: rotate(360deg) translateX(42px) rotate(-360deg); }
}

@keyframes orbit2 {
  0% { transform: rotate(120deg) translateX(42px) rotate(-120deg); }
  100% { transform: rotate(480deg) translateX(42px) rotate(-480deg); }
}

@keyframes orbit3 {
  0% { transform: rotate(240deg) translateX(42px) rotate(-240deg); }
  100% { transform: rotate(600deg) translateX(42px) rotate(-600deg); }
}

.modal-loading-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.modal-loading-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
}

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-fill {
  height: 100%;
  width: 5%;
  background: linear-gradient(90deg, #7c3aed, #2563eb);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.estimated-time {
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 600;
}
