/* ==========================================================================
   DESIGN SYSTEM — LINEAR / MODERN
   Cinematic dark mode. Layered ambient lighting. Precision micro-interactions.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* --------------------------------------------------------------------------
   DESIGN TOKENS — Sleek Dark Mode & Precision Visual Systems
   -------------------------------------------------------------------------- */
:root {
  /* ── Color: Minimalist Deep Dark ── */
  --bg-deep:            #09090b;
  --bg-primary:         #09090b;
  --bg-elevated:        #121215;
  --bg-surface:         #18181b;
  --bg-surface-hover:   #27272a;
  --bg-glass:           rgba(9, 9, 11, 0.85);
  --bg-glass-card:      rgba(24, 24, 27, 0.75);
  --bg-input:           #141417;
  --bg-surface-elevated:#202024;

  /* ── Accent: Electric Indigo / Sapphire ── */
  --primary:        #2563eb;
  --primary-hover:  #1d4ed8;
  --primary-glow:   rgba(37, 99, 235, 0.20);
  --primary-subtle: rgba(37, 99, 235, 0.10);

  /* ── Brand Accents ── */
  --telegram-blue:      #0088cc;
  --telegram-blue-hover:#0077b5;
  --telegram-glow:      rgba(0, 136, 204, 0.20);
  --accent-cyan:        #06b6d4;
  --accent-cyan-glow:   rgba(6, 182, 212, 0.20);

  /* ── Semantic Colors ── */
  --success:      #10b981;
  --success-glow: rgba(16, 185, 129, 0.18);
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --danger-glow:  rgba(239, 68, 68, 0.18);

  /* ── Text High Contrast Palette ── */
  --text-primary:   #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --text-inverse:   #09090b;

  /* ── Borders & Outlines ── */
  --border-subtle:  rgba(255, 255, 255, 0.07);
  --border-strong:  rgba(255, 255, 255, 0.12);
  --border-hover:   rgba(255, 255, 255, 0.22);
  --border-accent:  rgba(37, 99, 235, 0.45);
  --border-glow:    rgba(37, 99, 235, 0.60);

  /* ── Shadows ── */
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--border-subtle);
  --shadow-md:  0 4px 16px -2px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-strong);
  --shadow-lg:  0 12px 32px -4px rgba(0, 0, 0, 0.70), 0 0 0 1px var(--border-strong);
  --shadow-card-hover: 0 20px 40px -8px rgba(0, 0, 0, 0.80), 0 0 0 1px var(--border-hover);
  --shadow-accent:     0 0 0 1px var(--primary);
  --shadow-glow:       0 0 20px var(--primary-glow);
  --shadow-tg:         0 0 0 1px var(--telegram-blue);

  /* ── Typography Scale ── */
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:    'JetBrains Mono', 'Consolas', monospace;

  /* ── Radius Scale ── */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-2xl:  24px;
  --radius-full: 9999px;

  /* ── Easing & Motion ── */
  --ease-expo:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out:    cubic-bezier(0.0, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* ── Transitions ── */
  --transition-fast:   0.15s var(--ease-out);
  --transition-normal: 0.25s var(--ease-expo);
  --transition-smooth: 0.4s var(--ease-spring);

  /* ── Layout Sizes ── */
  --sidebar-width: 270px;
  --header-height: 64px;
  --mobile-nav-height: 64px;
}

/* ── Focus Visible Accessibility Outline ── */
*:focus-visible {
  outline: 2px solid var(--primary) !important;
  outline-offset: 2px !important;
}

/* --------------------------------------------------------------------------
   RESET
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
  outline: none;
}

input, select, textarea {
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
}

/* --------------------------------------------------------------------------
   BACKGROUND SYSTEM
   -------------------------------------------------------------------------- */

body {
  background: var(--bg-deep);
}

/* Removed generic AI radial blobs. Minimalist background instead. */

/* --------------------------------------------------------------------------
   SCROLLBAR
   -------------------------------------------------------------------------- */
