/* texto.link — style.css
   Solo texto. Monospace. Minimalista. Sin emojis. */

:root {
  --ok: #44ff44;
  --warn: #ffaa00;
  --bg: #000000;
  --bg-alt: #0a0a0a;
  --bg-hover: #141414;
  --bg-input: #1a1a1a;
  --fg: #e0e0e0;
  --fg-dim: #666666;
  --fg-bright: #ffffff;
  --accent: #4488ff;
  --accent-dim: #2a5a9e;
  --danger: #ff4444;
  --success: #44ff44;
  --border: #222222;
  --radius: 4px;
  --font: 'Menlo', 'Monaco', 'Courier New', monospace;
  --font-size: 14px;
}

:root.light-mode {
  --bg: #ffffff;
  --bg-alt: #f5f5f5;
  --bg-hover: #e8e8e8;
  --bg-input: #eeeeee;
  --fg: #1a1a1a;
  --fg-dim: #888888;
  --fg-bright: #000000;
  --accent: #0066cc;
  --accent-dim: #cce0ff;
  --danger: #cc0000;
  --success: #008800;
  --border: #cccccc;
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--font-size);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Screens */
.screen {
  display: none;
  height: 100%;
  width: 100%;
}
.screen.active {
  display: flex;
}
.screen:not(#screen-app):not(#splash) {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Splash */
#splash {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.splash-logo {
  font-size: 2rem;
  font-weight: bold;
  color: var(--fg-bright);
  letter-spacing: -1px;
  margin-bottom: 8px;
}
.splash-tagline {
  font-size: 0.85rem;
  color: var(--fg-dim);
}

/* Auth screens */
.auth-container {
  width: 100%;
  max-width: 380px;
}
.auth-title {
  font-size: 1.6rem;
  font-weight: bold;
  color: var(--fg-bright);
  margin-bottom: 4px;
  text-align: center;
}
.auth-subtitle {
  font-size: 0.85rem;
  color: var(--fg-dim);
  text-align: center;
  margin-bottom: 24px;
}
.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--fg-dim);
}
.auth-switch a {
  color: var(--accent);
  text-decoration: none;
}
.auth-switch a:hover {
  text-decoration: underline;
}

/* Forms */
form input {
  width: 100%;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--font-size);
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.15s;
}
form input:focus {
  border-color: var(--accent-dim);
}
form input::placeholder {
  color: var(--fg-dim);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: var(--fg-bright);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: var(--font-size);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover {
  background: var(--accent-dim);
}
.btn-primary:active {
  background: #1a4a8e;
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-small {
  padding: 8px 12px;
  background: var(--bg-input);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: var(--font-size);
  cursor: pointer;
}
.btn-small:hover {
  background: var(--bg-hover);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--fg-dim);
  font-family: var(--font);
  font-size: var(--font-size);
  cursor: pointer;
  padding: 4px 8px;
}
.btn-icon:hover {
  color: var(--fg);
}

/* Registration steps */
.reg-step { display: none; margin: 16px 0; }
.reg-step.show { display: block; }

/* Steps indicator */
.steps { display: flex; justify-content: center; gap: 4px; margin-bottom: 20px; }
.step-dot { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; color: var(--fg-dim); }
.step-dot.active { border-color: #fff; color: #fff; background: #222; }
.step-dot.done { border-color: var(--ok); color: var(--ok); }
.step-line { width: 20px; height: 1px; background: var(--border); align-self: center; }

/* Confirm checkbox */
.confirm { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0; }
.confirm input { margin-top: 2px; accent-color: #fff; }
.confirm label { font-size: 0.7rem; color: var(--fg-dim); line-height: 1.4; }

/* Recovery key */
.recovery-key { background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; padding: 12px; font-size: 0.85rem; letter-spacing: 0.05em; color: var(--ok); text-align: center; word-break: break-all; font-weight: 600; margin: 8px 0; user-select: all; }
.recovery-note { font-size: 0.65rem; color: var(--warn); text-align: center; margin: 8px 0; }

/* Secondary button */
.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--fg-dim); margin-top: 8px; }
.step-label {
  font-size: 0.8rem;
  color: var(--fg-dim);
  margin: 12px 0 8px;
  line-height: 1.6;
}
.qr-container {
  display: flex;
  justify-content: center;
  margin: 12px 0;
  background: #fff;
  padding: 16px;
  border-radius: var(--radius);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.qr-container canvas {
  display: block;
}
.totp-secret {
  background: var(--bg-input);
  padding: 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  word-break: break-all;
  text-align: center;
  margin: 8px 0;
  color: var(--accent);
  user-select: all;
}
.recovery-key {
  background: var(--bg-input);
  padding: 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  word-break: break-all;
  text-align: center;
  margin: 8px 0;
  color: var(--success);
  user-select: all;
  border: 1px solid var(--success);
}

/* Status messages */
.status-msg {
  margin-top: 12px;
  font-size: 0.8rem;
  text-align: center;
  min-height: 20px;
}
.status-msg.error {
  color: var(--danger);
}
.status-msg.success {
  color: var(--success);
}
.status-msg.info {
  color: var(--accent);
}

/* Main app layout */
#screen-app {
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  height: 44px;
  flex-shrink: 0;
}
.app-title {
  font-weight: bold;
  color: var(--fg-bright);
}
.app-user {
  color: var(--fg-dim);
  font-size: 0.8rem;
}

.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg-alt);
}
.sidebar-search {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar-search input {
  flex: 1;
  padding: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--font);
  font-size: 0.85rem;
  outline: none;
}
.sidebar-search input:focus {
  border-color: var(--accent-dim);
}
.sidebar-search input::placeholder {
  color: var(--fg-dim);
}

