/* ============================================
   Checker Panel — Premium Design System
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep: #060a14;
  --bg-base: #0a0e1a;
  --bg-surface: #111827;
  --bg-elevated: #1a2236;
  --bg-hover: #1e293b;
  --border: rgba(255,255,255,0.06);
  --border-light: rgba(255,255,255,0.1);
  --primary: #6366f1;
  --primary-light: #818cf8;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
  --success: #10b981;
  --success-bg: rgba(16,185,129,0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.1);
  --info: #06b6d4;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --transition: 0.2s ease;
  --sidebar-w: 260px;
  --header-h: 64px;
}

html { font-size: 14px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: #a5b4fc; }

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

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  transition: transform 0.3s ease;
}
.sidebar-brand {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand-icon {
  width: 36px; height: 36px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff;
}
.sidebar-brand-text { font-size: 16px; font-weight: 700; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-link.active {
  background: rgba(99,102,241,0.08);
  color: var(--primary-light);
  border-left-color: var(--primary);
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- HEADER ---- */
.top-header {
  height: var(--header-h);
  background: rgba(17,24,39,0.7);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.top-header-left h1 { font-size: 18px; font-weight: 600; }
.top-header-left p { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.top-header-right { display: flex; align-items: center; gap: 10px; }

/* ---- HAMBURGER ---- */
.hamburger {
  display: none;
  background: none; border: none; color: var(--text-primary);
  cursor: pointer; padding: 6px;
}
.hamburger svg { width: 24px; height: 24px; }
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 35;
}

/* ---- PAGE CONTENT ---- */
.page-content { flex: 1; padding: 28px; }

/* ---- CARDS ---- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-light); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 600; }

/* ---- STAT CARDS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-light); box-shadow: var(--shadow); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition);
}
.stat-card:hover::before { opacity: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat-value.success { color: var(--success); }
.stat-value.danger { color: var(--danger); }
.stat-value.warning { color: var(--warning); }
.stat-value.info { color: var(--info); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent-gradient); color: #fff; box-shadow: 0 2px 12px rgba(99,102,241,0.3); }
.btn-primary:hover { box-shadow: 0 4px 20px rgba(99,102,241,0.4); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-ghost { background: var(--bg-hover); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-outline {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.btn-outline:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs); background: var(--bg-hover);
  border: 1px solid var(--border); color: var(--text-secondary);
  cursor: pointer; transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-light); }
.btn-icon.danger:hover { color: var(--danger); border-color: rgba(239,68,68,0.3); }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-deep);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-select { cursor: pointer; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: rgba(99,102,241,0.03); }

/* ---- STATUS BADGES ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-success::before { background: var(--success); box-shadow: 0 0 6px var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-danger::before { background: var(--danger); box-shadow: 0 0 6px var(--danger); animation: pulse-dot 2s infinite; }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-warning::before { background: var(--warning); }
.badge-neutral { background: var(--bg-hover); color: var(--text-muted); }
.badge-neutral::before { background: var(--text-muted); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- SEARCH BAR ---- */
.search-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative; flex: 1; min-width: 200px;
}
.search-input-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted);
}
.search-input-wrap .form-input { padding-left: 36px; }
.filter-select { width: auto; min-width: 160px; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s ease;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 4px; border-radius: 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }
.modal-close svg { width: 20px; height: 20px; }
.modal-body { padding: 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.modal-lg { max-width: 720px; }

/* ---- TOAST ---- */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 13px;
  min-width: 280px;
  animation: toast-in 0.35s ease;
  border-left: 3px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast-close {
  margin-left: auto;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 16px; line-height: 1;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---- CONFIRM MODAL ---- */
.confirm-body { text-align: center; padding: 28px 24px; }
.confirm-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  background: var(--danger-bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.confirm-icon svg { width: 28px; height: 28px; color: var(--danger); }
.confirm-text { font-size: 15px; margin-bottom: 6px; font-weight: 600; }
.confirm-sub { font-size: 13px; color: var(--text-secondary); }

/* ---- URL TEXT ---- */
.url-text {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-secondary);
}
.url-text a { color: var(--text-secondary); }
.url-text a:hover { color: var(--primary-light); }

/* ---- MARKER PREVIEW ---- */
.marker-pre {
  font-size: 11px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 60px;
  overflow: hidden;
  line-height: 1.4;
}

/* ---- ACTIONS CELL ---- */
.actions-cell { display: flex; gap: 6px; align-items: center; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-deep);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  top: -200px; right: -200px;
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(168,85,247,0.08) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  pointer-events: none;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 44px; height: 44px;
  background: var(--accent-gradient);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #fff;
}
.login-logo-text { font-size: 22px; font-weight: 700; }
.login-error {
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,0.2);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}

/* ---- DETAIL RESULT BLOCK ---- */
.result-block {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 60vh;
  overflow: auto;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
}

/* ---- HISTORY ---- */
.history-row-success td { border-left: 3px solid var(--success); }
.history-row-fail td { border-left: 3px solid var(--danger); }
.time-ago { font-size: 11px; color: var(--text-muted); }

/* ---- TOGGLE SWITCH ---- */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: 11px;
  cursor: pointer;
  transition: all var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition);
}
.toggle input:checked + .toggle-slider { background: rgba(16,185,129,0.2); border-color: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: var(--success); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .hamburger { display: flex; }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .form-row { grid-template-columns: 1fr; }
  .top-header { padding: 0 16px; }
  .modal { margin: 12px; }
  .toast-container { top: 12px; right: 12px; left: 12px; }
  .toast { min-width: auto; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
}

/* ---- UTILITIES ---- */
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-mono { font-family: 'Cascadia Code', 'Fira Code', monospace; }
.hidden { display: none !important; }

/* ---- PAGINATION ---- */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.pagination a:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: 0.3; pointer-events: none; }
.pagination-info { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 8px; }

/* ---- SIDEBAR SEPARATOR ---- */
.sidebar-sep {
  height: 1px;
  background: var(--border);
  margin: 8px 14px;
}

/* ---- INLINE TOGGLE LABEL ---- */
.toggle-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }

