/* GhostChat — Telegram-style theme (overrides terminal.css) */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
  --bg: #0e1621;
  --bg-elev: #17212b;
  --bg-bubble-me: #2b5278;
  --bg-bubble-them: #182533;
  --fg: #f5f5f5;
  --fg-dim: #8ba3be;
  --fg-faint: #5e6e7d;
  --accent: #6ab3f2;
  --accent-strong: #3390ec;
  --danger: #e53935;
  --success: #4dcd5e;
  --grid: transparent;
  --mono: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --term: 'Roboto', system-ui, sans-serif;
  --terminal: 'Roboto', system-ui, sans-serif;
  --radius: 12px;
  --radius-bubble: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html, body {
  font-family: var(--mono);
  font-size: 15px;
  background: var(--bg);
  color: var(--fg);
}

body::before,
body::after {
  display: none !important;
}

.screen {
  padding: 0;
  gap: 0;
  background: var(--bg);
}

/* ----- Login ----- */
.tg-login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(51, 144, 236, 0.22), transparent),
    var(--bg);
}

.tg-login-card {
  width: min(420px, 100%);
  background: var(--bg-elev);
  border-radius: 16px;
  padding: 32px 28px 28px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.tg-login-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(145deg, #3390ec, #5eb3f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 20px rgba(51, 144, 236, 0.45);
}

.tg-login-card h1 {
  margin: 0 0 6px;
  text-align: center;
  font-size: 22px;
  font-weight: 500;
  color: var(--fg);
}

.tg-login-card .sub {
  text-align: center;
  color: var(--fg-dim);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.45;
}

.tg-login-card label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--fg-dim);
  margin: 14px 0 6px;
}

.tg-login-card label::before { content: none; }

.tg-login-card input {
  border-radius: 10px;
  border: 1px solid #2b3a4a;
  background: #0e1621;
  padding: 12px 14px;
  font-size: 15px;
}

.tg-login-card input:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(51, 144, 236, 0.25);
}

.tg-login-card .btn-primary {
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.tg-login-card .btn-primary:hover {
  background: #4a9ef0;
  box-shadow: 0 4px 14px rgba(51, 144, 236, 0.4);
}

.tg-login-card .btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.tg-tunnel-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(51, 144, 236, 0.12);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--accent);
}

.tg-install-banner {
  margin: 16px 0 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed #2b5278;
  background: rgba(51, 144, 236, 0.08);
  color: var(--accent);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
}

.tg-install-banner:hover { background: rgba(51, 144, 236, 0.15); }

.boot { display: none !important; }
.banner, .glitch { display: none !important; }

/* ----- Client chat app shell ----- */
.client-app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.client-app .tg-chat-pane {
  flex: 1;
  border: none;
  box-shadow: none;
}

.client-app .messages {
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2317212b' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ----- Shared Telegram header ----- */
.tg-chat-header {
  background: var(--bg-elev);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 12px;
}

.tg-chat-header .gc-avatar {
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, hsl(var(--avatar-hue, 200) 55% 45%), hsl(var(--avatar-hue, 200) 65% 35%));
  color: #fff;
  font-size: 15px;
}

.tg-chat-header .name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--fg);
}

.tg-chat-header .status {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--fg-dim);
}

.tg-chat-header .status.online { color: var(--success); }

.tg-header-icon {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0;
  text-transform: none;
  font-size: 0;
}

.tg-header-icon:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  box-shadow: none;
}

.tg-header-icon svg { width: 22px; height: 22px; }

.title-bar { display: none !important; }
.status-bar { display: none !important; }

/* ----- Bubbles ----- */
.chat-wrap {
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.bubble {
  border: none;
  border-radius: var(--radius-bubble);
  box-shadow: var(--shadow);
  padding: 8px 12px 6px;
  font-size: 15px;
}

.me .bubble {
  background: var(--bg-bubble-me);
  border-bottom-right-radius: 4px;
}

.them .bubble {
  background: var(--bg-bubble-them);
  border-bottom-left-radius: 4px;
}

.bubble-sender {
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 500;
}

.bubble-reply {
  border-left: 3px solid var(--accent-strong);
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
}

.bubble-meta {
  font-size: 11px;
  color: var(--fg-faint);
  letter-spacing: 0;
}

.bubble-meta .ticks.read { color: var(--accent); text-shadow: none; }

.bubble-actions button {
  border-radius: 8px;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  padding: 4px 10px;
}

.msg-row.system {
  color: var(--fg-dim);
  font-style: normal;
  font-size: 13px;
}

/* Reactions */
.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.msg-reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
}

.msg-reaction:hover,
.msg-reaction.mine {
  border-color: var(--accent-strong);
  background: rgba(51, 144, 236, 0.15);
}

/* ----- Composer ----- */
.composer-wrap {
  background: var(--bg-elev);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.composer {
  padding: 8px 10px;
  gap: 6px;
}

.composer .icon-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  color: var(--fg-dim);
}

.composer .icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg);
  box-shadow: none;
}

.composer textarea {
  border-radius: 22px;
  border: none;
  background: #242f3d;
  min-height: 42px;
  padding: 11px 16px;
  font-size: 15px;
}

.composer .send-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent-strong);
  color: #fff;
  font-size: 0;
  letter-spacing: 0;
}

