/* ═══════════════════════════════════════
   DARKNET CHAT — Dark Hacker Theme
   ═══════════════════════════════════════ */

:root {
  --green:       #00ff41;
  --green-dim:   #00aa2b;
  --green-glow:  rgba(0, 255, 65, 0.25);
  --cyan:        #00d4ff;
  --cyan-dim:    #008faa;
  --red:         #ff003c;
  --yellow:      #ffe600;
  --bg:          #000000;
  --bg1:         #040d04;
  --bg2:         #070f07;
  --border:      rgba(0, 255, 65, 0.2);
  --border-hi:   rgba(0, 255, 65, 0.6);
  --font-mono:   'Share Tech Mono', 'Courier New', monospace;
  --font-vt:     'VT323', monospace;
}

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

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

/* ── Scanlines overlay ──────────────────── */
.scanlines {
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ── Matrix rain canvas ─────────────────── */
#matrix-rain {
  position: fixed; inset: 0;
  z-index: 0;
  opacity: 0.5;
  transition: opacity 0.8s;
}
#matrix-rain.hidden { opacity: 0; pointer-events: none; }

/* ── Screens ────────────────────────────── */
.screen {
  display: none;
  position: fixed; inset: 0;
  z-index: 10;
}
.screen.active { display: flex; }

/* ═══════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════ */
#login-screen {
  align-items: center;
  justify-content: center;
  background: transparent;
}

.login-box {
  position: relative;
  width: min(680px, 96vw);
  background: rgba(0, 8, 0, 0.92);
  border: 1px solid var(--green-dim);
  box-shadow:
    0 0 0 1px rgba(0, 255, 65, 0.05),
    0 0 40px rgba(0, 255, 65, 0.15),
    inset 0 0 40px rgba(0, 0, 0, 0.6);
  padding: 2rem 2.5rem;
  backdrop-filter: blur(4px);
}

/* Corner decorations */
.login-box::before,
.login-box::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  border-color: var(--green);
  border-style: solid;
}
.login-box::before {
  top: -1px; left: -1px;
  border-width: 2px 0 0 2px;
}
.login-box::after {
  bottom: -1px; right: -1px;
  border-width: 0 2px 2px 0;
}

.ascii-logo {
  font-family: var(--font-mono);
  font-size: clamp(5px, 1.2vw, 11px);
  line-height: 1.2;
  color: var(--green);
  text-shadow: 0 0 8px var(--green);
  white-space: pre;
  overflow: hidden;
  text-align: center;
  margin-bottom: 1.2rem;
}

.login-subtitle {
  text-align: center;
  font-size: 12px;
  color: var(--cyan-dim);
  letter-spacing: 2px;
  margin-bottom: 1rem;
}

.login-divider {
  color: var(--green-dim);
  letter-spacing: 1px;
  margin-bottom: 1rem;
  font-size: 12px;
}

/* Boot sequence */
.terminal-boot {
  background: rgba(0, 255, 65, 0.03);
  border-left: 2px solid var(--green-dim);
  padding: 0.7rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 12px;
}

.boot-line {
  color: #5a9e5a;
  margin-bottom: 3px;
}
.boot-line:last-child { color: var(--green); }
.ok { color: var(--green); font-weight: bold; }

/* Dots animation */
.dots-anim::after {
  content: '';
  animation: dots 1.5s infinite;
}
@keyframes dots {
  0%   { content: '.'; }
  33%  { content: '..'; }
  66%  { content: '...'; }
  100% { content: ''; }
}

/* Login form */
.login-form { display: flex; flex-direction: column; gap: 0.9rem; }

.input-line {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  background: rgba(0, 255, 65, 0.03);
  border: 1px solid var(--border);
  padding: 0.5rem 0.8rem;
}
.input-line:focus-within {
  border-color: var(--green-dim);
  box-shadow: 0 0 12px var(--green-glow);
}

.prompt       { color: var(--green); white-space: nowrap; }
.prompt-label { color: var(--cyan-dim); white-space: nowrap; }

.input-line input {
  flex: 1;
  min-width: 120px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 14px;
  caret-color: var(--green);
}
.input-line input::placeholder { color: #1a4a1a; }

.login-error {
  color: var(--red);
  font-size: 12px;
  min-height: 1.2em;
  letter-spacing: 1px;
}

#connect-btn {
  background: transparent;
  border: 1px solid var(--green-dim);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 0.7rem 1.5rem;
  cursor: pointer;
  letter-spacing: 3px;
  text-transform: uppercase;
  transition: all 0.2s;
  align-self: flex-start;
}
#connect-btn:hover {
  background: rgba(0, 255, 65, 0.1);
  border-color: var(--green);
  box-shadow: 0 0 20px var(--green-glow);
  text-shadow: 0 0 10px var(--green);
}
#connect-btn:active { transform: scale(0.98); }

