/* ===== ИТД THEME OVERRIDE — поверх style.css ===== */
/* Тёмная тема по умолчанию, округлые карточки, стиль как на скринах */

/* Force dark by default — добавляем dark-класс через JS при загрузке */
/* Цветовые токены для тёмной темы */
:root {
  --bg:            #111114;
  --bg-card:       #1c1c20;
  --bg-input:      #252529;
  --bg-hover:      #28282d;
  --border:        #2e2e34;
  --border-strong: #3a3a42;
  --text:          #f0f0f0;
  --text-muted:    #8e8e99;
  --text-faint:    #55555f;
  --accent:        #ffffff;
  --accent2:       #cccccc;
  --accent-fg:     #111114;
  --shadow:        0 2px 16px rgba(0,0,0,0.55);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.8);
  --glow:          0 0 0 2px rgba(255,255,255,0.08);
  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-full: 9999px;
  --nav-h: 68px;
}

/* Light тема тоже поддерживаем */
body:not(.dark) {
  --bg:            #f5f5f7;
  --bg-card:       #ffffff;
  --bg-input:      #eeeeee;
  --bg-hover:      #e8e8e8;
  --border:        #d4d4d4;
  --border-strong: #1a1a1a;
  --text:          #111114;
  --text-muted:    #666670;
  --text-faint:    #aaaaaa;
  --accent:        #111114;
  --accent2:       #333333;
  --accent-fg:     #ffffff;
}

/* === AUTH PAGE — стиль ИТД === */
#auth-screen {
  background: var(--bg) !important;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}

#auth-screen .logo {
  font-family: var(--font-display);
  font-size: 42px !important;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--text) !important;
  margin-bottom: 0;
  text-align: center;
}

.auth-tagline {
  display: none;
}

/* Новый auth-box в стиле ИТД — без box */
.auth-box {
  width: 100%;
  max-width: 360px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  overflow: visible !important;
}

/* Убираем вкладки — делаем их как заголовок */
.auth-tabs {
  display: none !important;
}

/* Заголовок формы */
.auth-form-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  margin-top: 32px;
}
.auth-form-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* Инпуты в стиле ИТД */
#auth-screen input[type="text"],
#auth-screen input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input) !important;
  border: 1.5px solid var(--border) !important;
  border-radius: var(--r-xl) !important;
  color: var(--text) !important;
  font-size: 15px !important;
  outline: none;
  margin-bottom: 2px;
}
#auth-screen input:focus {
  border-color: var(--text-muted) !important;
  box-shadow: none !important;
}
#auth-screen .form-label {
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--text) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  margin-bottom: 8px !important;
}

/* Кнопка войти — белая с чёрным текстом */
#auth-screen .btn-full {
  background: var(--text) !important;
  color: var(--bg) !important;
  border: none !important;
  border-radius: var(--r-full) !important;
  padding: 15px 20px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  width: 100% !important;
  margin-top: 8px;
  letter-spacing: 0;
}
#auth-screen .btn-full:hover { opacity: 0.9; }

/* Ссылка "создать аккаунт" */
.auth-switch-link {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
}
.auth-switch-link a,
.auth-switch-link button {
  color: #4a9eff !important;
  background: none !important;
  border: none !important;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  text-decoration: none;
}

/* "Забыли пароль?" */
.auth-forgot {
  text-align: right;
  margin-top: 6px;
  margin-bottom: 16px;
}
.auth-forgot button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

/* === TOP BAR === */
.top-bar {
  background: var(--bg) !important;
  border-bottom: 1px solid var(--border) !important;
  height: 52px;
  padding: 0 16px;
}
.top-bar .logo {
  font-size: 24px !important;
  font-weight: 800;
  letter-spacing: 2px;
}

/* === BOTTOM NAV — стиль ИТД === */
.bottom-nav {
  background: var(--bg-card) !important;
  border-top: 1px solid var(--border) !important;
  border-radius: 20px 20px 0 0;
  height: var(--nav-h) !important;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-faint) !important;
  font-size: 10px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  gap: 4px !important;
  border: none;
  background: none;
  cursor: pointer;
  padding: 8px 0;
  font-family: var(--font-body);
}
.nav-item i { font-size: 20px !important; }
.nav-item.active { color: var(--text) !important; }
.nav-item.active::after { display: none !important; }

