/* ============================================================
   Secure Chat — shared styles
   ============================================================ */

:root {
  --bg:            #0e1116;
  --bg-elevated:   #151a21;
  --bg-input:      #1b222c;
  --surface:       #161b22;
  --border:        #242c38;
  --border-strong: #323d4d;

  --text:          #e6edf3;
  --text-muted:    #8b98a9;
  --text-faint:    #5d6b7d;

  --accent:        #2f81f7;
  --accent-hover:  #4a94ff;
  --accent-soft:   rgba(47, 129, 247, 0.12);

  --success:       #2ea043;
  --danger:        #d93a49;
  --warning:       #d99a2b;

  --radius:        10px;
  --radius-sm:     7px;
  --shadow:        0 8px 28px rgba(0, 0, 0, 0.45);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------ forms ------------------------------ */

input, textarea, select, button { font-family: inherit; font-size: inherit; }

.field { margin-bottom: 16px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

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

.input::placeholder { color: var(--text-faint); }
.input:disabled { opacity: 0.55; cursor: not-allowed; }

select.input { cursor: pointer; }
textarea.input { resize: vertical; min-height: 72px; }

.hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-faint);
}

/* ----------------------------- buttons ----------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) { background: var(--accent-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-danger { background: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #e8505f; }

.btn-sm { padding: 6px 11px; font-size: 13px; }

/* ----------------------------- alerts ------------------------------ */

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid transparent;
}

.alert-error   { background: rgba(217, 58, 73, 0.12);  border-color: rgba(217, 58, 73, 0.3);  color: #ff8f9b; }
.alert-success { background: rgba(46, 160, 67, 0.12);  border-color: rgba(46, 160, 67, 0.3);  color: #63d67c; }
.alert-warning { background: rgba(217, 154, 43, 0.12); border-color: rgba(217, 154, 43, 0.3); color: #f0c674; }
.alert-info    { background: var(--accent-soft);       border-color: rgba(47, 129, 247, 0.3); color: #7db3ff; }

/* ----------------------------- badges ------------------------------ */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-admin    { background: rgba(217, 154, 43, 0.15); color: #f0c674; }
.badge-active   { background: rgba(46, 160, 67, 0.15);  color: #63d67c; }
.badge-inactive { background: rgba(139, 152, 169, 0.15); color: var(--text-muted); }
.badge-pending  { background: var(--accent-soft);       color: #7db3ff; }

/* ------------------------- auth card layout ------------------------ */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.auth-brand {
  text-align: center;
  margin-bottom: 26px;
}

.auth-logo {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border: 1px solid rgba(47, 129, 247, 0.28);
  border-radius: 12px;
  color: var(--accent);
}

.auth-brand h1 {
  margin: 0 0 5px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.auth-brand p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.6;
}

/* ---------------------------- utilities ---------------------------- */

.hidden { display: none !important; }
.spacer { flex: 1; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.mono { font-family: var(--mono); }

.spin {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #40506490; }

/* --------------------- password visibility toggle ------------------ */

.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 42px; }

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-faint);
  cursor: pointer;
}
.pw-toggle:hover { color: var(--text); background: var(--border); }

/* --------------------------- skeletons ----------------------------- */

@keyframes shimmer { 100% { transform: translateX(100%); } }

.sk {
  position: relative;
  overflow: hidden;
  background: var(--bg-input);
  border-radius: 6px;
}

.sk::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent);
  animation: shimmer 1.35s infinite;
}

.sk-line { height: 11px; margin-bottom: 7px; }
.sk-line.short { width: 45%; }
.sk-line.mid   { width: 68%; }
.sk-circle { border-radius: 50%; flex-shrink: 0; }

@media (prefers-reduced-motion: reduce) {
  .sk::after { animation: none; }
}

/* ----------------------------- toast ------------------------------- */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  padding: 0 14px;
  max-width: 100%;
}

.toast {
  padding: 10px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text);
  animation: toast-in .18s ease-out;
}

.toast.ok    { border-color: rgba(46,160,67,.45); }
.toast.error { border-color: rgba(217,58,73,.45); }

@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