.composer .send-btn::before {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  margin: auto;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M2.01 21L23 12 2.01 3 2 10l15 2-15 2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.composer .send-btn:hover {
  background: #4a9ef0;
  box-shadow: 0 2px 10px rgba(51, 144, 236, 0.45);
}

.composer .icon-divider { display: none; }

.burn-menu {
  border-radius: 12px;
  border: 1px solid #2b3a4a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.burn-menu button {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}

.pending-reply,
.pending-attachment {
  background: #242f3d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.search-bar {
  background: var(--bg-elev);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.search-bar input {
  border-radius: 20px;
  border: none;
  background: #242f3d;
}

.drop-overlay {
  background: rgba(14, 22, 33, 0.85);
  color: var(--accent);
  font-size: 16px;
  letter-spacing: 0;
}

/* ----- Admin 3-column layout ----- */
#main-view {
  height: 100vh;
  height: 100dvh;
  display: flex !important;
  flex-direction: column;
  gap: 0 !important;
}

.tg-layout {
  border: none;
  box-shadow: none;
  background: var(--bg);
}

.tg-nav {
  background: #0e1621;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.tg-nav .me-avatar {
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #3390ec, #5eb3f6);
  color: #fff;
  box-shadow: none;
}

.tg-nav .nav-item {
  border-radius: 12px;
}

.tg-nav .nav-item.active {
  background: rgba(51, 144, 236, 0.2);
  color: var(--accent);
  border-color: transparent;
}

.tg-list-pane {
  background: var(--bg-elev);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.tg-list-header {
  background: var(--bg-elev);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tg-list-header input {
  border-radius: 20px;
  border: none;
  background: #242f3d;
}

.tg-chat-item {
  border-bottom: none;
}

.tg-chat-item:hover { background: rgba(255, 255, 255, 0.04); }

.tg-chat-item.active {
  background: #2b5278;
  box-shadow: none;
}

.tg-chat-item .gc-avatar {
  border-radius: 50%;
  border: none;
}

.tg-chat-item .tg-online-dot {
  background: var(--success);
  border-color: var(--bg-elev);
  box-shadow: none;
}

.tg-chat-item .tg-unread-badge {
  background: var(--accent-strong);
  border-radius: 11px;
  box-shadow: none;
}

.tg-fab {
  background: var(--accent-strong);
  box-shadow: 0 4px 14px rgba(51, 144, 236, 0.45);
}

.tg-fab-menu {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #2b3a4a;
}

.tg-welcome .mark {
  font-size: 0;
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  border-radius: 50%;
  background: linear-gradient(145deg, #3390ec, #5eb3f6);
  box-shadow: 0 8px 32px rgba(51, 144, 236, 0.35);
}

.tg-welcome .mark::after {
  content: 'GC';
  font-size: 42px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-shadow: none;
}

.tg-welcome .tagline {
  color: var(--fg-dim);
  letter-spacing: 0;
  text-transform: none;
  font-size: 15px;
}

/* ----- Modals & forms ----- */
label::before { content: none !important; }

label {
  text-transform: none;
  letter-spacing: 0;
}

button, .btn {
  border-radius: 10px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

button:hover, .btn:hover { box-shadow: none; }

.modal {
  border-radius: 14px;
  border: 1px solid #2b3a4a;
  background: var(--bg-elev);
}

.modal h2 {
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg);
  border: none;
  font-size: 18px;
  font-weight: 500;
}

.modal-bg { backdrop-filter: blur(4px); }

input, textarea, select {
  border-radius: 10px;
  border: 1px solid #2b3a4a;
  background: #0e1621;
}

input:focus, textarea:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(51, 144, 236, 0.2);
}

.warn-box {
  border-radius: 10px;
  background: rgba(229, 57, 53, 0.1);
  border: 1px solid rgba(229, 57, 53, 0.3);
  color: #ff8a80;
}

.cred {
  border-radius: 10px;
  background: #242f3d;
  border: 1px solid #2b3a4a;
}

/* ----- Emoji picker ----- */
.emoji-picker {
  position: absolute;
  bottom: 56px;
  left: 8px;
  z-index: 200;
  width: min(320px, calc(100vw - 24px));
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid #2b3a4a;
  border-radius: 14px;
  padding: 10px;
  display: none;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.emoji-picker.open { display: grid; }

.emoji-picker button {
  border: none;
  background: transparent;
  font-size: 22px;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
}

.emoji-picker button:hover { background: rgba(255, 255, 255, 0.08); }

/* ----- Context menu ----- */
.tg-ctx-menu {
  position: fixed;
  z-index: 5000;
  min-width: 180px;
  background: var(--bg-elev);
  border: 1px solid #2b3a4a;
  border-radius: 12px;
  padding: 6px 0;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  display: none;
}

.tg-ctx-menu.open { display: block; }

.tg-ctx-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--fg);
  padding: 10px 16px;
  font-size: 14px;
  border-radius: 0;
}

.tg-ctx-menu button:hover {
  background: rgba(51, 144, 236, 0.15);
  color: var(--fg);
}

.tg-ctx-menu button.danger { color: var(--danger); }

.version-pill {
  border-radius: 8px;
  background: rgba(23, 33, 43, 0.9);
  border-color: #2b3a4a;
  color: var(--fg-faint);
}

.conn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: none;
  animation: none;
}

.conn-dot.offline { background: var(--fg-faint); }

@media (max-width: 600px) {
  .composer .send-btn::before { width: 18px; height: 18px; }
}