/* Активная иконка — подсветка кружком */
.nav-item.active i,
.nav-item.active svg { filter: none; }

/* === FEED — фильтры сверху === */
.feed-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 12px;
  border: none !important;
  background: transparent;
  overflow-x: auto;
  padding: 0;
  scrollbar-width: none;
}
.feed-tabs::-webkit-scrollbar { display: none; }

.feed-tab {
  flex-shrink: 0;
  padding: 7px 16px !important;
  border-radius: var(--r-full) !important;
  border: 1.5px solid var(--border) !important;
  background: var(--bg-card) !important;
  color: var(--text-muted) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  cursor: pointer;
  white-space: nowrap;
}
.feed-tab:first-child { border-right: 1.5px solid var(--border) !important; }
.feed-tab.active {
  background: var(--text) !important;
  color: var(--bg) !important;
  border-color: var(--text) !important;
}

/* === POST CREATE BOX === */
.post-create {
  border: 1.5px solid var(--border) !important;
  border-radius: var(--r-lg) !important;
  background: var(--bg-card) !important;
  padding: 14px !important;
  margin-bottom: 16px;
}
.post-create textarea {
  border-radius: var(--r-md) !important;
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
}

/* === POST CARD === */
.post-card {
  border: 1px solid var(--border) !important;
  border-radius: var(--r-lg) !important;
  background: var(--bg-card) !important;
  margin-bottom: 12px;
  overflow: hidden;
}
.post-card:hover { transform: none !important; box-shadow: none !important; }

.post-header {
  border-bottom: 1px solid var(--border) !important;
  padding: 12px 14px !important;
}
.post-avatar {
  width: 38px !important;
  height: 38px !important;
  border-radius: 50% !important;
  border: none !important;
}

/* Реакции */
.reaction-btn {
  border-radius: var(--r-full) !important;
  border: 1.5px solid var(--border) !important;
  background: var(--bg-input) !important;
}
.reaction-btn.active {
  background: var(--text) !important;
  color: var(--bg) !important;
  border-color: transparent !important;
}

/* === NOTIFICATIONS — стиль ИТД === */
#notifications-section .section-header {
  font-size: 20px !important;
  font-weight: 800;
  font-family: var(--font-body) !important;
  letter-spacing: 0 !important;
  border-bottom: 1px solid var(--border) !important;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-item {
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 14px 0 !important;
  margin-bottom: 0 !important;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.notif-item:last-child { border-bottom: none !important; }
.notif-item.unread { border-left: none !important; }

.notif-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.notif-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 22px !important;
  flex-shrink: 0;
  position: relative;
}
/* Кружок-индикатор типа уведомления */
.notif-icon::after {
  content: '';
  position: absolute;
  bottom: 1px; right: 1px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #e53e3e;
  border: 2px solid var(--bg);
}

.notif-body { flex: 1; min-width: 0; }
.notif-text {
  font-size: 14px !important;
  line-height: 1.5 !important;
  color: var(--text) !important;
}
.notif-text strong { color: var(--text); font-weight: 700; }
.notif-time {
  font-size: 12px !important;
  color: var(--text-muted) !important;
  margin-top: 2px !important;
}

/* === PROFILE — стиль ИТД === */
.profile-hero {
  border: none !important;
  border-radius: 0 !important;
  margin-bottom: 0 !important;
}

.profile-cover-wrap {
  height: 160px !important;
  border-radius: 0 !important;
  border-bottom: none !important;
}

.profile-avatar {
  width: 80px !important;
  height: 80px !important;
  border-radius: 50% !important;
  border: 3px solid var(--bg) !important;
}

.profile-username {
  font-size: 22px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  font-family: var(--font-body) !important;
}

