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

/* ── CSS Variables ────────────────────────────────────────────────────────── */
:root {
  --bg:           #0B0B0C;
  --surface:      #111113;
  --surface-2:    #151517;
  --surface-3:    #1a1a1e;
  --border:       #1F1F23;
  --border-hover: #2a2a30;
  --border-focus: #4F7FFF;
  --text:         #FFFFFF;
  --text-secondary: #A1A1AA;
  --text-muted:   #6B7280;
  --text-faint:   #3f3f46;
  --accent:       #4F7FFF;
  --accent-hover: #6B95FF;
  --accent-dim:   rgba(79, 127, 255, 0.12);
  --accent-glow:  rgba(79, 127, 255, 0.25);
  --purple:       #7A5CFF;
  --purple-dim:   rgba(122, 92, 255, 0.12);
  --gradient:     linear-gradient(135deg, #7A5CFF, #4F7FFF);
  --danger:       #ef4444;
  --danger-dim:   rgba(239, 68, 68, 0.10);
  --success:      #22c55e;
  --success-dim:  rgba(34, 197, 94, 0.10);
  --warning:      #f59e0b;
  --warning-dim:  rgba(245, 158, 11, 0.10);
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow:       0 4px 16px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
  --shadow-lg:    0 12px 40px rgba(0,0,0,0.6), 0 4px 12px rgba(0,0,0,0.4);
  --shadow-glow:  0 0 30px rgba(79,127,255,0.15);
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    16px;
  --radius-xl:    24px;
  --transition:   0.15s ease;
  --transition-md: 0.25s ease;
}

[data-theme="light"] {
  --bg:             #F4F4F6;
  --surface:        #FFFFFF;
  --surface-2:      #F8F8FA;
  --surface-3:      #F1F1F4;
  --border:         #E4E4E8;
  --border-hover:   #D0D0D8;
  --border-focus:   #4F7FFF;
  --text:           #0A0A0B;
  --text-secondary: #52525B;
  --text-muted:     #71717A;
  --text-faint:     #A1A1AA;
  --accent:         #4F7FFF;
  --accent-hover:   #3D6EF0;
  --accent-dim:     rgba(79, 127, 255, 0.10);
  --accent-glow:    rgba(79, 127, 255, 0.20);
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
  --shadow:         0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:      0 12px 40px rgba(0,0,0,0.14);
  --shadow-glow:    0 0 30px rgba(79,127,255,0.10);
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  letter-spacing: -0.01em;
}

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

/* ── Navigation ───────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 11, 12, 0.85);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

[data-theme="light"] .nav {
  background: rgba(255, 255, 255, 0.85);
}

.nav-brand {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.03em;
  margin-right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.nav-brand:hover { text-decoration: none; color: var(--text); opacity: 0.8; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: 1;
}

.nav-link {
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8375rem;
  font-weight: 500;
  transition: all var(--transition);
  letter-spacing: -0.01em;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-link.active { color: var(--text); background: var(--surface-2); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Avatar */
.nav-avatar-wrap { position: relative; }

.nav-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  cursor: pointer;
  object-fit: cover;
  transition: all var(--transition);
}
.nav-avatar:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.nav-avatar-placeholder {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--gradient);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.nav-avatar-placeholder:hover { box-shadow: 0 0 0 3px var(--accent-dim); }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  padding: 6px;
  display: none;
  z-index: 200;
  animation: dropdownIn 0.15s ease;
}
.nav-dropdown.open { display: block; }

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.nav-dropdown-header {
  padding: 10px 12px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.nav-dropdown-name  { font-weight: 600; font-size: 0.875rem; color: var(--text); letter-spacing: -0.01em; }
.nav-dropdown-email { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; word-break: break-all; }

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  background: none;
  border: none;
  text-align: left;
}
.nav-dropdown-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-dropdown-item.danger { color: var(--danger); }
.nav-dropdown-item.danger:hover { background: var(--danger-dim); color: var(--danger); }

