/* ============================================================
   Analytics Platform — Global Design System
   Dark mode default | Light mode via [data-theme="light"]
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Variables ───────────────────────────────────────── */
:root {
  /* Dark mode (default) */
  --bg-sidebar:     #0d1b2e;
  --bg-sidebar-hover: #1a2d47;
  --bg-sidebar-active: #1e40af;
  --bg-content:     #111827;
  --bg-card:        #1f2937;
  --bg-card-hover:  #243044;
  --bg-input:       #374151;
  --bg-modal:       #1f2937;
  --bg-overlay:     rgba(0, 0, 0, 0.7);
  --bg-table-row:   #1f2937;
  --bg-table-row-hover: #263348;
  --bg-header:      #161f30;

  --text-primary:   #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted:     #6b7280;
  --text-accent:    #60a5fa;
  --text-link:      #3b82f6;

  --accent-blue:    #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-purple:  #8b5cf6;
  --accent-green:   #10b981;
  --accent-yellow:  #f59e0b;
  --accent-red:     #ef4444;
  --accent-cyan:    #06b6d4;

  --border:         #374151;
  --border-light:   #4b5563;
  --border-focus:   #3b82f6;

  --shadow-sm:  0 1px 2px rgba(0,0,0,0.5);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(59,130,246,0.3);

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  --sidebar-w:  220px;
  --header-h:   60px;
  --transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-sidebar:     #0d1b2e;
  --bg-sidebar-hover: #1a2d47;
  --bg-sidebar-active: #1e40af;
  --bg-content:     #f3f4f6;
  --bg-card:        #ffffff;
  --bg-card-hover:  #f9fafb;
  --bg-input:       #f3f4f6;
  --bg-modal:       #ffffff;
  --bg-overlay:     rgba(0, 0, 0, 0.5);
  --bg-table-row:   #ffffff;
  --bg-table-row-hover: #f9fafb;
  --bg-header:      #ffffff;

  --text-primary:   #111827;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;
  --text-accent:    #2563eb;
  --text-link:      #2563eb;

  --border:         #e5e7eb;
  --border-light:   #d1d5db;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-content);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text-link); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-blue-hover); }

img { max-width: 100%; display: block; }

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

.app-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 20px;
  border-right: 1px solid rgba(255,255,255,0.05);
  overflow: hidden;
}

.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  height: var(--header-h);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.app-content {
  padding: 24px;
  flex: 1;
}

/* ─── Sidebar Logo ─────────────────────────────────────────── */
.sidebar-logo {
  width: calc(100% - 32px); height: 40px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
  color: #fff;
  margin-bottom: 20px;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

/* ─── Sidebar Nav ──────────────────────────────────────────── */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  width: 100%;
  padding: 0 8px;
}

.sidebar-item {
  width: calc(100% - 16px); height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: flex-start;
  padding: 0 16px;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
}

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

.sidebar-item.active {
  background: var(--bg-sidebar-active);
  color: #fff;
  box-shadow: 0 0 12px rgba(30, 64, 175, 0.5);
}

/* Hide tooltip since we have text now */
.sidebar-item::after { display: none; }

.sidebar-divider {
  width: calc(100% - 32px);
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 8px 0;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  gap: 4px;
  padding: 0 8px;
}

/* ─── Header ───────────────────────────────────────────────── */
.header-website-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  min-width: 200px;
}

.header-website-selector:hover {
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}

.header-website-selector img {
  width: 20px; height: 20px;
  border-radius: 4px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.header-user-avatar {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  overflow: hidden;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.card:hover { box-shadow: var(--shadow-md); }

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  opacity: 0;
  transition: opacity 0.2s;
}

.metric-card:hover { border-color: var(--border-focus); box-shadow: var(--shadow-md); }
.metric-card:hover::before { opacity: 1; }

.metric-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.metric-icon-blue   { background: rgba(59,130,246,0.15); }
.metric-icon-green  { background: rgba(16,185,129,0.15); }
.metric-icon-purple { background: rgba(139,92,246,0.15); }
.metric-icon-yellow { background: rgba(245,158,11,0.15); }

.metric-content {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.metric-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ─── Metric Grid ──────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 900px) { .metrics-grid { grid-template-columns: 1fr; } }

/* ─── Tables ───────────────────────────────────────────────── */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: visible;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.table-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.table-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-sm);
}

