/* ============================================================
   dixpic v2 — Editor Shared Styles
   Used by /edit, /upscale, /bg-remove
   ============================================================ */

:root {
  --bg-editor: #141420;
  --border-subtle: #2a2a3a;
}

/* ===============================================
   EDITOR CONTAINER
   =============================================== */
.editor-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 88px 24px 48px;
}

/* Login prompt */
.login-prompt {
  margin-bottom: 1.5rem;
}

.login-prompt-content {
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

.login-prompt-content a {
  color: var(--accent-purple);
  font-weight: 600;
}

.login-prompt-content a:hover {
  text-decoration: underline;
}

/* ===============================================
   MINI HERO
   =============================================== */
.editor-hero {
  text-align: center;
  padding: 32px 24px 16px;
}

.editor-hero h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

.editor-hero p {
  font-size: 16px;
  color: var(--text-secondary);
}

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===============================================
   TWO-PANEL LAYOUT WITH ARROW
   =============================================== */
.main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 1.5rem;
}

.editor-panels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 1.5rem;
}

.editor-arrow {
  color: var(--text-muted);
  opacity: 0.5;
  padding-top: 180px;
}

.panel h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

/* ===============================================
   DROPZONE
   =============================================== */
.dropzone {
  position: relative;
  border: 2px dashed #4b5563;
  border-radius: var(--radius-lg);
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  overflow: hidden;
  background: var(--bg-editor);
}

.dropzone:hover {
  border-color: var(--accent-purple);
  background: rgba(124, 58, 237, 0.03);
}

.dropzone.has-image {
  border-color: transparent;
  cursor: default;
}

/* Remove/change image overlay button */
.remove-image-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.remove-image-btn:hover {
  background: rgba(239, 68, 68, 0.8);
}

.remove-image-btn[hidden] {
  display: none !important;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 24px;
  text-align: center;
}

.dropzone-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.dropzone-subtitle {
  font-size: 0.875rem;
}

/* ===============================================
   PREVIEW IMAGES
   =============================================== */
.preview-image {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  display: none;
  margin: 0 auto;
}

.preview-image.visible {
  display: block;
}

/* ===============================================
   RESULT BOX
   =============================================== */
.result-box {
  position: relative;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-editor);
  overflow: hidden;
}

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 24px;
}

.placeholder[hidden] { display: none !important; }

.placeholder p {
  font-size: 0.875rem;
}

/* Loader */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loader[hidden] { display: none !important; }

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ===============================================
   TEXT BUTTONS
   =============================================== */
.btn-text {
  background: none;
  border: none;
  color: var(--accent-purple);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
  transition: opacity var(--transition);
}

.btn-text:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ===============================================
   TIER SELECTOR
   =============================================== */
.tier-selector-section {
  background: var(--bg-editor);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.tier-selector-section > label,
.tier-selector-section .section-header label {
  display: block;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0;
  color: var(--text-primary);
}

.tier-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.tier-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 8px;
  background: #111827;
  border: 2px solid var(--border-subtle);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: inherit;
}

.tier-option:hover {
  border-color: var(--accent-purple);
  background: rgba(124, 58, 237, 0.05);
}

.tier-option.active {
  border-color: var(--accent-purple);
  background: rgba(124, 58, 237, 0.1);
  color: var(--text-primary);
}

.tier-option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.tier-option-name {
  font-size: 14px;
  font-weight: 600;
}

.tier-option-cost {
  font-size: 12px;
  color: var(--text-muted);
}

.tier-option-speed {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
}

.tier-option.active .tier-option-cost {
  color: var(--accent-cyan);
}

/* ===============================================
   SECTION HEADER & INFO TOOLTIPS
   =============================================== */
.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.section-header > label {
  display: block;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.info-trigger {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.3);
  color: var(--accent-purple);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.info-trigger:hover {
  background: rgba(124, 58, 237, 0.2);
}

.info-tooltip {
  margin-top: 12px;
  padding: 16px;
  background: rgba(124, 58, 237, 0.05);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 12px;
  font-size: 14px;
  color: var(--text-secondary);
  animation: fadeIn 0.2s ease;
}

.info-tooltip[hidden] { display: none !important; }

.info-tooltip table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.info-tooltip th, .info-tooltip td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.info-tooltip th {
  color: var(--text-primary);
  font-weight: 600;
}

.info-tooltip td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
}

.info-tooltip ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.info-tooltip li {
  margin-bottom: 4px;
  line-height: 1.5;
}

