/* artelteh — часть legacy-overrides.css. Загружается под body.newui.
 * Не редактировать вручную в продакшене без согласования.
 */
/* ══════════════════════════════════════════
   POLISH — scrollbars, selection, focus, motion
   ══════════════════════════════════════════ */

body.newui ::selection {
  background: var(--accent-dim);
  color: var(--text);
}

/* Custom scrollbar (WebKit) — subtle, themed */
body.newui ::-webkit-scrollbar { width: 10px; height: 10px; }
body.newui ::-webkit-scrollbar-track { background: transparent; }
body.newui ::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 100px;
  border: 2px solid var(--bg);
}
body.newui ::-webkit-scrollbar-thumb:hover { background: var(--text3); }
body.newui { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }

/* Unified focus-visible */
body.newui *:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Tabular nums for all numeric data (dates, ids) */
body.newui .td-id,
body.newui .td-date,
body.newui .message_date,
body.newui .conversation_last_date,
body.newui .note_date {
  font-variant-numeric: tabular-nums;
}

/* Reduced motion — disable custom transitions on request */
@media (prefers-reduced-motion: reduce) {
  body.newui *,
  body.newui *::before,
  body.newui *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Active conversation highlight — clearer than hover */
body.newui .messages_conversations_list > li.active,
body.newui .messages_conversations_list > li[aria-current="true"] {
  background: var(--accent-dim) !important;
  border-left: 3px solid var(--accent);
  padding-left: 11px !important;
}

/* Consistent card hover for interactive cards */
body.newui .tile,
body.newui .inarchive,
body.newui .stat-card {
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
body.newui .tile:hover,
body.newui .inarchive:hover {
  transform: translateY(-1px);
}

/* Link underline on hover for better affordance */
body.newui .td-link:hover,
body.newui .message_author_link:hover,
body.newui a.message_author_link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Placeholder color everywhere */
body.newui input::placeholder,
body.newui textarea::placeholder {
  color: var(--text3) !important;
  opacity: 1;
}

/* Safe-area bottom padding on mobile (iOS notch) */
@media (max-width: 768px) {
  body.newui {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0)) !important;
  }

  /* Touch targets ≥44px на мобиле, кнопки крупнее */
  body.newui .topbar .icon-btn,
  body.newui .topbar .messages-link,
  body.newui .topbar .notifications-toggle,
  body.newui .topbar .topbar-user,
  body.newui .chat-back-btn,
  body.newui .icon-btn,
  body.newui .btn,
  body.newui .adm_btn,
  body.newui input[type="submit"],
  body.newui button[type="submit"] {
    min-height: 44px !important;
  }
  body.newui .topbar .icon-btn,
  body.newui .topbar .messages-link,
  body.newui .topbar .notifications-toggle {
    width: 40px !important; height: 40px !important;
    border: 1px solid var(--border) !important;
  }
  body.newui .topbar .icon-btn svg,
  body.newui .topbar .messages-link svg,
  body.newui .topbar .notifications-toggle svg {
    width: 18px !important; height: 18px !important;
  }
  body.newui .topbar {
    height: calc(56px + env(safe-area-inset-top, 0)) !important;
    padding: env(safe-area-inset-top, 0) 10px 0 !important;
    gap: 4px !important;
  }
  body.newui .topbar-spacer { flex: 1 1 auto !important; min-width: 0; }
  body.newui .topbar-logo-icon { width: 32px !important; height: 32px !important; }
  body.newui .topbar-logo-icon svg { width: 18px !important; height: 18px !important; }
  body.newui .topbar-logo-text { display: none !important; }
  body.newui .topbar-actions { margin-left: auto; }
  body.newui .topbar-actions { gap: 4px !important; }
  body.newui .topbar-user { padding: 0 !important; height: 40px !important; border: 0 !important; }
  body.newui .topbar-avatar { width: 32px !important; height: 32px !important; font-size: 12px !important; }
  body.newui .topbar-username { display: none !important; }
  /* На очень узких экранах прячем поиск (Cmd+K + поле сверху) */
  @media (max-width: 400px) {
    body.newui .topbar .search-toggle { display: none !important; }
  }

  /* Шрифты крупнее — h1, body, кнопки */
  body.newui h1 { font-size: 22px !important; }
  body.newui h2 { font-size: 18px !important; }
  body.newui .btn,
  body.newui .adm_btn,
  body.newui input[type="submit"],
  body.newui button[type="submit"] {
    font-size: 14px !important;
  }
  body.newui .btn-cta { font-size: 14px !important; padding: 10px 14px !important; }

  /* Inputs/textarea — 16px чтобы iOS не зумил */
  body.newui input[type="text"],
  body.newui input[type="email"],
  body.newui input[type="tel"],
  body.newui input[type="number"],
  body.newui input[type="password"],
  body.newui input[type="search"],
  body.newui textarea,
  body.newui select { font-size: 16px !important; }

  /* Карточки — побольше padding для тача */
  body.newui .stat-card,
  body.newui .tile,
  body.newui .service-card,
  body.newui .comment_item,
  body.newui .new-dialog-card {
    padding: 14px 16px !important;
  }
  body.newui .messages_conversations_list > li {
    padding: 14px 16px !important;
  }
  body.newui .conversation_user_name { font-size: 14px !important; }
  body.newui .conversation_preview { font-size: 13px !important; }

  /* Bottom nav крупнее */
  body.newui .bottom-nav {
    height: 64px !important;
    padding-bottom: env(safe-area-inset-bottom, 0) !important;
  }
  body.newui .bottom-nav-item {
    font-size: 11px !important; font-weight: 500 !important;
    gap: 3px !important;
    padding: 6px 0 !important;
  }
  body.newui .bottom-nav-item:not(.bottom-nav-cta) svg {
    width: 22px !important; height: 22px !important;
  }
  body.newui .bottom-nav-cta .nav-cta-circle {
    width: 46px !important; height: 46px !important;
    margin-top: -16px !important;
  }
  body.newui .bottom-nav-cta .nav-cta-circle svg {
    width: 20px !important; height: 20px !important;
  }
  body.newui .bottom-nav-cta span {
    margin-top: -2px;
  }
}
