/* ============================================================
   ProvaGen — styles.css
   Design system: dark, editorial, minimal-sharp
   Fonts: Syne (display) + DM Sans (body)
   Palette: #0a0a0a bg / #2EE59D accent / #f5f5f5 fg
   ============================================================ */

/* ── Reset & Variables ──────────────────────────────────────── */
:root {
  --bg:          #0a0a0a;
  --bg-card:     #111111;
  --bg-card-2:   #161616;
  --bg-hover:    rgba(255,255,255,0.04);
  --fg:          #f0f0f0;
  --fg-muted:    #888;
  --fg-subtle:   #555;
  --border:      rgba(255,255,255,0.08);
  --border-hover:rgba(255,255,255,0.15);

  --accent:      #2EE59D;
  --accent-dim:  rgba(46,229,157,0.12);
  --accent-border: rgba(46,229,157,0.40);
  --accent-glow: rgba(46,229,157,0.18);

  --danger:      #ef4444;
  --danger-dim:  rgba(239,68,68,0.10);
  --danger-border: rgba(239,68,68,0.30);

  --radius-sm:   8px;
  --radius:      14px;
  --radius-lg:   20px;

  --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.2);
  --shadow-glow: 0 0 24px var(--accent-glow);

  --maxw:        1120px;
  --font-display:'Syne', system-ui, sans-serif;
  --font-body:   'DM Sans', system-ui, sans-serif;

  color-scheme: dark;
}

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

html { scroll-behavior: smooth; }

html, body {
  height: 100%;
}

body {
  font-family:  var(--font-body);
  font-size:    15px;
  line-height:  1.6;
  color:        var(--fg);
  background:
    radial-gradient(ellipse 900px 500px at 10% -5%, rgba(46,229,157,0.07), transparent 55%),
    radial-gradient(ellipse 600px 400px at 90% 5%,  rgba(46,229,157,0.04), transparent 50%),
    var(--bg);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── Utility ────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ── Header ─────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,10,0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgba(46,229,157,0.3);
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
  color: var(--fg);
}

.powered-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px;
  background: rgba(255,255,255,0.03);
}

.spark-icon { color: var(--accent); flex-shrink: 0; }

/* ── Main Layout ─────────────────────────────────────────────── */
.main-container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Progress Track ─────────────────────────────────────────── */
.progress-track {
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.progress-track::-webkit-scrollbar { display: none; }

.progress-steps {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: max-content;
  padding: 4px 0;
}

.prog-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--fg-subtle);
  font-weight: 500;
  cursor: default;
  transition: color 0.2s;
}

.prog-step span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1.5px solid var(--fg-subtle);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.prog-step b {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
}

.prog-step.active {
  color: var(--accent);
}

.prog-step.active span {
  background: var(--accent);
  border-color: var(--accent);
  color: #06130d;
}

.prog-divider {
  width: 28px;
  height: 1px;
  background: var(--border);
  margin: 0 6px;
  flex-shrink: 0;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color 0.2s;
}

.card:focus-within {
  border-color: var(--border-hover);
}

.card--highlight {
  border-color: var(--accent-border);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(46,229,157,0.03) 100%);
}

.card-header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--fg);
}

.card-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.card-subtitle {
  font-size: 12.5px;
  color: var(--fg-muted);
  margin-top: 4px;
  padding-left: 42px;
}

.card-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.step-badge {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.5px;
  color: var(--fg-muted);
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(255,255,255,0.03);
  white-space: nowrap;
}

