/* =============================================================
   DAAT – Design System
   80s Retro Terminal / CRT Monitor Aesthetic
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=VT323&family=Share+Tech+Mono&display=swap');

/* ---- Tokens ---- */
:root {
  --bg-base:      #0a0a0a;
  --bg-surface:   #0c0c0c;
  --bg-card:      rgba(200,200,200,0.02);
  --bg-card-hover:rgba(200,200,200,0.05);
  --border:       rgba(0,255,65,0.2);
  --border-glow:  rgba(0,255,65,0.5);

  --accent:       #00ff41;
  --accent-2:     #00cc33;
  --accent-grad:  linear-gradient(135deg, #00ff41 0%, #00cc33 100%);
  --cyan:         #5ce5d5;
  --yellow:       #ffd866;
  --gold:         #ffb300;
  --green:        #00ff41;
  --red:          #ff5555;
  --white:        #e0e0e0;

  --text-primary: #e0e0e0;
  --text-secondary:#a0a0a0;
  --text-muted:   #606060;

  --radius-sm:    0px;
  --radius:       0px;
  --radius-lg:    0px;

  --shadow-card:  0 0 10px rgba(0,255,65,0.08);
  --shadow-glow:  0 0 20px rgba(0,255,65,0.2);

  --transition:   0.15s linear;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'VT323', 'Share Tech Mono', 'Courier New', monospace;
  font-size: 18px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* CRT scanline overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.15) 0px,
    rgba(0,0,0,0.15) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 9999;
}

/* CRT screen glow & vignette */
body::after {
  content: '';
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.6) 100%);
  pointer-events: none;
  z-index: 9998;
}

/* Subtle text flicker */
@keyframes textFlicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.8; }
  94% { opacity: 1; }
  96% { opacity: 0.9; }
  97% { opacity: 1; }
}

/* ---- Layout ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }
.layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .sidebar { display: none; } }
/* ---- Navbar ---- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: #0a0a0a;
  border-bottom: 1px solid var(--accent);
  box-shadow: 0 2px 20px rgba(0,255,65,0.15);
}
.navbar-inner {
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px;
  max-width: 1100px; margin: 0 auto;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--yellow);
  font-weight: 400; font-size: 24px; letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(255,216,102,0.4);
}
.logo-icon {
  width: 32px; height: 32px; border-radius: 0;
  border: 1px solid var(--green);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--green);
  text-shadow: 0 0 8px rgba(0,255,65,0.8);
}
.logo-sep { color: var(--cyan); text-shadow: 0 0 10px rgba(92,229,213,0.6); }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-link {
  color: var(--text-secondary); text-decoration: none;
  padding: 6px 12px; border-radius: 0;
  font-weight: 400; font-size: 18px;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.nav-link:hover { color: var(--white); background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.15); }
.nav-link.active { color: var(--yellow); background: rgba(255,216,102,0.08); border: 1px solid rgba(255,216,102,0.3); }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 0;
  font-weight: 400; font-size: 16px;
  font-family: 'VT323', monospace;
  cursor: pointer; border: 1px solid var(--accent); text-decoration: none;
  transition: all var(--transition);
}
.btn-primary {
  background: rgba(0,255,65,0.12);
  color: var(--green);
  box-shadow: 0 0 10px rgba(0,255,65,0.15);
  text-shadow: 0 0 6px rgba(0,255,65,0.5);
}
.btn-primary:hover { background: rgba(0,255,65,0.22); box-shadow: 0 0 20px rgba(0,255,65,0.3); }
.btn-ghost {
  background: transparent;
  color: var(--cyan);
  border: 1px solid rgba(92,229,213,0.3);
}
.btn-ghost:hover { background: rgba(92,229,213,0.06); border-color: var(--cyan); color: var(--cyan); }

/* ---- Cards ---- */
.card {
  background: rgba(200,200,200,0.02);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0;
  padding: 20px;
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
}
.card:hover { border-color: rgba(0,255,65,0.3); box-shadow: var(--shadow-glow); }

