/* ============================================================
   PAVEL CC — index.css
   Design system: variables, reset, base layout, utilities.
   Single fixed dark theme (Telegram Night Blue).
   ============================================================ */

:root {
  --bg-primary:   #17212b;
  --bg-secondary: #0e1621;
  --bg-surface:   #1c2836;
  --bg-hover:     #1e2c3a;
  --bg-active:    #3d7ab8;
  --bg-input:     #242f3d;

  --text-primary:   #f5f5f5;
  --text-secondary: #708499;
  --text-tertiary:  #546778;
  --text-link:      #3d7ab8;

  --accent:        #3d7ab8;
  --accent-hover:  #4888c9;
  --accent-active: #2f6296;
  --accent-muted:  rgba(61, 122, 184, 0.16);

  --grad-hero: linear-gradient(160deg, #2f86d6 0%, #2b6fb5 55%, #255f9c 100%);
  --hero-on: #ffffff;

  --border-primary:   rgba(255, 255, 255, 0.08);
  --border-secondary: rgba(255, 255, 255, 0.05);

  --success: #4fae4e;
  --warning: #8b97a5;
  --danger:  #e06055;

  /* ── Semantic aliases — single source of truth ──
     Several components were authored against short token names that were
     never defined (so they silently fell back to invalid values and made
     those pages — FAQ, admin panel, captcha — look off-theme). These map
     them onto the canonical tokens so every page shares one palette. */
  --fg:         var(--text-primary);
  --fg-muted:   var(--text-secondary);
  --text-muted: var(--text-tertiary);
  --border:     var(--border-primary);

  --font-sans: 'Roboto', 'Roboto Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'Roboto Mono', 'Roboto Mono Fallback', 'SF Mono', Menlo, Monaco, monospace;
}

/* ── Metric-matched local fallbacks ──
   These synthesize a "Roboto Fallback" face from the platform system font
   (or Arial), but with size/ascent/descent/line-gap scaled to match
   Roboto's metrics. The browser only uses these when the real Roboto
   hasn't loaded yet — and because the metrics are matched, the swap
   from fallback → real Roboto causes zero visible reflow. Same trick
   for Roboto Mono → SF Mono / Menlo. */
@font-face {
  font-family: 'Roboto Fallback';
  src: local('Arial'), local('Helvetica');
  size-adjust: 100%;
  ascent-override: 92%;
  descent-override: 24%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Roboto Mono Fallback';
  src: local('SF Mono'), local('Menlo'), local('Monaco');
  size-adjust: 100%;
  ascent-override: 88%;
  descent-override: 22%;
  line-gap-override: 0%;
}

:root {
  --radius-btn: 8px;
  --radius-card: 12px;
  --radius-modal: 14px;
  --radius-pill: 999px;
  --radius: var(--radius-card);   /* alias used by some components */

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  --sidebar-w: 260px;
  --sidebar-w-collapsed: 64px;

  --shadow-card:  none;
  --shadow-modal: 0 8px 40px rgba(0, 0, 0, 0.5);

  --scroll-thumb: rgba(255, 255, 255, 0.12);
  --scroll-thumb-hover: rgba(255, 255, 255, 0.2);

  /* ── Motion system — one shared vocabulary for every animation ──
     --t            micro-interactions (hover, press, color shifts)
     --ease-standard the canonical entrance/transition curve (smooth decelerate)
     --ease-out      legacy decelerate, kept as an alias of the standard feel
     --ease-spring   playful overshoot, reserved for toasts / mascot accents
     --dur-1/2/3     fast / base / slow durations */
  --t: 0.15s ease;
  --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out:    cubic-bezier(0.0, 0.0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-1: 0.15s;
  --dur-2: 0.25s;
  --dur-3: 0.4s;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-secondary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg-secondary);
}
@media (min-width: 481px) {
  .app-shell { border-left: 1px solid var(--border-primary); border-right: 1px solid var(--border-primary); }
}
/* Auth mode — burst free of the narrow shell */
body.auth-mode .app-shell {
  max-width: none;
  border: none;
  background: none;
  height: auto;
  overflow: visible;
}
body.auth-mode .main-content {
  overflow: visible;
  background: none;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-secondary);
  overflow: hidden;
}

.main-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  height: 56px;
  padding: 0 var(--sp-6);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-primary);
  flex-shrink: 0;
}

.main-header h1, .main-header .page-title { font-size: 17px; font-weight: 700; }

.main-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  padding: var(--sp-6);
  animation: pageIn 0.2s var(--ease-out) both;
}
.main-body--hero { padding: 0; }
.main-body--hero .main-body__inner { padding: var(--sp-5); }

body.auth-mode .tabbar { display: none !important; }

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  color: var(--text-secondary);
}

@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut  { from { opacity: 1; } to { opacity: 0; } }
@keyframes scaleIn  { from { opacity: 0; transform: scale(0.97) translateY(4px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pageIn   { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes authFormIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes orbFloat1 { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(40px,-30px) scale(1.08); } 66% { transform: translate(-20px,20px) scale(0.95); } }
@keyframes orbFloat2 { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(-50px,30px) scale(1.06); } 66% { transform: translate(30px,-40px) scale(0.97); } }
@keyframes orbFloat3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(20px,50px) scale(1.04); } }
@keyframes particleDrift { 0% { opacity:0; transform: translateY(0) scale(0); } 10% { opacity:1; } 90% { opacity:0.6; } 100% { opacity:0; transform: translateY(-120px) scale(1.2); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media (max-width: 1024px) { .main-body { padding: var(--sp-4); } }
@media (max-width: 768px) { .main-header { padding: 0 var(--sp-4); height: 52px; } .main-body { padding: var(--sp-3); } }
@media (max-width: 480px) { body { font-size: 13px; } .main-body { padding: var(--sp-2); } }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.sidebar { display: none; }
body.auth-mode .sidebar { display: none !important; }

@media (min-width: 900px) {
  .app-shell { max-width: none; flex-direction: row; }
  /* overflow-y auto lets a tall menu scroll to its end; overflow-x hidden
     still clips the labels during the collapse width transition. */
  .sidebar { display: flex; transition: width 0.25s var(--ease-out); overflow-y: auto; overflow-x: hidden; }
  .sidebar-collapse-btn { display: flex; }
  .tabbar { display: none; }
  .home-hero { display: none; }
  /* Full-width main column: content aligns to the sidebar on the left and the
     scrollbar reaches the right edge of the screen. */
  .main-body { width: 100%; }
  /* The hero scroll container stays full-width so the whole area between the
     sidebar and the right screen edge is scrollable (no dead side gutters);
     the 720px centering is applied to the INNER content blocks instead. */
  .main-body--hero { max-width: none; margin: 0; padding-top: var(--sp-5); }
  .main-body--hero .main-body__hero,
  .main-body--hero .main-body__inner { max-width: 720px; margin-left: auto; margin-right: auto; }
  .main-body--hero .app-hero { border-radius: var(--radius-card); overflow: hidden; }
  .main-body--hero .main-body__inner { padding-top: var(--sp-5); }
  .app-hero { padding-top: var(--sp-6); }
}