.info-tooltip-hint {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.tier-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.tier-cost {
  color: var(--text-secondary);
}

.tier-free-remaining {
  color: #22c55e;
  font-size: 13px;
}

/* ===============================================
   PROMPT SECTIONS
   =============================================== */
.prompt-section {
  margin-bottom: 1.5rem;
}

.prompt-section > label,
.prompt-section .section-header label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0;
  color: var(--text-primary);
}

.prompt-section > label {
  margin-bottom: 0.5rem;
}

.prompt-section textarea {
  width: 100%;
  min-height: 5rem;
  padding: 12px 16px;
  background: var(--bg-editor);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color var(--transition);
}

.prompt-section textarea:focus {
  outline: none;
  border-color: var(--accent-purple);
}

.prompt-section textarea::placeholder {
  color: var(--text-muted);
}

.negative-prompt-section textarea {
  height: 4rem;
  min-height: 4rem;
}

.label-hint {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}

/* ===============================================
   ERROR
   =============================================== */
.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 1.5rem;
  color: #f87171;
  font-size: 0.875rem;
}

/* ===============================================
   ACTION BUTTONS
   =============================================== */
.actions {
  display: flex;
  gap: 12px;
  margin-bottom: 2rem;
}

.btn {
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
}

.btn-primary:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* ===============================================
   MODAL
   =============================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 1.125rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  margin-bottom: 20px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.modal-hint {
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.modal-hint a {
  color: var(--accent-purple);
  font-weight: 600;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-actions .btn {
  padding: 10px 20px;
  font-size: 0.875rem;
}

/* ===============================================
   CHECKERBOARD (bg-remove — transparent PNG preview)
   =============================================== */
.result-box.checkerboard {
  background-image:
    linear-gradient(45deg, #1a1a2e 25%, transparent 25%),
    linear-gradient(-45deg, #1a1a2e 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1a2e 75%),
    linear-gradient(-45deg, transparent 75%, #1a1a2e 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: #111827;
}

.result-box.checkerboard .placeholder {
  background: #111827;
  border-radius: 0.75rem;
}

.placeholder-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* RMBG info row */
.rmbg-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text-secondary);
}


/* ===============================================
   BELOW-FOLD SEO CONTENT
   =============================================== */
.editor-seo-content {
  padding-top: 0;
}

.editor-info-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 24px;
  border-top: 1px solid var(--border-subtle);
}

.editor-info-section h2 {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 32px;
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-top: -20px;
  margin-bottom: 24px;
}

/* Info steps */
.info-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.info-step { text-align: center; }

.info-step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.info-step h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-primary); }
.info-step p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

/* Tier comparison table */
.tier-comparison-table { overflow-x: auto; }

.tier-comparison-table table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
}

.tier-comparison-table th,
.tier-comparison-table td {
  padding: 12px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 14px;
}

.tier-comparison-table th {
  background: rgba(124, 58, 237, 0.1);
  font-weight: 600;
  color: var(--text-primary);
}

.tier-comparison-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text-primary);
}

/* Prompt examples */
.prompt-examples-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.prompt-example {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.prompt-example:hover {
  border-color: var(--accent-purple);
  transform: translateY(-2px);
  color: var(--text-primary);
}

/* FAQ */
.faq-list {
  max-width: 700px;
  margin: 0 auto;
}

.faq-item {
  border-bottom: 1px solid var(--border-subtle);
}

.faq-question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: color 0.2s;
}

.faq-question:hover { color: var(--accent-purple); }

.faq-icon {
  font-size: 20px;
  font-weight: 300;
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-left: 16px;
}

.faq-item.open .faq-icon { transform: rotate(45deg); }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer {
  max-height: 200px;
}

.faq-answer p {
  padding: 0 0 20px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ===============================================
   RESPONSIVE
   =============================================== */
@media (max-width: 768px) {
  .main {
    grid-template-columns: 1fr;
  }

  .editor-panels {
    grid-template-columns: 1fr;
  }

  .editor-arrow {
    transform: rotate(90deg);
    justify-self: center;
    padding-top: 0;
  }

  .dropzone,
  .result-box {
    min-height: 240px;
  }

  .editor-hero h1 { font-size: 26px; }

  .info-steps { grid-template-columns: 1fr; }
  .prompt-examples-grid { grid-template-columns: 1fr 1fr; }
  .editor-info-section { padding: 40px 16px; }
  .editor-info-section h2 { font-size: 24px; }
}

@media (max-width: 640px) {
  .editor-container {
    padding: 76px 16px 32px;
  }

  .tier-selector {
    grid-template-columns: repeat(2, 1fr);
  }

  .tier-info {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }

  .actions {
    flex-direction: column;
  }

  .actions .btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .prompt-examples-grid { grid-template-columns: 1fr; }
}