.table-tab {
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  border: none;
  background: none;
  transition: var(--transition);
}

.table-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
}

table.data-table th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data-table td {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(55,65,81,0.5);
  vertical-align: middle;
}

table.data-table tbody tr {
  transition: background 0.1s;
}

table.data-table tbody tr:hover {
  background: var(--bg-table-row-hover);
}

table.data-table tbody tr:last-child td { border-bottom: none; }

/* ─── Progress Bar (for table percentages) ─────────────────── */
.progress-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
  transition: width 0.5s ease;
}

.progress-label {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 36px;
  text-align: right;
}

/* ─── Badges & Pills ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.badge-green  { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-blue   { background: rgba(59,130,246,0.15);  color: #60a5fa; }
.badge-purple { background: rgba(139,92,246,0.15);  color: #a78bfa; }
.badge-yellow { background: rgba(245,158,11,0.15);  color: #fbbf24; }
.badge-red    { background: rgba(239,68,68,0.15);   color: #f87171; }
.badge-gray   { background: rgba(107,114,128,0.15); color: #9ca3af; }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot-green  { background: #10b981; box-shadow: 0 0 6px #10b981; animation: pulse-green 2s infinite; }
.status-dot-red    { background: #ef4444; }
.status-dot-yellow { background: #f59e0b; }

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 6px rgba(16,185,129,0.5); }
  50%       { box-shadow: 0 0 12px rgba(16,185,129,0.8); }
}

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

.btn-primary:hover {
  background: var(--accent-blue-hover);
  border-color: var(--accent-blue-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59,130,246,0.4);
}

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

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-danger {
  background: transparent;
  color: var(--accent-red);
  border-color: var(--accent-red);
}

.btn-danger:hover {
  background: var(--accent-red);
  color: #fff;
}

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }

/* ─── Form Elements ────────────────────────────────────────── */
.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.5px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 9px 13px;
  font-size: 13px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

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

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle input { display: none; }

.toggle-track {
  width: 40px; height: 22px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: var(--transition);
  position: relative;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked + .toggle-track {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
  background: #fff;
}

.toggle-label { font-size: 13px; color: var(--text-primary); font-weight: 500; }

/* ─── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title { font-size: 16px; font-weight: 700; }

.modal-close {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}

.modal-close:hover { background: var(--border); color: var(--text-primary); }

/* ─── Identicon Avatar ─────────────────────────────────────── */
.identicon {
  display: inline-block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.identicon svg { display: block; }

/* ─── Realtime Badge ───────────────────────────────────────── */
.realtime-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.25);
  color: #10b981;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

/* ─── Dropdown ─────────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all 0.15s ease;
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.dropdown-item:hover { background: var(--bg-card-hover); }
.dropdown-item:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.dropdown-item:last-child  { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ─── Page Header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Date Range Picker ────────────────────────────────────── */
.date-picker-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}

.date-picker-btn:hover { border-color: var(--border-focus); }

/* ─── Chart Container ──────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 220px;
  padding: 16px;
}

/* ─── Section Grid ─────────────────────────────────────────── */
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 1100px) { .section-grid { grid-template-columns: 1fr; } }

/* ─── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
}

.page-btn {
  min-width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  transition: var(--transition);
}

.page-btn:hover  { background: var(--bg-card-hover); color: var(--text-primary); }
.page-btn.active { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }

/* ─── Alert / Flash ────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

.alert-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: #10b981; }
.alert-error   { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.3);  color: #f87171; }
.alert-info    { background: rgba(59,130,246,0.12);  border: 1px solid rgba(59,130,246,0.3);  color: #60a5fa; }

/* ─── Code Block ───────────────────────────────────────────── */
.code-block {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  color: #e6edf3;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.7;
}

