/* ═══════════════════════════════════════════
   MIMAR AI — Premium Design System
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg-base:        #060610;
  --bg-card:        rgba(255,255,255,0.04);
  --bg-card-hover:  rgba(255,255,255,0.07);
  --border:         rgba(255,255,255,0.08);
  --border-glow:    rgba(138,99,255,0.4);

  --purple-1:       #8a63ff;
  --purple-2:       #6c3ff0;
  --gold-1:         #f5c842;
  --gold-2:         #e8a020;

  --text-primary:   #f0eeff;
  --text-secondary: #9590b8;
  --text-muted:     #554e7a;

  --success:        #22d97a;
  --error:          #ff5566;
  --warn:           #ffb347;

  --radius-sm:      8px;
  --radius-md:      16px;
  --radius-lg:      24px;
  --radius-xl:      32px;

  --shadow-glow:    0 0 60px rgba(138,99,255,0.15);
  --shadow-card:    0 8px 32px rgba(0,0,0,0.4);
  --transition:     0.25s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── Animated background ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(138,99,255,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(245,200,66,0.10) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ── */
.container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ── */
.site-header {
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6,6,16,0.8);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--purple-1), var(--purple-2));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 20px rgba(138,99,255,0.5);
}

.logo-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--purple-1), var(--gold-1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(34,217,122,0.08);
  border: 1px solid rgba(34,217,122,0.2);
  border-radius: 50px;
  font-size: 13px;
  color: var(--success);
}

.badge-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ── Hero ── */
.hero {
  padding: 64px 0 48px;
  text-align: center;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(138,99,255,0.1);
  border: 1px solid rgba(138,99,255,0.3);
  border-radius: 50px;
  font-size: 12px;
  color: var(--purple-1);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(32px, 5vw, 58px);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 20px;
}

.hero h1 .gradient-text {
  background: linear-gradient(90deg, var(--purple-1) 0%, var(--gold-1) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
}

/* ── Form Card ── */
.form-section {
  padding: 0 0 64px;
}

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  transition: border-color var(--transition);
}

.form-card:hover {
  border-color: rgba(138,99,255,0.2);
}

/* ── Step Labels ── */
.step-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.step-num {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--purple-1), var(--purple-2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-label h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.step-label p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  background: rgba(255,255,255,0.02);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--purple-1);
  background: rgba(138,99,255,0.06);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  font-size: 40px;
  margin-bottom: 16px;
  display: block;
}

.upload-zone h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.upload-zone p {
  font-size: 13px;
  color: var(--text-muted);
}

.upload-preview {
  display: none;
  position: relative;
}

.upload-preview img {
  max-height: 200px;
  border-radius: var(--radius-md);
  object-fit: cover;
  width: 100%;
}

.upload-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: rgba(255,85,102,0.9);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Form Grid ── */
.form-divider {
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

.form-group label span {
  color: var(--purple-1);
}

.form-control {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}

.form-control:focus {
  border-color: var(--purple-1);
  box-shadow: 0 0 0 3px rgba(138,99,255,0.15);
}

.form-control::placeholder {
  color: var(--text-muted);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

/* ── Number input spinner hide ── */
input[type=number]::-webkit-inner-spin-button { opacity: 1; }

/* ── Submit Button ── */
.btn-generate {
  width: 100%;
  padding: 18px 32px;
  background: linear-gradient(135deg, var(--purple-1) 0%, var(--purple-2) 50%, #5828d0 100%);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  margin-top: 32px;
}

.btn-generate::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, var(--gold-1), var(--purple-1), var(--gold-2));
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition);
}

.btn-generate:hover::before { opacity: 1; }
.btn-generate:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(138,99,255,0.45); }
.btn-generate:active { transform: translateY(0); }

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* ── Status Bar ── */
.status-bar {
  display: none;
  margin-top: 24px;
  padding: 20px 24px;
  background: rgba(138,99,255,0.08);
  border: 1px solid rgba(138,99,255,0.2);
  border-radius: var(--radius-md);
}