.conversation-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
}
.conversation-list li {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.conversation-list li:hover {
  background: var(--bg-hover);
}
.conversation-list li.active {
  background: var(--bg-hover);
  border-left: 2px solid var(--accent);
}
.conv-name {
  color: var(--fg);
  font-size: 0.9rem;
}
.conv-preview {
  color: var(--fg-dim);
  font-size: 0.75rem;
  margin-top: 2px;
}

/* Chat area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-dim);
  font-size: 0.85rem;
}
.chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.chat-view.hidden {
  display: none;
}
.chat-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-alt);
}
.chat-header span:first-child {
  font-weight: bold;
  color: var(--fg-bright);
}
.chat-status {
  font-size: 0.75rem;
  color: var(--fg-dim);
}
.chat-status.connected {
  color: var(--success);
}
.chat-status.disconnected {
  color: var(--danger);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-messages .msg {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-messages .msg.sent {
  align-self: flex-end;
  background: var(--accent-dim);
  color: var(--fg-bright);
}
.chat-messages .msg.received {
  align-self: flex-start;
  background: var(--bg-input);
  color: var(--fg);
}
.chat-messages .msg.error {
  align-self: center;
  background: transparent;
  color: var(--danger);
  font-size: 0.8rem;
  border: none;
}
.chat-messages .msg-meta {
  font-size: 0.65rem;
  color: var(--fg-dim);
  margin-top: 2px;
}

.chat-input {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-top: 1px solid var(--border);
}
.chat-input input {
  flex: 1;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--font);
  font-size: 0.85rem;
  outline: none;
}
.chat-input input:focus {
  border-color: var(--accent-dim);
}
.chat-input input::placeholder {
  color: var(--fg-dim);
}
.btn-send {
  width: auto;
  padding: 10px 20px;
}

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

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--fg-dim);
}

/* Responsive */
@media (max-width: 600px) {
  .sidebar {
    width: 100%;
    position: absolute;
    z-index: 10;
    height: 100%;
    transition: transform 0.2s;
  }
  .sidebar.hidden-mobile {
    transform: translateX(-100%);
  }
  .chat-area {
    width: 100%;
  }
  .auth-container {
    max-width: 320px;
  }
}

/* Notification permission banner */
.notif-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  font-size: 0.8rem;
}
.theme-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 4px 8px;
  font-family: var(--font);
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: var(--radius);
}
.theme-toggle:hover {
  background: var(--bg-hover);
}


/* Back button (mobile) */
.back-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
}
@media (max-width: 600px) {
  .back-btn {
    display: block;
  }
}