.profile-stats {
  display: flex;
  gap: 28px;
  margin-top: 8px;
}
.profile-stat-num {
  font-size: 18px !important;
  font-weight: 800 !important;
}
.profile-stat-label {
  font-size: 12px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

/* Кнопки профиля */
.profile-hero-actions .btn {
  border-radius: var(--r-full) !important;
  padding: 10px 22px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
}

/* Профиль tabs — посты/лайки */
.profile-posts-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.profile-posts-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: none;
  border-top: none; border-left: none; border-right: none;
}
.profile-posts-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* Bio */
.profile-bio {
  border-top: none !important;
  padding: 0 !important;
  font-size: 14px !important;
}

/* === SECTION HEADERS === */
.section-header {
  font-family: var(--font-body) !important;
  font-size: 20px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  border-bottom: 1px solid var(--border) !important;
}

/* === SETTINGS — в стиле ИТД === */
.settings-card {
  border: 1px solid var(--border) !important;
  border-radius: var(--r-lg) !important;
  overflow: hidden;
}
.settings-title {
  font-family: var(--font-body) !important;
  font-size: 16px !important;
  letter-spacing: 0 !important;
  font-weight: 700 !important;
  border-bottom: 1px solid var(--border) !important;
}
.settings-item {
  border-bottom: 1px solid var(--border) !important;
}

/* === CARDS (search, channels) === */
.user-card {
  border: 1px solid var(--border) !important;
  border-radius: var(--r-lg) !important;
}
.user-card-avatar {
  border: none !important;
  border-radius: 50% !important;
}

/* === МОДАЛЬНЫЕ ОКНА === */
.modal {
  border-radius: var(--r-xl) !important;
  border: 1px solid var(--border) !important;
}
.modal-title {
  font-family: var(--font-body) !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
}

/* === AVATAR round everywhere === */
.comment-avatar {
  border-radius: 50% !important;
  border: none !important;
}
.chat-avatar {
  border-radius: 50% !important;
  border: none !important;
}
.post-avatar {
  border-radius: 50% !important;
}

/* === QUEST CARDS === */
.quest-card {
  border-radius: var(--r-lg) !important;
  border: 1px solid var(--border) !important;
}

/* === LEADERBOARD === */
.leaderboard-row {
  border-radius: var(--r-md) !important;
}

/* === ONLINE DOT === */
.online-dot {
  background: #22c55e !important;
  border: 2px solid var(--bg-card);
}

/* === FAB кнопка создать пост === */
.fab-btn {
  position: fixed !important;
  bottom: calc(var(--nav-h) + 16px) !important;
  right: 16px !important;
  width: 52px;
  height: 52px;
  border-radius: 50% !important;
  background: var(--text) !important;
  color: var(--bg) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 300;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  z-index: 99;
}

/* === TOAST === */
.toast {
  border-radius: var(--r-full) !important;
}

/* === INPUT global === */
input[type="text"],
input[type="password"],
textarea,
select {
  border-radius: var(--r-md) !important;
  background: var(--bg-input) !important;
  border: 1.5px solid var(--border) !important;
  color: var(--text) !important;
}

/* === BUTTONS global === */
.btn {
  border-radius: var(--r-md) !important;
}
.btn-outline {
  border-radius: var(--r-md) !important;
}

/* scrollbar */
::-webkit-scrollbar { width: 0px; }

/* Уведомления — счётчик в навбаре */
.nav-badge {
  background: #e53e3e !important;
  border-radius: var(--r-full) !important;
  font-size: 10px !important;
  padding: 2px 5px !important;
}

/* Pinned bar */
.post-pinned-bar {
  border-radius: 0 !important;
}

/* Profile modal topbar */
.profile-modal-topbar {
  background: var(--bg) !important;
  border-bottom: 1px solid var(--border) !important;
}

/* Channel cards */
.channel-card {
  border-radius: var(--r-lg) !important;
  border: 1px solid var(--border) !important;
}

/* Frames */
.frame-shop-card { border-radius: var(--r-lg) !important; }
.frame-preview-wrap { border-radius: var(--r-md) !important; }

/* Admin panel */
.admin-tabs { border-radius: var(--r-lg) !important; border: 1px solid var(--border) !important; }
.admin-user-row { border-radius: var(--r-md) !important; }

