/* ============================
   RESET & BASE
   ============================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #000000;
  /* Deep black background */
  --bg2: #0a0a0a;
  /* Card background */
  --bg3: #111111;
  /* Input/Hover background */
  --border: #222222;
  --border-active: #333333;
  --glass: rgba(255, 255, 255, 0.02);
  --glass-hover: rgba(255, 255, 255, 0.05);
  --accent: #ffffff;
  /* Crisp white accent */
  --accent2: #eaeaea;
  --accent-glow: rgba(255, 255, 255, 0.1);
  --green: #10b981;
  --green-bg: rgba(16, 185, 129, 0.1);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --yellow: #f59e0b;
  --text: #ededed;
  --text2: #a1a1aa;
  --text3: #71717a;
  --radius: 8px;
  /* Sharp corners */
  --radius-sm: 6px;
  --shadow: 0 4px 24px -1px rgba(0, 0, 0, 0.8);
  --transition: 0.15s ease-out;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 14px;
}

/* ============================
   SPLASH / LOADER
   ============================ */
.splash {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================
   VK STYLE LAYOUT
   ============================ */
#app {
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding-top: 24px;
}

.vk-container {
  display: flex;
  width: 100%;
  max-width: 1400px;
  gap: 24px;
  padding: 0 16px;
  align-items: flex-start;
}

/* SIDEBAR (Left Column) */
.sidebar {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 24px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.sidebar-logo:hover {
  background: var(--glass-hover);
}

.sidebar-logo .icon-box {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--bg);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: var(--glass-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--glass);
  color: var(--accent);
}

.nav-item.danger {
  color: var(--red);
}

.nav-item.danger:hover {
  background: var(--red-bg);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 13px;
  color: var(--text2);
}

.nav-avatar {
  width: 24px;
  height: 24px;
  background: var(--border);
  border: 1px solid var(--border-active);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.badge-admin {
  font-size: 10px;
  font-weight: 600;
  background: var(--text);
  color: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

/* MAIN CONTENT (Center) */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.4s ease;
  min-width: 0;
}

/* ============================
   AUTH PAGE
   ============================ */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-split {
  display: flex;
  width: 100%;
  max-width: 1000px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 100px rgba(99, 102, 241, 0.08);
  /* Indigo glow */
  animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-info {
  flex: 1;
  padding: 60px 48px;
  background: var(--bg3);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-form-container {
  flex: 0 0 420px;
  padding: 60px 40px;
  background: var(--bg);
  display: flex;
  align-items: center;
}

.auth-card {
  width: 100%;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-logo {
  display: block;
  margin: 0 auto 24px;
  width: 52px;
  height: 52px;
  background: var(--text);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--bg);
  letter-spacing: -1px;
}

.auth-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.auth-sub {
  text-align: center;
  color: var(--text2);
  font-size: 13px;
  margin-bottom: 28px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text3);
  transition: all var(--transition);
}

.auth-tab.active {
  background: var(--bg2);
  color: var(--text);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}

/* ============================
   FORMS
   ============================ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  padding: 12px 16px;
  transition: all var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--text);
  background: var(--bg2);
}

.form-control::placeholder {
  color: var(--text3);
}

textarea.form-control {
  resize: vertical;
  min-height: 160px;
  font-size: 13px;
  line-height: 1.5;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
}

.btn-primary:hover {
  background: #d4d4d8;
  /* slightly dimmer white */
  color: var(--bg);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary:disabled {
  background: var(--bg3);
  color: var(--text3);
  border-color: var(--border);
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--glass-hover);
  color: var(--text);
  border-color: var(--border-active);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(255, 82, 82, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 82, 82, 0.2);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
}

.error-msg {
  background: var(--red-bg);
  border: 1px solid rgba(255, 82, 82, 0.2);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.error-msg.show {
  display: block;
}

.success-msg {
  background: var(--green-bg);
  border: 1px solid rgba(0, 230, 118, 0.2);
  color: var(--green);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.success-msg.show {
  display: block;
}

/* ============================
   CARDS & SECTIONS
   ============================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
}

.page-sub {
  color: var(--text2);
  font-size: 13px;
  margin-top: 2px;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
  transition: border-color var(--transition);
}

.card:hover {
  border-color: var(--border-active);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  font-size: 16px;
}

/* STATS ROW */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--glass-hover), transparent);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text);
}

.stat-value.green {
  color: var(--text);
}

.stat-value.red {
  color: var(--red);
}

.stat-label {
  font-size: 12px;
  color: var(--text3);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================
   TABLE
   ============================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
  /* Forces horizontal scroll on smaller screens */
}

thead th {
  background: var(--bg3);
  color: var(--text2);
  padding: 14px 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text);
  vertical-align: middle;
  word-wrap: break-word;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: var(--glass);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-valid {
  background: var(--green-bg);
  color: var(--green);
}

.badge-invalid {
  background: var(--red-bg);
  color: var(--red);
}

.badge-admin-role {
  background: var(--text);
  color: var(--bg);
}

.badge-user-role {
  background: var(--glass);
  color: var(--text2);
}

.mono {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 12px;
  color: var(--text2);
}

/* ============================
   UPLOAD AREA
   ============================ */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 16px;
  background: var(--bg3);
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--accent);
  background: rgba(108, 99, 255, 0.06);
}