/* ─── Section Breakdown (Devices, OS, etc.) ─────────────────── */
.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.breakdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(55,65,81,0.4);
}

.breakdown-item:last-child { border-bottom: none; }

.breakdown-flag { font-size: 20px; flex-shrink: 0; }

.breakdown-label { flex: 1; font-size: 13px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.breakdown-count { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-right: 8px; }

/* ─── Auth Pages ───────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-content);
  padding: 24px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
  box-shadow: var(--shadow-glow);
  margin: 0 auto 12px;
}

.auth-title { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.auth-sub   { font-size: 13px; color: var(--text-secondary); text-align: center; }

/* ─── Admin Layout ─────────────────────────────────────────── */
.admin-sidebar {
  width: 220px;
  background: var(--bg-sidebar);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  padding: 20px 0;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.admin-main {
  margin-left: 220px;
}

.admin-nav-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.3);
  padding: 16px 16px 6px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.admin-nav-item:hover  { background: rgba(255,255,255,0.06); color: #fff; }
.admin-nav-item.active { background: rgba(59,130,246,0.2); color: #60a5fa; border-left: 3px solid var(--accent-blue); padding-left: 13px; }

/* ─── Heatmap Viewer ───────────────────────────────────────── */
.heatmap-viewer {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #000;
}

.heatmap-iframe {
  width: 100%;
  min-height: 600px;
  display: block;
  border: none;
}

/* ─── Replay Player ────────────────────────────────────────── */
.replay-player-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.replay-viewport {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 480px;
}

.replay-controls {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.replay-progress {
  position: relative;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
}

.replay-progress-fill {
  height: 100%;
  background: var(--accent-blue);
  border-radius: var(--radius-full);
  pointer-events: none;
}

.replay-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.replay-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}

.replay-btn:hover { background: var(--accent-blue); }
.replay-btn.active { background: var(--accent-blue); }

.replay-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: monospace;
  margin-left: auto;
}

/* ─── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab:hover  { color: var(--text-primary); }
.tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

/* ─── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb-sep { color: var(--border-light); }

/* ─── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-secondary);
}

.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.empty-sub   { font-size: 13px; color: var(--text-secondary); margin-bottom: 24px; }

/* ─── Visitor Row ──────────────────────────────────────────── */
.visitor-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(55,65,81,0.4);
  transition: background 0.1s;
}

.visitor-row:hover { background: var(--bg-table-row-hover); }
.visitor-row:last-child { border-bottom: none; }

.visitor-info { flex: 1; min-width: 0; }
.visitor-ip { font-size: 12px; font-family: monospace; color: var(--text-secondary); margin-top: 2px; }

.visitor-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.visitor-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

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

/* ─── Animations ───────────────────────────────────────────── */
@keyframes fadeIn  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { transform: translateY(100%); }           to { transform: none; } }
@keyframes spin    { to { transform: rotate(360deg); } }

.animate-in { animation: fadeIn 0.25s ease forwards; }

.loading-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ─── Theme Toggle ─────────────────────────────────────────── */
.theme-toggle {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}

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

/* ─── Utility Classes ──────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.gap-4       { gap: 16px; }
.mt-2        { margin-top: 8px; }
.mt-4        { margin-top: 16px; }
.mt-6        { margin-top: 24px; }
.mb-4        { margin-bottom: 16px; }
.mb-6        { margin-bottom: 24px; }
.p-4         { padding: 16px; }
.text-sm     { font-size: 12px; }
.text-muted  { color: var(--text-muted); }
.font-bold   { font-weight: 700; }
.font-mono   { font-family: monospace; }
.w-full      { width: 100%; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rounded     { border-radius: var(--radius-md); }