/* Chat */
.chat-list { border-right: 1px solid var(--border) !important; }
.message-bubble { border-radius: var(--r-lg) !important; border: none !important; }
.message-wrap.mine .message-bubble { background: var(--text) !important; color: var(--bg) !important; }
.message-wrap.theirs .message-bubble { background: var(--bg-card) !important; }

/* ===== NOTIFICATIONS дополнительные стили === */
#notifications-section {
  padding: 16px !important;
}
#notifications-section .section-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding-bottom: 12px !important;
  margin-bottom: 0 !important;
}
.notif-read-all-btn {
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-body);
}
.notif-read-all-btn:hover { color: var(--text); }

/* Notif items с аватаром */
#notifs-list .notif-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 0 !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  background: transparent !important;
  margin: 0 !important;
}
/* Аватар в уведомлении */
#notifs-list .notif-item img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
/* Значок типа уведомления */
#notifs-list .notif-icon {
  font-size: 18px !important;
  width: 44px;
  height: 44px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== PROFILE улучшения ===== */
#profile-section {
  padding: 0 !important;
}
#profile-section .section-header { display: none !important; }

.profile-hero-body {
  padding: 0 16px 16px !important;
}

/* Посты в профиле — сетка или список */
.profile-posts-grid {
  padding: 0 16px;
}

/* ===== MORE MENU ===== */
#more-menu button:hover {
  background: var(--bg-hover) !important;
}

/* ===== AUTH форма — отступы ===== */
.auth-form.active {
  padding: 0 !important;
}
.auth-form-title {
  margin-top: 36px;
}
.auth-switch-link {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ===== FEED section отступы ===== */
#feed-section {
  padding: 12px 16px !important;
}

/* ===== ЛЕНТА top-bar — убираем лишнее на мобильном ===== */
.whats-new-btn {
  font-size: 11px;
}
.lang-switcher {
  font-size: 11px;
}

/* ===== Скролл через pull-to-refresh region ===== */
#main-content {
  -webkit-overflow-scrolling: touch;
}

/* ===== Кнопки в nav — правильные размеры ===== */
.bottom-nav .nav-item {
  min-width: 0;
  font-size: 10px;
}

/* ===== avatar preview в регистрации ===== */
#avatar-preview {
  border-radius: 50% !important;
  border: 2px solid var(--border) !important;
  margin-top: 10px;
}

/* ===== Loading skeleton ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-input) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: var(--r-md);
}
@keyframes skeleton-wave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Убираем кнопку уведомлений из топбара — она уже в нижнем баре ===== */
#topbar-notif-btn {
  display: none !important;
}

/* ===== БАГ-ФИКСЫ ===== */

/* Короткие сообщения в ЛС — не обрываются строчками */
.message-bubble {
  word-break: break-word !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  white-space: pre-wrap !important;
  min-width: 48px;
  width: fit-content !important;
  max-width: 100% !important;
}
.message-text {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
}

/* Reply preview в пузыре — кликабельная */
.msg-reply-preview {
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  margin-bottom: 6px;
  padding: 4px 8px !important;
  background: rgba(255,255,255,0.08) !important;
  border-left: 3px solid rgba(255,255,255,0.4) !important;
  font-size: 12px !important;
  color: var(--text-muted) !important;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  transition: background 0.15s;
}
.message-wrap.mine .msg-reply-preview {
  background: rgba(0,0,0,0.15) !important;
  border-left-color: rgba(0,0,0,0.4) !important;
  color: rgba(0,0,0,0.6) !important;
}
.msg-reply-preview:hover {
  background: rgba(255,255,255,0.14) !important;
}
.message-wrap.mine .msg-reply-preview:hover {
  background: rgba(0,0,0,0.22) !important;
}

/* Подсветка оригинального сообщения при клике на ответ */
@keyframes msgHighlight {
  0%   { box-shadow: 0 0 0 3px rgba(255,255,255,0.6); }
  50%  { box-shadow: 0 0 0 5px rgba(255,255,255,0.3); }
  100% { box-shadow: none; }
}
.msg-reply-highlight {
  animation: msgHighlight 2s ease !important;
}
body:not(.dark) .msg-reply-highlight {
  animation: none !important;
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-lg);
  transition: outline 0.1s;
}
