/* v5.5 Engine — dark, power-user aesthetic */

:root {
  --bg:        #0d0b14;
  --surface:   #161322;
  --surface2:  #1e1a2e;
  --surface3:  #231d35;
  --border:    #2a2540;
  --accent:    #7c5cfc;
  --accent2:   #4a9eff;
  --gold:      #f5c842;
  --text:      #e8e4f0;
  --text-muted:#8a82a0;
  --green:     #5fd97a;
  --radius:    10px;
  --radius-lg: 16px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── NAV ───────────────────────────────────── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(13, 11, 20, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
nav .logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
nav .logo span { color: var(--accent); }
nav .nav-links { display: flex; align-items: center; gap: 28px; }
nav a { color: var(--text-muted); text-decoration: none; font-size: 0.88rem; transition: color 0.2s; }
nav a:hover { color: var(--text); }
nav .btn-nav {
  background: var(--accent);
  color: #fff !important;
  padding: 7px 18px;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.2s;
}
nav .btn-nav:hover { background: #6a4ae0; }

/* ─── MODE TOGGLE BANNER ─────────────────────── */
.mode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 100px auto 0;
  width: fit-content;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  width: 420px;
}

.mode-btn {
  padding: 9px 24px;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text-muted);
  background: transparent;
}

.mode-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 16px rgba(124, 92, 252, 0.35);
}

.mode-btn:hover:not(.active) {
  background: var(--surface2);
  color: var(--text);
}

/* ─── PAGE HEADER ──────────────────────────── */
.page-header {
  text-align: center;
  padding: 48px 24px 8px;
}

.badge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.v55-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 200, 66, 0.12);
  border: 1px solid rgba(245, 200, 66, 0.3);
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
}

.technical-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(74, 158, 255, 0.1);
  border: 1px solid rgba(74, 158, 255, 0.2);
  color: var(--accent2);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
}

.page-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #e8e4f0 0%, #7c5cfc 60%, #4a9eff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 560px;
  margin: 0 auto;
}

/* ─── MAIN LAYOUT ───────────────────────────── */
.engine-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

/* ─── LEFT PANEL ────────────────────────────── */
.left-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── SECTION CARDS ─────────────────────────── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

/* ─── MODEL PICKER ──────────────────────────── */
.model-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.model-option {
  position: relative;
  padding: 14px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.model-option:hover {
  border-color: rgba(124, 92, 252, 0.4);
  background: var(--surface3);
}

.model-option.selected {
  border-color: var(--accent);
  background: rgba(124, 92, 252, 0.1);
  box-shadow: 0 0 0 1px var(--accent);
}

.model-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.model-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-name .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent2);
  flex-shrink: 0;
}

.model-option.selected .dot {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.model-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ─── GENRE PRESETS ─────────────────────────── */
.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-btn {
  padding: 8px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover, .preset-btn.active {
  background: rgba(124, 92, 252, 0.15);
  border-color: rgba(124, 92, 252, 0.5);
  color: var(--accent);
}

/* ─── TAG SELECTOR ──────────────────────────── */
.tag-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tag-category {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tag-category-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  padding: 5px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.tag-chip:hover {
  border-color: rgba(74, 158, 255, 0.4);
  color: var(--text);
}

.tag-chip.selected {
  background: rgba(74, 158, 255, 0.12);
  border-color: rgba(74, 158, 255, 0.5);
  color: var(--accent2);
}

/* ─── CUSTOM PROMPT ─────────────────────────── */
textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 14px;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s;
  line-height: 1.6;
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
}
textarea::placeholder { color: var(--text-muted); }

/* ─── RIGHT PANEL ───────────────────────────── */
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 90px;
}

/* ─── PROMPT PREVIEW ────────────────────────── */
.preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.preview-header-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--green);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.preview-body {
  padding: 20px;
  min-height: 140px;
  background: var(--bg);
}

.preview-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.7;
}

.preview-text.has-content {
  color: var(--text);
  font-style: normal;
}

.preview-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-section {
  display: flex;
  gap: 8px;
}

.preview-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  min-width: 60px;
  padding-top: 2px;
}

.preview-section-content {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}

/* ─── OUTPUT CARD ───────────────────────────── */
.output-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.output-header-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-btn.copied {
  background: rgba(95, 217, 122, 0.12);
  border-color: rgba(95, 217, 122, 0.5);
  color: var(--green);
}

.output-body {
  padding: 20px;
  background: var(--bg);
  min-height: 120px;
}

.output-prompt {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.output-placeholder {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ─── ACTION BUTTONS ────────────────────────── */
.action-row {
  display: flex;
  gap: 10px;
}

.btn-build {
  flex: 1;
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 20px rgba(124, 92, 252, 0.25);
}
.btn-build:hover {
  background: #6a4ae0;
  box-shadow: 0 0 30px rgba(124, 92, 252, 0.45);
  transform: translateY(-1px);
}

.btn-reset {
  padding: 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-reset:hover {
  border-color: var(--accent2);
  color: var(--text);
}

/* ─── DIVIDER ───────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ─── POWER USER STRIP ──────────────────────── */
.power-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 14px 24px;
  background: rgba(245, 200, 66, 0.05);
  border: 1px solid rgba(245, 200, 66, 0.15);
  border-radius: var(--radius);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.power-strip span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text);
}

.power-strip .sep {
  color: var(--border);
  font-weight: 400;
}

/* ─── RESPONSIVE ─────────────────────────────── */
@media (max-width: 900px) {
  .engine-container {
    grid-template-columns: 1fr;
  }
  .right-panel {
    position: static;
  }
  .mode-toggle {
    width: 100%;
    max-width: 420px;
  }
}

@media (max-width: 600px) {
  nav { padding: 14px 20px; }
  nav .nav-links { gap: 16px; }
  .engine-container { padding: 20px 16px 60px; }
  .model-grid { grid-template-columns: 1fr; }
  .action-row { flex-direction: column; }
}