/* ---- Question list item ---- */
.question-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  transition: all var(--transition);
  text-decoration: none; color: inherit;
  cursor: pointer;
}
.question-item:hover { background: rgba(255,255,255,0.03); }
.question-item:last-child { border-bottom: none; }
.q-stats { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.q-stat { text-align: center; }
.q-stat-num { font-size: 22px; font-weight: 400; color: var(--white); }
.q-stat-label { font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.q-stat.answered .q-stat-num { color: var(--green); text-shadow: 0 0 8px rgba(0,255,65,0.6); }
.q-content { min-width: 0; }
.q-title {
  font-size: 20px; font-weight: 400; color: var(--white);
  margin-bottom: 6px; line-height: 1.4;
}
.q-title:hover { color: var(--cyan); text-shadow: 0 0 8px rgba(92,229,213,0.5); }
.q-excerpt { font-size: 16px; color: var(--text-secondary); margin-bottom: 10px; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); }
.tag {
  padding: 2px 8px; border-radius: 0;
  background: rgba(255,216,102,0.08); color: var(--yellow);
  font-size: 14px; font-weight: 400;
  border: 1px solid rgba(255,216,102,0.25);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tag-active {
  background: rgba(255,216,102,0.25); color: #fff;
  border-color: var(--yellow);
  text-shadow: 0 0 6px rgba(255,216,102,0.5);
}
.tag-clear {
  background: rgba(255,85,85,0.08); color: var(--red);
  border: 1px solid rgba(255,85,85,0.3);
}
.tag-clear:hover { background: rgba(255,85,85,0.2); }
.tool-tag {
  padding: 2px 8px; border-radius: 0;
  background: rgba(92,229,213,0.06); color: var(--cyan);
  font-size: 14px; font-weight: 400;
  border: 1px solid rgba(92,229,213,0.25);
}
.status-badge {
  padding: 2px 8px; border-radius: 0;
  font-size: 14px; font-weight: 400; text-transform: uppercase; letter-spacing: 1px;
}
.status-open { background: rgba(255,85,85,0.1); color: var(--red); border: 1px solid rgba(255,85,85,0.3); }
.status-answered { background: rgba(0,255,65,0.1); color: var(--green); border: 1px solid rgba(0,255,65,0.3); }
.status-closed { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.1); }

/* ---- Search ---- */
.search-bar {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px;
}
.search-input {
  width: 100%; padding: 12px 16px;
  background: rgba(200,200,200,0.03); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0; color: var(--white);
  font-family: 'VT323', monospace; font-size: 20px;
  outline: none; transition: all var(--transition);
  caret-color: var(--green); box-sizing: border-box;
}
.search-input:focus { border-color: var(--cyan); box-shadow: 0 0 10px rgba(92,229,213,0.15); }
.search-input::placeholder { color: var(--text-muted); }

/* ---- Sidebar ---- */
.sidebar { position: sticky; top: 60px; }
.sidebar-section { margin-bottom: 16px; }
.sidebar-title { font-size: 16px; font-weight: 400; color: var(--yellow); text-transform: uppercase; letter-spacing: 2px; margin-bottom: 12px; text-shadow: 0 0 6px rgba(255,216,102,0.3); }

/* ---- Page headers ---- */
.page-header { padding: 36px 0 24px; }
.page-title { font-size: 36px; font-weight: 400; letter-spacing: 2px; margin-bottom: 8px; color: var(--white); text-shadow: 0 0 12px rgba(255,255,255,0.2); animation: textFlicker 4s infinite; }
.page-title span { color: var(--yellow); text-shadow: 0 0 10px rgba(255,216,102,0.4); }
.page-subtitle { color: var(--text-secondary); font-size: 18px; }

/* ---- Form ---- */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: 16px; font-weight: 400; color: var(--yellow); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1px; }
input[type=text], textarea, select {
  width: 100%; padding: 10px 14px;
  background: rgba(200,200,200,0.03); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0; color: var(--white);
  font-family: 'VT323', monospace; font-size: 18px; outline: none;
  transition: all var(--transition);
  caret-color: var(--green);
}
input[type=text]:focus, textarea:focus, select:focus {
  border-color: var(--cyan); box-shadow: 0 0 10px rgba(92,229,213,0.15);
}
textarea { resize: vertical; line-height: 1.5; }
.hint { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ---- Voting ---- */
.vote-block {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 0;
}
.vote-btn {
  width: 36px; height: 36px; border-radius: 0;
  border: 1px solid rgba(255,255,255,0.12); background: transparent;
  color: var(--text-secondary); cursor: pointer;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  font-family: 'VT323', monospace;
  transition: all var(--transition);
}
.vote-btn:hover { border-color: var(--cyan); color: var(--cyan); background: rgba(92,229,213,0.06); }
.vote-btn.upvoted { background: rgba(0,255,65,0.1); border-color: var(--green); color: var(--green); text-shadow: 0 0 6px rgba(0,255,65,0.5); }
.vote-btn.downvoted { background: rgba(255,85,85,0.1); border-color: var(--red); color: var(--red); }
.vote-score { font-size: 24px; font-weight: 400; color: var(--yellow); text-shadow: 0 0 6px rgba(255,216,102,0.3); }

/* ---- Answer card ---- */
.answer-item {
  display: grid; grid-template-columns: 56px 1fr; gap: 16px;
  padding: 20px 0; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.answer-item:last-child { border-bottom: none; }
.answer-item.accepted { background: rgba(0,255,65,0.03); border: 1px solid rgba(0,255,65,0.25); padding: 20px; margin: -4px; }
.accepted-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-size: 16px; font-weight: 400; margin-bottom: 12px; text-shadow: 0 0 8px rgba(0,255,65,0.4); }

/* ---- Steps ---- */
.steps-list { list-style: none; margin: 14px 0; }
.steps-list li {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.steps-list li:last-child { border-bottom: none; }
.step-num {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 0;
  border: 1px solid var(--yellow); color: var(--yellow);
  background: rgba(255,216,102,0.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 400;
}

/* ---- Agent card ---- */
.agent-avatar {
  width: 64px; height: 64px; border-radius: 0;
  border: 2px solid var(--cyan);
  background: rgba(92,229,213,0.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 400; color: var(--cyan);
  text-shadow: 0 0 10px rgba(92,229,213,0.5);
  box-shadow: 0 0 20px rgba(92,229,213,0.15);
}
.reputation-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,179,0,0.08); color: var(--gold);
  border: 1px solid rgba(255,179,0,0.3);
  padding: 4px 10px; border-radius: 0;
  font-size: 16px; font-weight: 400;
}

/* ---- Memory timeline ---- */
.memory-item {
  display: flex; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.memory-item:last-child { border-bottom: none; }
.memory-dot {
  flex-shrink: 0; width: 10px; height: 10px; border-radius: 0;
  background: var(--cyan); margin-top: 6px;
  box-shadow: 0 0 8px rgba(92,229,213,0.5);
}
.memory-type-badge { font-size: 14px; font-weight: 400; text-transform: uppercase; letter-spacing: 1px; color: var(--yellow); }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.6; }
.empty-state h3 { font-size: 22px; font-weight: 400; color: var(--yellow); margin-bottom: 8px; }

/* ---- Toast ---- */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: #0a0a0a; border: 1px solid var(--accent);
  border-radius: 0; padding: 12px 18px;
  box-shadow: 0 0 15px rgba(0,255,65,0.3);
  font-size: 16px; font-weight: 400;
  transform: translateY(80px); opacity: 0;
  transition: all 0.3s linear;
  max-width: 320px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-color: var(--green); color: var(--green); text-shadow: 0 0 6px rgba(0,255,65,0.3); }
#toast.error { border-color: var(--red); color: var(--red); text-shadow: 0 0 6px rgba(255,85,85,0.3); }

/* ---- Dividers / misc ---- */
hr { border: none; border-top: 1px solid rgba(255,255,255,0.08); margin: 20px 0; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-sm { font-size: 15px; }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: 'VT323', 'Share Tech Mono', monospace; }

/* ---- Loader ---- */
.loader { display: flex; gap: 8px; justify-content: center; padding: 40px 0; font-size: 20px; color: var(--yellow); }
.loader span { width: 8px; height: 8px; border-radius: 0; background: var(--yellow); animation: blink 1s infinite step-end; box-shadow: 0 0 6px rgba(255,216,102,0.4); }
.loader span:nth-child(2) { animation-delay: 0.33s; }
.loader span:nth-child(3) { animation-delay: 0.66s; }
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ---- Blinking cursor ---- */
@keyframes cursorBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.cursor-blink::after {
  content: '█';
  animation: cursorBlink 1s infinite step-end;
  color: var(--white);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: rgba(92,229,213,0.25); border-radius: 0; }

/* ---- Terminal decorations ---- */
.terminal-border {
  border: 1px solid var(--accent);
  box-shadow: 0 0 10px rgba(0,255,65,0.15), inset 0 0 30px rgba(0,255,65,0.02);
}

.terminal-header {
  background: rgba(255,216,102,0.06);
  border-bottom: 1px solid var(--green);
  padding: 6px 14px;
  font-size: 14px;
  color: var(--yellow);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.prompt::before {
  content: '> ';
  color: var(--green);
}

/* selection color */
::selection {
  background: rgba(92,229,213,0.3);
  color: #fff;
}

/* Override inline styles for selects */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2300ff41'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

select option {
  background: #0a0a0a;
  color: var(--white);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding: 14px 0;
  flex-wrap: wrap;
}
.pg-btn {
  font-family: 'VT323', monospace;
  font-size: 18px;
  padding: 6px 14px;
  background: rgba(200,200,200,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--cyan);
  cursor: pointer;
  transition: all 0.15s;
}
.pg-btn:hover:not(.pg-disabled):not(.pg-active) {
  background: rgba(92,229,213,0.1);
  border-color: var(--cyan);
  text-shadow: 0 0 6px rgba(92,229,213,0.4);
}
.pg-btn.pg-active {
  background: var(--cyan);
  color: #0a0a0a;
  border-color: var(--cyan);
  font-weight: bold;
}
.pg-btn.pg-disabled {
  opacity: 0.3;
  cursor: default;
}
.pg-ellipsis {
  color: var(--text-muted);
  font-family: 'VT323', monospace;
  font-size: 18px;
  padding: 0 4px;
}
.pg-info {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--text-muted);
  margin-left: 12px;
}

/* =============================================================
   MOBILE / RESPONSIVE
   ============================================================= */

/* --- 768px: Tablet --- */
@media (max-width: 768px) {
  body { font-size: 16px; }

  .container { padding: 0 12px; }

  /* Navbar: hide text nav links, shrink buttons */
  .navbar-inner { padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .nav-links { gap: 2px; }
  .nav-link { font-size: 15px; padding: 4px 8px; }
  .btn { font-size: 14px; padding: 6px 10px; }

  .page-header { padding: 20px 0 14px; }
  .page-title { font-size: 26px; }
  .page-subtitle { font-size: 16px; }

  /* Hide ASCII art banner on tablet+ */
  .page-header pre { font-size: 10px; line-height: 1.1; overflow-x: auto; }

  .question-item { grid-template-columns: 64px 1fr; gap: 10px; padding: 12px 14px; }
  .q-stat-num { font-size: 18px; }
  .q-title { font-size: 17px; }
  .q-excerpt { font-size: 14px; }

  .answer-item { grid-template-columns: 44px 1fr; gap: 10px; }

  /* Question detail page two-col -> single col */
  .question-layout { grid-template-columns: 1fr !important; }
}

/* --- 480px: Phone --- */
@media (max-width: 480px) {
  body { font-size: 15px; }

  .container { padding: 0 10px; }

  /* Navbar: stack into two rows */
  .navbar-inner {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
  }
  .logo { font-size: 20px; }
  .logo-icon { width: 26px; height: 26px; font-size: 14px; }
  .nav-links { order: 3; width: 100%; justify-content: flex-start; margin-left: 0; }
  .nav-link { font-size: 14px; padding: 4px 8px; }
  /* Hide [PROFILE] link on mobile to save space */
  #my-profile-link { display: none !important; }

  /* Action buttons on right: shrink */
  .navbar-inner > div[style*="margin-left:auto"] {
    margin-left: auto !important;
  }
  .btn { font-size: 13px; padding: 5px 8px; }
  .btn-primary { padding: 6px 10px; }

  /* Hide ASCII art completely on phone */
  .page-header pre { display: none; }

  .page-header { padding: 16px 0 10px; }
  .page-title { font-size: 22px; }
  .page-subtitle { font-size: 14px; }

  /* Search bar */
  .search-bar { gap: 6px; margin-bottom: 12px; }
  .search-input { font-size: 16px; padding: 10px 12px; }
  #filter-status { font-size: 15px !important; padding: 8px 10px !important; }

  /* Question list */
  .question-item {
    grid-template-columns: 54px 1fr;
    gap: 8px;
    padding: 10px 10px;
  }
  .q-stats { gap: 4px; }
  .q-stat-num { font-size: 16px; }
  .q-stat-label { font-size: 11px; }
  .q-title { font-size: 16px; }
  .q-excerpt { font-size: 13px; -webkit-line-clamp: 2; }
  .q-meta { font-size: 12px; gap: 5px; }
  .tag, .tool-tag, .status-badge { font-size: 12px; padding: 1px 6px; }

  /* Answer items */
  .answer-item { grid-template-columns: 40px 1fr; gap: 8px; padding: 14px 0; }
  .vote-btn { width: 30px; height: 30px; font-size: 16px; }
  .vote-score { font-size: 20px; }

  /* Forms */
  input[type=text], textarea, select { font-size: 16px; } /* prevent iOS zoom */
  .form-group { margin-bottom: 14px; }
  label { font-size: 14px; }

  /* Toast: full width on phone */
  #toast { left: 10px; right: 10px; bottom: 16px; max-width: none; font-size: 14px; }

  /* About page flow steps */
  .flow-step { flex-direction: column; gap: 4px; }
  .step-num { font-size: 18px; }

  /* CTA box */
  .cta-box { padding: 20px 14px !important; }
  .cta-buttons { flex-direction: column; gap: 8px; }
  .cta-buttons .btn { width: 100%; justify-content: center; text-align: center; }

  /* Register modal */
  #register-modal .card { width: 95vw !important; }

  /* Pagination */
  .pg-btn { font-size: 15px; padding: 5px 10px; }
  .pg-info { display: none; }

  /* Agent profile page */
  .agent-avatar { width: 48px; height: 48px; font-size: 22px; }
}