.upload-icon {
  font-size: 36px;
  margin-bottom: 12px;
  display: block;
}

.upload-text {
  color: var(--text2);
  font-size: 13px;
}

.upload-text strong {
  color: var(--accent2);
}

/* ============================
   PROGRESS
   ============================ */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  margin: 12px 0;
  display: none;
  overflow: hidden;
}

.progress-bar.show {
  display: block;
}

.progress-fill {
  height: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-fill.indeterminate {
  animation: indeterminate 1.2s ease infinite;
}

@keyframes indeterminate {
  0% {
    transform: translateX(-100%);
    width: 60%;
  }

  100% {
    transform: translateX(200%);
    width: 60%;
  }
}

/* ============================
   EMPTY STATE
   ============================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 8px;
}

.empty-sub {
  font-size: 13px;
}

/* ============================
   TABS
   ============================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text3);
  padding: 10px 18px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}

.tab-btn:hover {
  color: var(--text2);
}

.tab-btn.active {
  color: var(--accent2);
  border-bottom-color: var(--accent2);
}

/* ============================
   TOAST
   ============================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 280px;
  max-width: 380px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: slideIn 0.3s ease;
  font-size: 13px;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  border-left: 3px solid var(--green);
}

.toast.error {
  border-left: 3px solid var(--red);
}

.toast.info {
  border-left: 3px solid var(--accent);
}

.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.toast-msg {
  color: var(--text2);
}

/* ============================
   SCROLLBAR
   ============================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--bg3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-active);
}

/* ============================
   MISC
   ============================ */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.text-muted {
  color: var(--text2);
}

.text-sm {
  font-size: 12px;
}

.flex {
  display: flex;
}

.gap-2 {
  gap: 8px;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.ml-auto {
  margin-left: auto;
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 640px) {
  .navbar {
    padding: 0 14px;
  }

  .page {
    padding: 72px 14px 30px;
  }

  .auth-card {
    padding: 28px 20px;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  thead th,
  tbody td {
    padding: 9px 12px;
  }
}

/* ============================
   CHECKER SELECTOR CARDS
   ============================ */
.checker-selector {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.checker-card {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.checker-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.05);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.checker-card.active {
  border-color: var(--text);
}

.checker-card.active::before {
  opacity: 1;
}

.checker-card:hover:not(.active) {
  border-color: var(--border-active);
  background: var(--glass-hover);
}

.checker-card-icon {
  font-size: 32px;
  z-index: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s ease;
}

.checker-card:hover .checker-card-icon {
  transform: scale(1.1);
}

.checker-card-content {
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.checker-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.checker-card-sub {
  font-size: 12px;
  color: var(--text2);
}

@media (max-width: 600px) {
  .checker-selector {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }
}

/* ============================
   PROFILE REDESIGN
   ============================ */
.profile-grid {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.profile-sidebar {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.profile-avatar-wrap {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--border);
  border: 1px solid var(--border-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--text);
  font-weight: 600;
  margin: 0 auto 16px;
}

.profile-card {
  text-align: center;
  padding: 32px 24px;
}

.profile-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  word-break: break-all;
}

.profile-role-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--text2);
  margin-bottom: 16px;
}

.profile-role-badge.admin {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.profile-date {
  font-size: 12px;
  color: var(--text3);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.sub-status-box {
  background: var(--glass);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 900px) {
  .profile-grid {
    flex-direction: column;
  }

  .profile-sidebar {
    flex: none;
    width: 100%;
  }
}

/* ============================
   MOBILE RESPONSIVENESS
   ============================ */
@media (max-width: 768px) {

  /* 1. Dashboard Layout Layout */
  .vk-container {
    flex-direction: column;
    padding: 0 10px;
    gap: 16px;
  }

  /* 2. Sidebar Navigation */
  .sidebar {
    position: static;
    flex-direction: row;
    flex: none;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    /* Firefox */
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
  }

  .sidebar::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
  }

  .sidebar-logo {
    display: none;
    /* Hide full logo on mobile toolbar to save space */
  }

  .sidebar-nav {
    flex-direction: row;
    gap: 10px;
    width: 100%;
  }

  .nav-item {
    white-space: nowrap;
    /* Keep items horizontal */
  }

  .nav-user {
    padding: 6px 14px;
    /* Larger tap target */
  }

  /* 3. Auth Layout */
  .auth-split {
    flex-direction: column;
    border: none;
    box-shadow: none;
    background: transparent;
  }

  .auth-info {
    display: none;
    /* Hide completely on mobile for minimalist login */
  }

  .auth-form-container {
    flex: none;
    width: 100%;
    padding: 20px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  /* 4. Dashboard Grid Elements */
  .stats-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .checker-selector {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .controls-bar {
    flex-direction: column;
  }

  .controls-bar .btn {
    width: 100%;
  }

  /* 5. Modals & Tables */
  .modal-content {
    width: 95%;
    margin: 5% auto;
    padding: 20px;
  }

  .table-wrap {
    overflow-x: auto;
    /* Ensure tables can scroll horizontally without breaking layout */
    border-radius: var(--radius-sm);
  }

  th,
  td {
    white-space: nowrap;
    /* Prevent harsh text wrapping in data columns */
  }
}