/* ── Page Layout ──────────────────────────────────────────────────────────── */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.page-header { margin-bottom: 32px; }

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
}
.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.card-lift:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-lg);
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Glass card */
.card-glass {
  background: rgba(17, 17, 19, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.06);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
  font-family: inherit;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-gradient {
  background: var(--gradient);
  color: #fff;
}
.btn-gradient:hover:not(:disabled) {
  opacity: 0.9;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(122,92,255,0.3);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--border-hover);
  color: var(--text);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); text-decoration: none; }

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; text-decoration: none; border-color: var(--danger); }

.btn-sm  { padding: 5px 10px; font-size: 0.8125rem; }
.btn-lg  { padding: 11px 24px; font-size: 0.9375rem; font-weight: 600; }
.btn-xl  { padding: 14px 32px; font-size: 1rem; font-weight: 600; }
.btn-icon { padding: 7px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

input[type="text"],
input[type="email"],
input[type="search"],
select,
textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  padding: 9px 12px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  font-family: inherit;
  letter-spacing: -0.01em;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
select { cursor: pointer; }
textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

.form-hint {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-blue   { background: var(--accent-dim);   color: var(--accent); }
.badge-purple { background: var(--purple-dim);   color: var(--purple); }
.badge-green  { background: var(--success-dim);  color: var(--success); }
.badge-red    { background: var(--danger-dim);   color: var(--danger); }
.badge-yellow { background: var(--warning-dim);  color: var(--warning); }
.badge-gray   { background: var(--surface-2);    color: var(--text-muted); border: 1px solid var(--border); }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 72px 24px;
  color: var(--text-muted);
}
.empty-state-icon  { font-size: 2.5rem; margin-bottom: 16px; opacity: 0.4; display: block; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; letter-spacing: -0.02em; }
.empty-state-desc  { font-size: 0.875rem; max-width: 320px; margin: 0 auto 24px; line-height: 1.6; }

/* ── Skeleton loaders ─────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Loading spinner ──────────────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-lg { width: 32px; height: 32px; border-width: 2.5px; }

/* ── Toast notifications ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  max-width: 340px;
  pointer-events: auto;
  animation: toastIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
  backdrop-filter: blur(12px);
}
.toast.success { border-left: 2px solid var(--success); }
.toast.error   { border-left: 2px solid var(--danger); }
.toast.info    { border-left: 2px solid var(--accent); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

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

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.progress-bar {
  height: 5px;
  background: var(--surface-2);
  border-radius: 100px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 100px;
  transition: width 0.4s ease;
}
.progress-bar-fill.danger  { background: var(--danger); }
.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mt-32  { margin-top: 32px; }
.text-muted    { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-small    { font-size: 0.8125rem; }
.text-xs       { font-size: 0.75rem; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Gradient text */
.text-gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Animate in */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeUp 0.3s ease forwards; }
.animate-in-delay-1 { animation: fadeUp 0.3s ease 0.05s both; }
.animate-in-delay-2 { animation: fadeUp 0.3s ease 0.10s both; }
.animate-in-delay-3 { animation: fadeUp 0.3s ease 0.15s both; }
.animate-in-delay-4 { animation: fadeUp 0.3s ease 0.20s both; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page { padding: 24px 20px 64px; }
  .nav  { padding: 0 16px; }
}

@media (max-width: 640px) {
  .page { padding: 20px 16px 60px; }
  .nav  { padding: 0 12px; gap: 4px; }
  .nav-links .nav-link span { display: none; }
  .nav-links .nav-link { padding: 6px 8px; font-size: 1rem; }
  .nav-links { overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 0; flex-shrink: 1; }
  .nav-brand { flex-shrink: 0; }
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn-sm { min-height: 36px; }
  .card-grid-2 { grid-template-columns: 1fr !important; }
  .page-title { font-size: 1.25rem; }
  .toast-container { bottom: 12px; right: 12px; left: 12px; }
  .toast { max-width: 100%; }
}

@media (max-width: 380px) {
  .nav-links { display: none; }
}
