/*
 * VOID Dashboard — Components Library
 * Source: panel.void.ltd/ref
 *
 * Requires: variables.css
 * Fonts: https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap
 */

/* ─────────────────────────────────────
   RESET & BASE
───────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition-fast), color var(--transition-fast);
}

/* ─────────────────────────────────────
   LAYOUT
───────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

/* Main area */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

/* Content */
.content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─────────────────────────────────────
   NAVIGATION (Sidebar)
───────────────────────────────────── */
.nav-logo {
  padding: 18px 16px 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  border-bottom: 1px solid var(--border-color);
}

.nav-section {
  padding: 12px 8px 4px;
}

.nav-section-label {
  padding: 0 8px 6px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent-light);
}

.nav-item .nav-icon {
  width: 16px;
  height: 16px;
  opacity: 0.75;
  flex-shrink: 0;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

/* User box (bottom of sidebar) */
.user-box {
  margin-top: auto;
  padding: 12px 8px;
  border-top: 1px solid var(--border-color);
}

.user-box-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.user-box-inner:hover {
  background: var(--bg-card-hover);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─────────────────────────────────────
   TYPOGRAPHY
───────────────────────────────────── */
.page-title {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.15px;
}

.card-label {
  font-size: 11.7px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.585px;
  color: var(--text-secondary);
}

.value-hero {
  font-size: 30.75px;
  font-weight: 750;
  color: var(--money);
  letter-spacing: -0.615px;
  line-height: 1.1;
}

.value-large {
  font-size: 21.75px;
  font-weight: 750;
  color: var(--text-primary);
  letter-spacing: -0.22px;
}

.value-mono {
  font-family: var(--font-mono);
  font-size: 12.75px;
  font-weight: 400;
  color: var(--text-primary);
}

.text-sm    { font-size: 12px; }
.text-xs    { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent    { color: var(--accent-light); }
.text-success   { color: var(--success); }
.text-danger    { color: var(--danger); }

/* ─────────────────────────────────────
   CARDS
───────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.card-sm { padding: 14px 18px; }
.card-lg { padding: 28px 32px; }

/* Hero Card (главная метрика) */
.card-hero {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-hero-value {
  font-size: 30.75px;
  font-weight: 750;
  color: var(--money);
  letter-spacing: -0.615px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

/* Metric Tile */
.metric-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--transition-fast);
}

.metric-tile:hover {
  border-color: var(--border-color-strong);
}

/* Grid layouts */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.metrics-grid-2 { grid-template-columns: repeat(2, 1fr); }
.metrics-grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1024px) {
  .metrics-grid   { grid-template-columns: repeat(2, 1fr); }
  .metrics-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .metrics-grid,
  .metrics-grid-2,
  .metrics-grid-3 { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────
   PILL TABS / SEGMENTED CONTROL
───────────────────────────────────── */
.pills {
  display: inline-flex;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.pill {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

.pill:hover {
  color: var(--text-secondary);
  background: var(--bg-card-hover);
}

.pill.active {
  background: var(--accent-bg);
  color: var(--accent-light);
}

/* ─────────────────────────────────────
   BADGES
───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-accent {
  background: var(--accent-bg);
  color: var(--accent-light);
}

.badge-muted {
  background: var(--bg-glass-strong);
  color: var(--text-muted);
}

/* ─────────────────────────────────────
   BUTTONS
───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Primary */
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-light);
  border-color: var(--accent-light);
}

/* Secondary */
.btn-secondary {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-color-strong);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-glass);
  color: var(--text-primary);
}

/* Sizes */
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }

/* ─────────────────────────────────────
   INPUTS
───────────────────────────────────── */
.input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-family: var(--font-main);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.input::placeholder {
  color: var(--text-muted);
}

.input:focus {
  border-color: var(--accent);
  background: var(--bg-input-focus);
}

.input-mono {
  font-family: var(--font-mono);
  font-size: 12.75px;
}

/* ─────────────────────────────────────
   TABLE / LIST ROWS
───────────────────────────────────── */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-header {
  display: grid;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 11.7px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.585px;
  color: var(--text-muted);
}

.table-row {
  display: grid;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.table-row:last-child {
  border-bottom: none;
}

.table-row:hover {
  background: var(--bg-glass);
}

/* Link row variant */
.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
}

.link-row:last-child {
  border-bottom: none;
}

/* ─────────────────────────────────────
   DIVIDER
───────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border-color);
  border: none;
  margin: 0;
}

/* ─────────────────────────────────────
   ICON BUTTON
───────────────────────────────────── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
  border-color: var(--border-color-strong);
}

/* ─────────────────────────────────────
   CHART AREA (SVG)
───────────────────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
}

/* SVG line: stroke="#4c8dff" stroke-width="2" fill="none" */
/* Gradient fill: top rgba(76,141,255,0.28) → bottom rgba(76,141,255,0) */
/* Tooltip */
.chart-tooltip {
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-primary);
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

/* ─────────────────────────────────────
   THEME TOGGLE BUTTON
───────────────────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ─────────────────────────────────────
   ANIMATIONS
───────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}

/* Utility animation classes (smooth & refined) */
.anim-fade-up   { animation: fadeUp   0.6s cubic-bezier(0.16, 1, 0.3, 1) both; }
.anim-fade-in   { animation: fadeIn   0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.anim-scale-in  { animation: scaleIn  0.55s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* Staggered children */
.anim-stagger > *:nth-child(1) { animation-delay: 0ms;   }
.anim-stagger > *:nth-child(2) { animation-delay: 60ms;  }
.anim-stagger > *:nth-child(3) { animation-delay: 120ms; }
.anim-stagger > *:nth-child(4) { animation-delay: 180ms; }
.anim-stagger > *:nth-child(5) { animation-delay: 240ms; }
.anim-stagger > *:nth-child(6) { animation-delay: 300ms; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-glass) 25%,
    var(--bg-glass-strong) 50%,
    var(--bg-glass) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
