/* ──────────────────────────────────────────────────────────────
   WST Prompt Registry – Global Stylesheet
   Dark mode, developer aesthetic, premium feel
   ────────────────────────────────────────────────────────────── */

/* ─── CSS Tokens ──────────────────────────────────────────────── */
:root {
  --bg-base: #0a0a0f;
  --bg-surface: #111118;
  --bg-elevated: #16161f;
  --bg-hover: #1c1c28;
  --border: rgba(255, 255, 255, 0.07);
  --border-bright: rgba(255, 255, 255, 0.14);

  --accent: #7c5cfc;
  --accent-glow: rgba(124, 92, 252, 0.25);
  --accent-soft: rgba(124, 92, 252, 0.12);
  --accent-hover: #9176ff;

  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.12);
  --blue: #3b82f6;
  --blue-soft: rgba(59, 130, 246, 0.12);
  --orange: #f59e0b;
  --orange-soft: rgba(245, 158, 11, 0.12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);

  --text-primary: #f0f0f8;
  --text-secondary: #9090a8;
  --text-muted: #5a5a72;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);

  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;

  --sidebar-w: 240px;
  --topbar-h: 64px;
  --transition: 0.18s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  display: contents;
}

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

button {
  cursor: pointer;
  font-family: var(--font);
}

input,
select,
textarea {
  font-family: var(--font);
}

/* ─── Noise Overlay ─────────────────────────────────────────────── */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  opacity: 0.3;
}

/* ─── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--accent-soft);
  border: 1px solid rgba(124, 92, 252, 0.3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  flex: 1;
}

/* Close (X) button — only visible on mobile */
.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  margin-left: auto;
}

.sidebar-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.logo-accent {
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(124, 92, 252, 0.2);
}