::-webkit-scrollbar          { width: 5px; height: 5px; }
::-webkit-scrollbar-track    { background: var(--bg-deep); }
::-webkit-scrollbar-thumb    { background: rgba(255, 255, 255, 0.15); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.30); }

/* --------------------------------------------------------------------------
   GLASS CARD BASE / MINIMAL CARD
   -------------------------------------------------------------------------- */
.glass-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.glass-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   BUTTON SYSTEM
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

/* Shine sweep pseudo-element */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.05) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.5s var(--ease-expo);
}
.btn:hover::after {
  transform: translateX(100%);
}

/* Active press-down */
.btn:active {
  transform: scale(0.98) !important;
}

/* ── Primary ── */
.btn-primary { 
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); 
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  text-shadow: none;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.55);
  transform: translateY(-1px);
}

/* ── Telegram ── */
.btn-telegram {
  background: var(--telegram-blue);
  color: var(--text-primary);
  box-shadow: var(--shadow-tg);
}
.btn-telegram:hover {
  background: var(--telegram-blue-hover);
  box-shadow: 0 0 0 1px rgba(0,136,204,0.40), 0 6px 22px rgba(0,136,204,0.40);
  transform: translateY(-2px);
}

/* ── Outline ── */
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.btn-outline:hover {
  background: var(--bg-surface);
  border-color: var(--border-hover);
}

/* ── Ghost ── */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* ── Google ── */
.btn-google {
  background: #fff;
  color: #1f2937;
  border: 1px solid rgba(255, 255, 255, 0.10);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.btn-google:hover {
  background: #f8fafc;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

/* ── Sizes ── */
.btn-sm   { padding: 5px 12px; font-size: 0.80rem; border-radius: var(--radius-sm); }
.btn-lg   { padding: 12px 26px; font-size: 1.02rem; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }

/* --------------------------------------------------------------------------
   BADGES
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  font-size: 0.70rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
}
.badge-primary { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.30); }
.badge-telegram { background: rgba(0,136,204,0.15); color: #38bdf8; border: 1px solid rgba(0,136,204,0.28); }
.badge-success  { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.28); }
.badge-warning  { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.28); }
.badge-danger   { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.28); }

/* --------------------------------------------------------------------------
   FORM CONTROLS
   -------------------------------------------------------------------------- */
.form-group  { margin-bottom: 18px; }
.form-label  {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.90rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { min-height: 100px; resize: vertical; }

/* --------------------------------------------------------------------------
   PULSE DOT
   -------------------------------------------------------------------------- */
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(16,185,129,0.6);
  animation: pulse-ring 2.2s infinite cubic-bezier(0.45,0,0.2,1);
  display: inline-block;
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0   rgba(16,185,129,0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0   rgba(16,185,129,0); }
}

/* --------------------------------------------------------------------------
   TOAST
   -------------------------------------------------------------------------- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  background: rgba(12,12,16,0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(14px);
  opacity: 0;
  animation: toast-in 0.3s var(--ease-expo) forwards;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-info    { border-left: 3px solid var(--primary); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-error   { border-left: 3px solid var(--danger); }

@keyframes toast-in {
  to { transform: translateY(0); opacity: 1; }
}

/* --------------------------------------------------------------------------
   REDUCED MOTION FALLBACK
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   ANTI-AUTOFILL MASKED SECRET INPUTS
   Masks characters visually without triggering browser password save prompts
   -------------------------------------------------------------------------- */
.masked-secret-input,
input.masked-secret-input {
  -webkit-text-security: disc !important;
  text-security: disc !important;
  letter-spacing: 0.15em;
}

.masked-secret-input.unmasked,
input.masked-secret-input.unmasked {
  -webkit-text-security: none !important;
  text-security: none !important;
  letter-spacing: normal;
}


@media (max-width: 768px) { .admin-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; display: block; width: 100%; } table { width: 100%; min-width: 600px; } }
