/* ============================================================
   Prompt Board — Direction B : Founder Studio
   Linear + Raycast aesthetic. Near-black canvas, single red accent,
   calm density, ultra-light for VPS hosting.
   BASTET: replace this file without touching HTML/JS.
   ============================================================ */

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

:root {
  /* Canvas */
  --bg:        #07080a;
  --surface:   #0f1114;
  --border:    #23262d;
  --accent:    #ef4444;
  --accent-h:  #f87171;
  --text:      #f0f0f5;
  --text-mute: #7d8390;
  --success:   #22c55e;
  --danger:    #ef4444;
  --radius:    8px;
  --font:      'Inter', system-ui, -apple-system, sans-serif;
  --mono:      'JetBrains Mono', 'Fira Mono', monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
#app { display: flex; flex-direction: column; min-height: 100vh; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
header .logo { font-weight: 700; font-size: 18px; letter-spacing: -.3px; }
header .logo span { color: var(--accent); }
header .user-info { font-size: 13px; color: var(--text-mute); display: flex; align-items: center; gap: 12px; }

main { display: flex; flex: 1; overflow: hidden; }

/* Sidebar */
#sidebar {
  width: 260px;
  min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
#sidebar h2 { padding: 18px 20px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-mute); }
#sidebar .new-btn {
  margin: 0 14px 14px;
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s, transform .08s;
}
#sidebar .new-btn:hover { background: var(--accent-h); transform: translateY(-1px); }

#ad-list { flex: 1; }
.ad-item {
  padding: 10px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .12s, border-color .12s;
  font-size: 13px;
}
.ad-item:hover { background: rgba(239, 68, 68, .08); }
.ad-item.active { border-left-color: var(--accent); background: rgba(239, 68, 68, .12); }
.ad-item .ad-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-item .ad-date { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

/* Content area */
#content { flex: 1; overflow-y: auto; padding: 32px 36px; }

/* Auth panel */
#auth-panel { max-width: 380px; margin: 60px auto; }
#auth-panel h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
#auth-panel p { color: var(--text-mute); margin-bottom: 28px; }

/* Form */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--text); }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .15);
}
textarea { resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text-mute); opacity: .7; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s, opacity .15s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); }
.btn-ghost { background: transparent; color: var(--text-mute); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }

/* Generator panel */
#generator-panel h2 { font-size: 20px; font-weight: 700; margin-bottom: 20px; }

/* Outputs */
#outputs { margin-top: 32px; }
.output-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.output-block:hover { border-color: #2f333c; box-shadow: 0 4px 12px rgba(0,0,0,.35); }
.output-block .ob-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.output-block .ob-title { font-weight: 600; font-size: 14px; }
.output-block .ob-actions { display: flex; gap: 8px; }
.copy-btn {
  padding: 4px 10px;
  font-size: 12px;
  background: rgba(239, 68, 68, .12);
  color: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background .12s;
}
.copy-btn:hover { background: rgba(239, 68, 68, .24); }
.copy-btn.copied { background: rgba(34, 197, 94, .15); color: var(--success); }
.output-block pre {
  padding: 16px 18px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  overflow: auto;
  max-height: 400px;
}

/* Error / info */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-error { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .25); color: #fca5a5; }
.alert-success { background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .2); color: #86efac; }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 24px; }
.tab-btn { padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text-mute); font-size: 13px; cursor: pointer; transition: all .12s; }
.tab-btn:hover { border-color: #2f333c; color: var(--text); }
.tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Auth toggle link */
.auth-toggle { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-mute); }
.auth-toggle a { color: var(--accent); cursor: pointer; text-decoration: underline; }
.auth-toggle a:hover { color: var(--accent-h); }

/* Logout */
#logout-btn { font-size: 13px; padding: 5px 12px; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2f333c; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3c414d; }

@media (max-width: 700px) {
  main { flex-direction: column; }
  #sidebar { width: 100%; min-width: unset; border-right: none; border-bottom: 1px solid var(--border); max-height: 200px; }
  #content { padding: 20px 16px; }
}

/* ============================================================
   v2 — Guided form (RA). DA premium preserved above.
   ============================================================ */

/* Auth card */
#auth-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.auth-logo { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin-bottom: 4px; }
.auth-logo span { color: var(--accent); }
.auth-sub { color: var(--text-mute); font-size: 14px; margin-bottom: 26px; }
.auth-toggle { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-mute); }
.auth-toggle a { color: var(--accent); cursor: pointer; text-decoration: underline; }
.auth-toggle a:hover { color: var(--accent-h); }

/* Generator header */
.gen-head { margin-bottom: 24px; }
.gen-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.gen-sub { color: var(--text-mute); font-size: 14px; margin-top: 4px; }

/* Form sections */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 18px;
}
.form-section h3 {
  font-size: 15px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.sec-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 7px;
  background: rgba(239,68,68,.14); color: var(--accent);
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.sec-help { font-size: 12px; color: var(--text-mute); margin: -8px 0 14px; }
.field-help { display: block; font-size: 11px; color: var(--text-mute); margin-top: 4px; }

/* Grids & rows */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.row-2 { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.row-2 input { margin-bottom: 0; }
.row-2 .ph-label { flex-shrink: 0; text-align: center; font-weight: 600; }

/* Location cards */
.loc-card {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px;
  background: rgba(255,255,255,.015);
}
.loc-card .lc-src { margin-top: 8px; font-size: 12px; }

/* Shot cards */
.shot-card {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 14px;
  background: rgba(255,255,255,.015);
}
.shot-card h4 {
  font-size: 13px; font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px; color: var(--text);
}
.shot-card h4 input { padding: 4px 8px; font-size: 13px; }
.shot-card .btn-del { margin-left: auto; }

/* Mini buttons */
.btn-mini {
  padding: 4px 12px; font-size: 12px; font-weight: 600;
  background: transparent; color: var(--accent);
  border: 1px solid rgba(239,68,68,.35); border-radius: 7px;
  cursor: pointer; transition: background .12s;
}
.btn-mini:hover { background: rgba(239,68,68,.12); }
.btn-del {
  padding: 3px 9px; font-size: 15px; line-height: 1;
  color: var(--text-mute); border-color: var(--border); flex-shrink: 0;
}
.btn-del:hover { color: var(--danger); border-color: var(--danger); background: rgba(239,68,68,.08); }

/* Advanced details */
.adv { margin-top: 12px; }
.adv summary {
  cursor: pointer; font-size: 13px; color: var(--text-mute);
  padding: 8px 0; user-select: none;
}
.adv summary:hover { color: var(--text); }
.adv[open] summary { margin-bottom: 10px; }
.yaml-preview pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; font-family: var(--mono); font-size: 12px;
  max-height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}

/* Generate actions */
.gen-actions {
  display: flex; flex-direction: column; gap: 8px;
  margin: 26px 0 10px;
}
.btn-lg { padding: 13px 28px; font-size: 15px; justify-content: center; }

/* Detail header */
.detail-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.detail-head h2 { font-size: 20px; font-weight: 700; }
.detail-date { font-size: 12px; color: var(--text-mute); }
.detail-actions { display: flex; gap: 8px; }

/* Empty list */
.empty-list { padding: 16px 20px; color: var(--text-mute); font-size: 13px; }

@media (max-width: 700px) {
  .grid-2 { grid-template-columns: 1fr; }
  .form-section { padding: 16px; }
  .detail-head { flex-direction: column; align-items: flex-start; }
}