.nav-item svg {
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-stats {
  display: flex;
  gap: 16px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.stat-divider {
  width: 1px;
  background: var(--border);
}

/* ─── Top Bar ───────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-shell {
  min-height: 100vh;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: min(100%, 460px);
  background: linear-gradient(180deg, rgba(22, 22, 31, 0.96), rgba(10, 10, 15, 0.98));
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.auth-subtitle {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}

.auth-tab {
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}

.auth-tab.active {
  color: var(--accent);
  border-color: rgba(124, 92, 252, 0.35);
  background: var(--accent-soft);
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: block;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-submit {
  justify-content: center;
  min-height: 42px;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 90;
  height: var(--topbar-h);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
}

.sidebar-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.search-wrapper {
  flex: 1;
  max-width: 560px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 38px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 90px 0 40px;
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-shortcut {
  position: absolute;
  right: 12px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 6px;
  background: var(--bg-hover);
  border-radius: 4px;
  border: 1px solid var(--border);
  pointer-events: none;
}

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

.user-badge {
  padding: 7px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  min-width: 150px;
}

.user-badge-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-badge-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Views ─────────────────────────────────────────────────────── */
.view {
  display: none;
  padding: 28px;
  animation: fadeIn 0.2s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

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

.view-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.view-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ─── Stats Row ─────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-1px);
}

.stat-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-icon.purple {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(124, 92, 252, 0.2);
}

.stat-card-icon.blue {
  background: var(--blue-soft);
  color: var(--blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.stat-card-icon.green {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.stat-card-icon.orange {
  background: var(--orange-soft);
  color: var(--orange);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.stat-card-num {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ─── Filter Bar ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.chip {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.chip-active,
.chip.chip-active {
  background: var(--accent-soft);
  border-color: rgba(124, 92, 252, 0.4);
  color: var(--accent);
}

/* ─── Prompt Grid ───────────────────────────────────────────────── */
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.prompt-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.prompt-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  opacity: 0;
  transition: opacity var(--transition);
}

.prompt-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.prompt-card:hover::before {
  opacity: 1;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.card-version {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 100px;
  flex-shrink: 0;
  border: 1px solid rgba(124, 92, 252, 0.2);
}

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-meta-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.meta-label {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 56px;
}

.meta-value {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.card-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.tag {
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.card-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.card-action-btn {
  flex: 1;
  padding: 7px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.card-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-bright);
}

.card-action-btn.danger:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}

/* ─── Empty State ───────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.empty-icon {
  font-size: 56px;
}

.empty-state h3 {
  font-size: 20px;
  font-weight: 600;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ─── Browse List ───────────────────────────────────────────────── */
.prompt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-row {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.list-row:hover {
  border-color: var(--border-bright);
  background: var(--bg-elevated);
}

.list-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}

.list-meta {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.list-guild {
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--blue-soft);
  color: var(--blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
  white-space: nowrap;
}

.list-version {
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--accent);
  min-width: 40px;
  text-align: right;
}

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 0 var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-bright);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-back {
  font-size: 13px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  padding: 0;
}

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

/* ─── Forms ─────────────────────────────────────────────────────── */
.form-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 860px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

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

.form-group.span-2 {
  grid-column: span 2;
}

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

.required {
  color: var(--accent);
}

.optional {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 11px;
}

.form-input,
.form-select {
  width: 100%;
  height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239090a8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option {
  background: var(--bg-elevated);
}

.form-textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 13.5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  resize: vertical;
  outline: none;
  line-height: 1.7;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea.mono {
  font-family: var(--mono);
  font-size: 13px;
}

.form-textarea.mini {
  font-family: var(--mono);
  font-size: 12px;
}

.form-select.mini {
  height: 32px;
  font-size: 12px;
}

.temp-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-range {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}

.temp-display {
  min-width: 32px;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 6px;
}

.textarea-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.char-count {
  font-size: 11.5px;
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── Detail View ───────────────────────────────────────────────── */
.detail-header-actions {
  display: flex;
  gap: 8px;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.detail-name-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.detail-prompt-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.version-badge {
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(124, 92, 252, 0.3);
}

.meta-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.meta-chip {
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
}

.meta-chip.guild {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: rgba(59, 130, 246, 0.2);
}

.meta-chip.model {
  background: var(--green-soft);
  color: var(--green);
  border-color: rgba(34, 197, 94, 0.2);
}

.meta-chip.temp {
  background: var(--orange-soft);
  color: var(--orange);
  border-color: rgba(245, 158, 11, 0.2);
}

.meta-chip.tag {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-color: var(--border);
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.meta-grid-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.meta-grid-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.meta-grid-value {
  font-size: 13.5px;
  color: var(--text-secondary);
}

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

.version-selector-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
}

.prompt-body-display {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-x: auto;
}

/* Version Timeline */
.version-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity var(--transition);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-item:hover {
  opacity: 0.8;
}

.timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-family: var(--mono);
  font-weight: 700;
}

.timeline-dot.latest {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1.5px solid rgba(124, 92, 252, 0.4);
}

.timeline-dot.old {
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}

.timeline-info {
  flex: 1;
}

.timeline-version {
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--text-primary);
}

.timeline-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.timeline-changes {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
  font-style: italic;
}

/* Tests */
.test-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.test-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

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

.test-status {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.test-status.pass {
  background: var(--green-soft);
  color: var(--green);
}

.test-status.fail {
  background: var(--red-soft);
  color: var(--red);
}

.test-status.pending {
  background: var(--orange-soft);
  color: var(--orange);
}

.test-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.test-content {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-secondary);
  white-space: pre-wrap;
  border-radius: 4px;
  padding: 6px 8px;
  background: var(--bg-base);
  max-height: 80px;
  overflow-y: auto;
}

.test-run-btn {
  margin-top: 8px;
}

.empty-tests {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ─── Modals ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  transition: all var(--transition);
}

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

.modal .form-group {
  margin-bottom: 16px;
}

/* ─── Toast ─────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
  max-width: 320px;
}

.toast.success {
  border-left: 3px solid var(--green);
}

.toast.error {
  border-left: 3px solid var(--red);
}

.toast.info {
  border-left: 3px solid var(--accent);
}

/* ─── Utility ────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

.loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ─── Scrollbars ─────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }

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

/* ─── Sidebar Backdrop (mobile) ─────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease;
}

.sidebar-backdrop.visible {
  display: block;
}

@media (max-width: 768px) {

  /* Drawer — slide from left */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.7);
  }

  /* Show close button */
  .sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: flex;
  }

  .view {
    padding: 16px;
  }

  .top-bar {
    padding: 0 16px;
  }

  .top-bar-actions {
    margin-left: auto;
  }

  .user-badge {
    display: none;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group.span-2 {
    grid-column: span 1;
  }

  .form-container {
    padding: 20px;
  }

  .search-shortcut {
    display: none;
  }

  .detail-header-actions {
    flex-wrap: wrap;
  }

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

@media (max-width: 480px) {
  .auth-card {
    padding: 22px 18px;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .author-grid {
    grid-template-columns: 1fr;
  }
}

/* ─────────────────────────────────────────────────────────────────
   Authors Page
───────────────────────────────────────────────────────────────── */

/* Author card grid */
.author-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

/* Individual author card */
.author-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.author-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, var(--accent-soft), transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
}

.author-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(124, 92, 252, 0.15);
}

.author-card:hover::before {
  opacity: 1;
}

/* Avatar circle with initials */
.author-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #fff;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Large avatar in detail view */
.author-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.author-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

.author-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(124, 92, 252, 0.25);
}

.author-guilds {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.author-view-btn {
  width: 100%;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
  margin-top: 4px;
}

.author-view-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Detail panel */
.author-detail {
  animation: fadeIn 0.2s ease;
}

.author-detail-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.author-detail-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ─── Search Page ─────────────────────────────────────────────────── */

/* Panel card */
.search-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Main keyword row */
.search-main-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-field-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-field-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-field {
  width: 100%;
  height: 46px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 16px 0 42px;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-field::placeholder {
  color: var(--text-muted);
}

.search-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-go-btn {
  height: 46px;
  padding: 0 24px;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Filter sub-row */
.search-filters-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.search-filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 140px;
}

.search-filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.search-filter-input-wrap {
  position: relative;
}

.search-filter-input {
  width: 100%;
  height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px 0 30px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-filter-input::placeholder {
  color: var(--text-muted);
}

.search-filter-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.search-filter-select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a5a72' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.search-filter-select option {
  background: var(--bg-elevated);
}

/* Active filter pills */
.active-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  min-height: 0;
}

.active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(124, 92, 252, 0.3);
  animation: fadeIn 0.15s ease;
}

.active-filter-pill button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.active-filter-pill button:hover {
  opacity: 1;
}

/* Results header */
.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 2px;
}

.results-count {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.results-time {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
}

/* Results list */
.search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Result card */
.search-result-row {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.search-result-row:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
  transform: translateX(3px);
}

.srr-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.srr-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.srr-name mark {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 3px;
  padding: 0 2px;
}

.srr-usecase {
  font-size: 13px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.srr-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.srr-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

/* Idle / empty states */
.search-idle,
.search-no-results {
  text-align: center;
  padding: 64px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.search-idle-icon {
  font-size: 52px;
  filter: grayscale(0.3);
}

.search-idle p,
.search-no-results p {
  font-size: 15px;
  color: var(--text-secondary);
}

.search-suggestions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

.suggestion-label {
  font-size: 12px;
  color: var(--text-muted);
}

.suggestion-chip {
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.suggestion-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.search-spinning {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ─── Responsive Search ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .search-main-row {
    flex-direction: column;
    gap: 10px;
  }

  .search-go-btn {
    width: 100%;
    justify-content: center;
  }

  .search-filters-row {
    flex-direction: column;
  }

  .search-filter-group {
    min-width: 100%;
  }

  .search-result-row {
    grid-template-columns: 1fr;
  }

  .srr-right {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
}