.step-badge--accent {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

/* ── Form Fields ─────────────────────────────────────────────── */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.form-field { display: flex; flex-direction: column; gap: 6px; }

.form-field--full { grid-column: 1 / -1; }

.field-group {
  border: none;
  padding: 0;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.1px;
}

.field-hint {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.4;
  margin-top: 4px;
}

.input {
  width: 100%;
  padding: 11px 13px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder { color: var(--fg-subtle); }

.input:hover {
  border-color: var(--border-hover);
}

.input:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px rgba(46,229,157,0.10);
}

textarea.input {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

select.input {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 15px;
  padding-right: 36px;
  cursor: pointer;
}

select.input option {
  background-color: #1a1a1a;
  color: var(--fg);
}

/* ── IA Tiles (Radio Grid) ──────────────────────────────────── */
.ia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.ia-tile {
  padding: 14px 15px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  outline: none;
}

.ia-tile:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.ia-tile:focus-visible {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.ia-tile.active {
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.ia-tile-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 6px;
}

.ia-name {
  font-size: 13.5px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--fg);
}

.ia-desc {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.35;
}

/* Radio dot */
.radio-dot {
  width: 15px;
  height: 15px;
  border-radius: 999px;
  border: 1.5px solid var(--fg-subtle);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: border-color 0.15s;
}

.radio-dot::after {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.15s;
}

.ia-tile.active .radio-dot {
  border-color: var(--accent);
}

.ia-tile.active .radio-dot::after {
  background: var(--accent);
}

/* ── Toggle Switch ──────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.toggle-info { flex: 1 1 0; min-width: 0; }

.toggle-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.toggle-desc {
  display: block;
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 2px;
}

.hidden-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
  outline: none;
}

.switch:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.switch::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #ccc;
  border-radius: 999px;
  transform: translateY(-50%);
  transition: left 0.15s, background 0.15s;
}

.switch.on {
  background: var(--accent-dim);
  border-color: var(--accent-border);
}

.switch.on::after {
  left: 23px;
  background: var(--accent);
}

/* ── Dropzone ───────────────────────────────────────────────── */
.dropzone {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 18px;
  border: 1.5px dashed rgba(255,255,255,0.14);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  outline: none;
  flex-wrap: wrap;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: rgba(255,255,255,0.25);
  background: var(--bg-hover);
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: scale(1.005);
}

.dz-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.dz-text {
  flex: 1 1 0;
  min-width: 120px;
}

.dz-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.dz-hint {
  display: block;
  font-size: 12.5px;
  color: var(--fg-muted);
  margin-top: 3px;
}

.dz-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.12s, transform 0.1s, box-shadow 0.15s, background 0.12s, border-color 0.12s;
  white-space: nowrap;
  outline: none;
}

.btn:active { transform: translateY(1px); }

.btn:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

/* Primary */
.btn-primary {
  background: var(--accent);
  color: #05120c;
  box-shadow: 0 6px 20px rgba(46,229,157,0.22);
  font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 26px rgba(46,229,157,0.32);
  opacity: 0.92;
}

/* Ghost */
.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--fg);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.10);
  border-color: var(--border-hover);
}

/* Danger ghost */
.btn-danger-ghost {
  background: var(--danger-dim);
  color: #fca5a5;
  border: 1px solid var(--danger-border);
}

.btn-danger-ghost:hover:not(:disabled) {
  background: rgba(239,68,68,0.16);
}

/* Sizes */
.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 8px;
}

/* Generate CTA */
.btn-generate {
  min-width: 160px;
  height: 46px;
  border-radius: 999px;
  font-size: 15px;
  font-family: var(--font-display);
  letter-spacing: -0.2px;
}

/* Loader spinner */
.btn-loader {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #05120c;
  border-radius: 999px;
  display: inline-block;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* ── Opt Check (checkbox row) ─────────────────────────────── */
.opt-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.opt-check:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

.opt-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px; height: 1px;
}

.opt-box {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.35);
  color: #6ee7b7;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.opt-text b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
}

.opt-text span {
  display: block;
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.35;
}

/* ── Submit Row ─────────────────────────────────────────────── */
.submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.submit-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-muted);
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  white-space: nowrap;
}

/* ── Notices (status / error) ───────────────────────────────── */
.notice {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.5;
  border: 1px solid var(--accent-border);
  background: var(--accent-dim);
  color: #a7f3d0;
  margin-top: 14px;
  animation: fadeSlideIn 0.25s ease;
}

.notice--error {
  border-color: var(--danger-border);
  background: var(--danger-dim);
  color: #fca5a5;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Result Card ─────────────────────────────────────────────── */
.result-card {
  margin-top: 14px;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-frame {
  width: 100%;
  height: 540px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  display: block;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .form-field--full {
    grid-column: 1;
  }
}

@media (max-width: 640px) {
  .main-container {
    padding: 20px 14px 60px;
  }
  .card-header {
    padding: 16px 16px 14px;
  }
  .card-body {
    padding: 16px 16px 18px;
  }
  .ia-grid {
    grid-template-columns: 1fr;
  }
  .submit-row {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-generate {
    width: 100%;
    justify-content: center;
  }
  .submit-chips {
    justify-content: flex-start;
  }
  .progress-track {
    margin-bottom: 18px;
  }
  .result-actions {
    flex-wrap: wrap;
  }
  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .dropzone {
    flex-direction: column;
    align-items: flex-start;
  }
  .toggle-row {
    flex-wrap: wrap;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 0 14px;
  }
  .powered-badge span {
    display: none;
  }
  .preview-frame {
    height: 400px;
  }
}

/* ── Print styles ───────────────────────────────────────────── */
@media print {
  .header,
  .progress-track,
  .form-stack,
  .notice,
  .result-actions { display: none !important; }
  .result-card { border: none; box-shadow: none; }
}