.status-bar.active { display: flex; align-items: center; gap: 16px; }

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(138,99,255,0.2);
  border-top-color: var(--purple-1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.status-text { flex: 1; }
.status-text strong { display: block; font-size: 14px; color: var(--text-primary); }
.status-text span   { font-size: 12px; color: var(--text-secondary); }

.status-dots span {
  display: inline-block;
  width: 5px; height: 5px;
  background: var(--purple-1);
  border-radius: 50%;
  margin: 0 2px;
  animation: bounce-dot 1.2s infinite;
}
.status-dots span:nth-child(2) { animation-delay: 0.2s; }
.status-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce-dot {
  0%,80%,100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* ── Results Section ── */
.results-section {
  padding-bottom: 80px;
  display: none;
}

.results-section.visible { display: block; }

.results-header {
  text-align: center;
  margin-bottom: 40px;
}

.results-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 10px;
}

.results-header p {
  color: var(--text-secondary);
  font-size: 15px;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .results-grid { grid-template-columns: 1fr; }
}

/* ── Result Card ── */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
}

.result-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card), 0 0 40px rgba(138,99,255,0.1);
}

.result-card-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.model-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.model-badge-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.model-badge-icon.wan     { background: linear-gradient(135deg,#3b82f6,#1d4ed8); }
.model-badge-icon.hunyuan { background: linear-gradient(135deg,#f59e0b,#b45309); }

.model-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
}

.model-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.model-status-badge {
  padding: 5px 12px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.model-status-badge.loading {
  background: rgba(138,99,255,0.15);
  color: var(--purple-1);
  border: 1px solid rgba(138,99,255,0.3);
}

.model-status-badge.done {
  background: rgba(34,217,122,0.12);
  color: var(--success);
  border: 1px solid rgba(34,217,122,0.3);
}

.model-status-badge.error {
  background: rgba(255,85,102,0.1);
  color: var(--error);
  border: 1px solid rgba(255,85,102,0.25);
}

/* ── Video Player ── */
.video-wrap {
  background: #000;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

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

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

.video-placeholder .pl-icon { font-size: 36px; }
.video-placeholder .pl-spin {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--purple-1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.video-placeholder p { font-size: 13px; }

/* ── Card Footer ── */
.result-card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
}

.btn-download {
  flex: 1;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--purple-1), var(--purple-2));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-download:hover { transform: translateY(-1px); opacity: 0.9; }
.btn-download:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-select {
  padding: 10px 16px;
  background: rgba(245,200,66,0.1);
  border: 1px solid rgba(245,200,66,0.3);
  border-radius: var(--radius-sm);
  color: var(--gold-1);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-select:hover { background: rgba(245,200,66,0.18); }
.btn-select.selected {
  background: rgba(245,200,66,0.2);
  border-color: var(--gold-1);
}

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

/* ── Prompt Display ── */
.prompt-display {
  display: none;
  margin: 24px 0 0;
  padding: 16px 20px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.prompt-display.visible { display: block; }
.prompt-display h4 { font-size: 12px; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.prompt-display p { font-size: 13px; color: var(--text-secondary); font-style: italic; }

/* ── Error Alert ── */
.alert-error {
  display: none;
  padding: 16px 20px;
  background: rgba(255,85,102,0.08);
  border: 1px solid rgba(255,85,102,0.25);
  border-radius: var(--radius-md);
  color: var(--error);
  font-size: 14px;
  margin-top: 16px;
  gap: 10px;
  align-items: flex-start;
}

.alert-error.visible { display: flex; }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.site-footer a { color: var(--purple-1); text-decoration: none; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .form-card    { padding: 24px 20px; }
  .hero         { padding: 40px 0 32px; }
  .hero h1      { font-size: 28px; }
  .header-badge { display: none; }
}
