/* =========================================================
   DUMBL — стили (современная тёмная тема)
   ========================================================= */
@font-face {
  font-family: "Rost";
  src: url("rost.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Logh";
  src: url("logh.otf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #0b0d12;
  --bg-2: #11141b;
  --panel: #161a23;
  --panel-2: #1d222e;
  --border: #262c3a;
  --text: #eef1f6;
  --muted: #8b93a7;
  --accent: #5b8cff;
  --accent-2: #6d5bff;
  --grad: linear-gradient(135deg, #5b8cff 0%, #6d5bff 100%);
  --mine: #4f7bff;
  --theirs: #1d222e;
  --danger: #ff6b6b;
  --radius: 14px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .55);
}

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

html, body { height: 100%; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(109, 91, 255, .12), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(91, 140, 255, .10), transparent 55%),
    var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

button { font-family: "Logh", system-ui, sans-serif; }

/* ===================== AUTH ===================== */
.auth-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 380px;
  max-width: 100%;
  background: rgba(22, 26, 35, .85);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 30px 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow);
  animation: pop .35s cubic-bezier(.2, .8, .2, 1);
}

@keyframes pop {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.brand {
  text-align: center;
  font-family: "Rost", system-ui, sans-serif;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 3px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-2);
  padding: 5px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 9px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  transition: .18s;
}
.tab.active { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(91, 140, 255, .35); }

/* Views / inputs */
.auth-view { display: flex; flex-direction: column; gap: 18px; }

input, textarea, .search {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  resize: vertical;
  transition: border-color .18s, box-shadow .18s;
}
input::placeholder, textarea::placeholder, .search::placeholder { color: #5d6577; }
input:focus, textarea:focus, .search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, .18);
}

button.primary {
  background: var(--grad);
  border: none;
  border-radius: 12px;
  padding: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  transition: transform .12s, box-shadow .18s, filter .18s;
  box-shadow: 0 8px 22px rgba(91, 140, 255, .30);
}
button.primary:hover { filter: brightness(1.07); box-shadow: 0 10px 26px rgba(91, 140, 255, .42); }
button.primary:active { transform: translateY(1px); }

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: .18s;
}
button.ghost:hover { color: var(--text); border-color: var(--accent); }

.error { color: var(--danger); font-size: 13px; min-height: 16px; text-align: center; }
.hint { font-size: 12px; color: var(--muted); min-height: 14px; margin-top: 0; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.slide-head { margin-bottom: -7px; }
.slide-title { font-size: 16px; font-weight: 700; }
.slide-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* Steps (registration) */
.steps { display: flex; justify-content: center; gap: 12px; margin-bottom: 4px; }
.step-dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  transition: .25s;
}
.step-dot.active {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(91, 140, 255, .4);
  transform: scale(1.06);
}

.slide { display: flex; flex-direction: column; gap: 15px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }

/* Avatar picker */
.avatar-pick {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer; padding: 6px 0;
}
.avatar-pick.center { margin: 4px 0 2px; }
.avatar-pick .link { font-size: 13px; }

/* ===================== AVATAR ===================== */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--grad);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.avatar.has-img { color: transparent; }
.avatar-lg {
  width: 92px; height: 92px; border-radius: 50%;
  background: var(--panel-2);
  color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 34px; cursor: pointer;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  border: 2px solid var(--border);
  transition: .2s;
}
.avatar-lg.has-img { color: transparent; border-color: transparent; box-shadow: 0 0 0 3px rgba(91, 140, 255, .25); }
.avatar-pick:hover .avatar-lg { border-color: var(--accent); }

/* ===================== APP LAYOUT ===================== */
.app { display: flex; height: 100vh; }