.btn-bracket { color: var(--cyan); }

/* ═══════════════════════════════════════
   CHAT SCREEN
   ═══════════════════════════════════════ */
#chat-screen {
  flex-direction: column;
  background: var(--bg1);
}

.chat-wrap {
  display: flex;
  flex-direction: column;
  width: 100%; height: 100%;
}

/* ── Header ─────────────────────────────── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.2rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-logo {
  font-family: var(--font-vt);
  font-size: 22px;
  color: var(--green);
  text-shadow: 0 0 12px var(--green);
  letter-spacing: 4px;
}

.header-sep { color: var(--green-dim); }

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 11px;
  color: var(--green-dim);
  letter-spacing: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-tag {
  font-size: 13px;
  color: var(--cyan);
  letter-spacing: 1px;
}

.btn-exit {
  background: transparent;
  border: 1px solid rgba(255, 0, 60, 0.4);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.2s;
}
.btn-exit:hover {
  background: rgba(255, 0, 60, 0.15);
  border-color: var(--red);
  box-shadow: 0 0 10px rgba(255, 0, 60, 0.3);
}

/* ── Ticker ──────────────────────────────── */
.ticker {
  background: rgba(0, 255, 65, 0.05);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  padding: 3px 0;
  flex-shrink: 0;
}

.ticker-text {
  display: inline-block;
  white-space: nowrap;
  font-size: 10px;
  color: #1a5a1a;
  letter-spacing: 2px;
  animation: ticker-scroll 40s linear infinite;
}
@keyframes ticker-scroll {
  from { transform: translateX(100vw); }
  to   { transform: translateX(-100%); }
}

/* ── Messages area ───────────────────────── */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
.messages-area::-webkit-scrollbar { width: 4px; }
.messages-area::-webkit-scrollbar-track { background: transparent; }
.messages-area::-webkit-scrollbar-thumb {
  background: var(--green-dim);
  border-radius: 2px;
}

/* System messages */
.system-msg {
  text-align: center;
  color: #1a5a1a;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 0.5rem 0;
  border-top: 1px dashed rgba(0, 255, 65, 0.1);
  border-bottom: 1px dashed rgba(0, 255, 65, 0.1);
  margin: 0.3rem 0;
}

.system-msg.join  { color: #2a6a2a; }
.system-msg.leave { color: #5a1a1a; }

/* Message rows */
.msg-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 14px;
  line-height: 1.6;
  animation: msg-in 0.15s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

.msg-time {
  color: #1a4a1a;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

.msg-author {
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: bold;
}
.msg-author.self  { color: var(--cyan); }
.msg-author.other { color: var(--green); }

.msg-sep {
  color: var(--green-dim);
  flex-shrink: 0;
}

.msg-text {
  color: #c8ffc8;
  word-break: break-word;
  flex: 1;
}

/* Self message highlight */
.msg-row.self .msg-text { color: #b0e8ff; }

/* ── Input area ──────────────────────────── */
.input-area {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.2rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.input-area .prompt {
  color: var(--green-dim);
  white-space: nowrap;
  font-size: 13px;
  flex-shrink: 0;
}

#message-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 14px;
  caret-color: var(--green);
}
#message-input::placeholder { color: #1a3a1a; }

#send-btn {
  background: transparent;
  border: 1px solid var(--green-dim);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.2s;
  flex-shrink: 0;
}
#send-btn:hover {
  background: rgba(0, 255, 65, 0.1);
  border-color: var(--green);
  box-shadow: 0 0 12px var(--green-glow);
}
#send-btn:active { transform: scale(0.97); }

/* ── Shared utils ────────────────────────── */
.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  vertical-align: middle;
}
.dot.green  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.red    { background: var(--red);   box-shadow: 0 0 6px var(--red); }
.dot.yellow { background: var(--yellow);box-shadow: 0 0 6px var(--yellow); }

.blink { animation: blink 1.2s step-end infinite; }
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.15; }
}

.dim { color: var(--green-dim); }

/* ── Responsive ──────────────────────────── */
@media (max-width: 600px) {
  .ascii-logo { font-size: 4px; }
  .chat-header { padding: 0.5rem 0.8rem; }
  .header-logo { font-size: 16px; }
  .messages-area { padding: 0.8rem; }
  .input-area { padding: 0.6rem 0.8rem; }
  .input-area .prompt { display: none; }
}