.sidebar {
  width: 320px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.me { display: flex; align-items: center; gap: 11px; min-width: 0; }
.me-text { min-width: 0; }
.me-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-username { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn {
  background: var(--bg-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 10px; width: 34px; height: 34px; cursor: pointer; font-size: 15px;
  transition: .18s;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.logout {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 10px; padding: 7px 11px; cursor: pointer; font-size: 12.5px; transition: .18s;
}
.logout:hover { color: var(--text); border-color: var(--accent); }

.search { margin: 12px 14px 0; width: auto; }

.contacts-title {
  padding: 14px 16px 8px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px; color: var(--muted);
}
.contacts { list-style: none; overflow-y: auto; flex: 1; padding-bottom: 8px; }
.contacts::-webkit-scrollbar { width: 8px; }
.contacts::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

.contact {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 16px; cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .15s;
}
.contact:hover { background: var(--panel-2); }
.contact.active { background: var(--panel-2); border-left-color: var(--accent); }
.c-body { min-width: 0; flex: 1; }
.c-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-user { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-last { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; margin-left: auto; padding-left: 8px; flex-shrink: 0; }

/* ===================== CHAT ===================== */
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--muted); text-align: center; padding: 20px;
}
.chat-active { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.chat-header {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.peer-name { font-weight: 700; font-size: 15px; }
.peer-username { font-size: 12.5px; color: var(--muted); }

.messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
  background:
    radial-gradient(700px 400px at 100% 0%, rgba(109, 91, 255, .05), transparent 60%),
    var(--bg);
}
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

.msg {
  max-width: 68%; padding: 10px 14px; border-radius: 16px;
  font-size: 14px; line-height: 1.4; word-wrap: break-word; white-space: pre-wrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  animation: msgIn .2s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.mine { align-self: flex-end; background: var(--mine); color: #fff; border-bottom-right-radius: 5px; }
.msg.theirs { align-self: flex-start; background: var(--theirs); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.msg .time { display: block; font-size: 10px; opacity: .65; margin-top: 4px; text-align: right; }

.send-form { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); background: var(--panel); }
.send-form input {
  flex: 1; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 16px; color: var(--text); outline: none; transition: .18s;
}
.send-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91, 140, 255, .18); }
.send-form button {
  background: var(--grad); border: none; border-radius: 14px; width: 48px;
  color: #fff; font-size: 18px; cursor: pointer; box-shadow: 0 8px 20px rgba(91, 140, 255, .35);
  transition: filter .15s, transform .12s;
}
.send-form button:hover { filter: brightness(1.08); }
.send-form button:active { transform: translateY(1px); }

/* ===================== MODAL ===================== */
.modal {
  position: fixed; inset: 0; background: rgba(6, 8, 12, .62);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: 20px;
  animation: fade .2s ease;
}
.modal-card {
  width: 400px; max-width: 100%;
  background: rgba(22, 26, 35, .96);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 24px;
  display: flex; flex-direction: column; gap: 13px;
  box-shadow: var(--shadow);
  max-height: 90vh; overflow-y: auto; gap: 16px;
  animation: pop .3s cubic-bezier(.2, .8, .2, 1);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { font-size: 19px; font-weight: 800; }

.link { color: var(--accent); cursor: pointer; font-size: 13px; transition: .15s; }
.link:hover { text-decoration: underline; }

/* ===== Бейджи ===== */
.name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.badges { display: inline-flex; align-items: center; gap: 3px; }
.badges img { width: 15px; height: 15px; display: block; }
.c-badges { display: inline-flex; gap: 2px; margin-left: 4px; }
.c-badges img { width: 13px; height: 13px; }

/* ===== Auth top (кнопка Назад) ===== */
.auth-top { position: relative; display: flex; align-items: center; justify-content: center; }
.back-btn { position: absolute; left: 0; padding: 6px 10px; font-size: 12.5px; }
.back-btn.hidden { display: none; }

/* ===== Настройки: макет ===== */
.settings-layout { width: 760px; max-width: 100%; padding: 0; overflow: hidden; }
.settings-body { display: flex; min-height: 420px; }
.settings-nav {
  width: 200px; flex-shrink: 0; border-right: 1px solid var(--border);
  padding: 10px; display: flex; flex-direction: column; gap: 4px; background: var(--bg-2);
}
.nav-item {
  text-align: left; border: none; background: transparent; color: var(--muted);
  padding: 11px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: background .18s, color .18s, transform .12s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(91,140,255,.3); }
.nav-item.danger { color: var(--danger); margin-top: auto; }
.nav-item.danger:hover { background: rgba(255,107,107,.12); }
.nav-item.mod { color: #ffb020; }

.settings-content { flex: 1; padding: 22px 24px; overflow-y: auto; max-height: 70vh; }
.sec { animation: secIn .28s ease; }
@keyframes secIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sec h3 { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.muted-note { color: var(--muted); font-size: 12.5px; margin-top: 10px; line-height: 1.4; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field > span { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.premium-field.locked { opacity: .55; }

.wall-prev {
  width: 120px; height: 72px; border-radius: 12px; border: 1px solid var(--border);
  background-size: cover; background-position: center; background-color: var(--panel-2);
}
input[type="color"] { width: 60px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); cursor: pointer; }

.dev-list, .mod-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.dev-list li, .mod-list li {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
}
.dev-list .dev-name { font-weight: 600; font-size: 14px; }
.dev-list .dev-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.mod-list .mod-user { font-weight: 600; }
.mod-list .mod-meta { font-size: 12.5px; color: var(--muted); margin: 4px 0 10px; white-space: pre-wrap; }
.mod-actions { display: flex; gap: 8px; }
.mod-actions button { flex: 1; padding: 8px; border-radius: 9px; border: none; cursor: pointer; font-weight: 600; font-size: 13px; }
.mod-approve { background: #1f9d57; color: #fff; }
.mod-reject { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border) !important; }
.mod-ban { background: rgba(255,77,79,.15); color: var(--danger); border: 1px solid rgba(255,77,79,.4) !important; }

.premium-status { font-size: 14px; margin-bottom: 14px; }
.premium-status.has { color: #ffcf4d; font-weight: 600; }

.lang-list { display: flex; flex-direction: column; gap: 8px; }
.lang-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
  background: var(--bg-2); transition: .18s;
}
.lang-item:hover { border-color: var(--accent); }
.lang-item.active { border-color: var(--accent); background: var(--panel-2); box-shadow: 0 0 0 2px rgba(91,140,255,.2); }
.lang-item .li-name { font-weight: 600; }
.lang-item .li-native { color: var(--muted); font-size: 12.5px; }

/* Плавности и появление */
.modal { animation: fade .2s ease; }
button, .tab, .contact, .nav-item, .lang-item, .avatar-pick .avatar-lg, .conv-item { transition: background .18s, color .18s, border-color .18s, transform .12s, box-shadow .18s; }

@keyframes chatIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.chat-active:not(.hidden) .chat-header { animation: chatIn .3s ease; }
.chat-active:not(.hidden) .messages { animation: chatIn .35s ease; }

@keyframes badgePop { 0% { transform: scale(0); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.badges img { animation: badgePop .3s ease; }

@keyframes convIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.contact { animation: convIn .22s ease; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Responsive */
@media (max-width: 720px) {
  .sidebar { width: 84px; }
  .me-text, .contacts-title, .c-body, .c-last, .search, .me-username { display: none; }
  .contact { justify-content: center; padding: 10px; }
  .sidebar-header { flex-direction: column; gap: 10px; }
  .settings-body { flex-direction: column; }
  .settings-nav { width: 100%; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .nav-item { white-space: nowrap; }
  .nav-item.danger { margin-top: 0; }
}
