/* ========================================
   FiveM Logging Platform - Design System
   ======================================== */

/* --- CSS Variables --- */
:root {
  /* Background */
  --bg-primary: #0a0e17;
  --bg-secondary: #0f1729;
  --bg-tertiary: #15203a;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(20, 30, 55, 0.85);
  --bg-input: rgba(15, 23, 42, 0.6);

  /* Accent Colors */
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-red: #ef4444;
  --accent-pink: #ec4899;
  --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --accent-gradient-h: linear-gradient(90deg, #3b82f6, #8b5cf6);

  /* Text */
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #3b82f6;

  /* Borders */
  --border-color: rgba(148, 163, 184, 0.12);
  --border-accent: rgba(59, 130, 246, 0.3);

  /* Glass */
  --glass-bg: rgba(15, 23, 42, 0.65);
  --glass-border: rgba(148, 163, 184, 0.1);
  --glass-blur: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(59,130,246,0.15);
  --shadow-glow-purple: 0 0 20px rgba(139,92,246,0.15);

  /* Spacing */
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --top-bar-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 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-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

::-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); }

.hidden { display: none !important; }

/* --- Glass Card --- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* --- Auth View --- */
.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  animation: orbFloat 12s ease-in-out infinite;
}

.auth-orb-1 {
  width: 500px; height: 500px;
  background: var(--accent-blue);
  top: -150px; left: -100px;
  animation-delay: 0s;
}

.auth-orb-2 {
  width: 400px; height: 400px;
  background: var(--accent-purple);
  bottom: -100px; right: -80px;
  animation-delay: -4s;
}

.auth-orb-3 {
  width: 300px; height: 300px;
  background: var(--accent-cyan);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -8s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.05); }
  66% { transform: translate(-20px, 30px) scale(0.95); }
}

.auth-card {
  width: 420px;
  padding: 40px;
  z-index: 1;
  animation: fadeSlideUp 0.6s ease;
}

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

.logo-icon {
  width: 60px; height: 60px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-glow);
}

.logo-icon .material-symbols-outlined { font-size: 30px; color: #fff; }

.auth-logo h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.auth-logo h1 .accent {
  background: var(--accent-gradient-h);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

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

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

.form-input-with-icon {
  position: relative;
}

.form-input-with-icon .material-symbols-outlined {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 20px;
}

.form-input-with-icon .form-input {
  padding-left: 40px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(59,130,246,0.3);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

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

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239,68,68,0.2);
}

.btn-danger:hover {
  background: rgba(239,68,68,0.25);
}

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

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

.btn-icon {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.btn-full { width: 100%; justify-content: center; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width var(--transition-smooth), transform var(--transition-smooth);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  min-height: 65px;
}

.sidebar-header .logo-sm {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-header .logo-sm .material-symbols-outlined { font-size: 20px; color: #fff; }

.sidebar-header .logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-header .logo-text .accent {
  background: var(--accent-gradient-h);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 16px 14px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 450;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 2px;
  text-decoration: none;
}

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

.nav-item.active {
  color: #fff;
  background: var(--accent-gradient);
  box-shadow: var(--shadow-glow);
}

.nav-item .material-symbols-outlined { font-size: 22px; flex-shrink: 0; }
.nav-item .nav-label { overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border-color);
}

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

.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

.top-bar {
  height: var(--top-bar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar-left { display: flex; align-items: center; gap: 12px; }
.top-bar-right { display: flex; align-items: center; gap: 16px; }

.page-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.page-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

/* --- Server Selector --- */
.server-select {
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  min-width: 150px;
}

.server-select:focus { border-color: var(--accent-blue); }

.server-pill {
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Global Notify --- */
.global-notify {
  padding: 12px 24px;
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.08);
}

.global-notify-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.global-notify-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #fbbf24;
}

.global-notify-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
@media (max-width: 768px) {
  .global-notify-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* --- User Menu --- */
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.user-menu-btn:hover { border-color: var(--border-accent); }

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
}

/* --- Dashboard Cards --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.stat-icon.blue { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.stat-icon.purple { background: rgba(139,92,246,0.15); color: var(--accent-purple); }
.stat-icon.green { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.stat-icon.yellow { background: rgba(245,158,11,0.15); color: var(--accent-yellow); }
.stat-icon.red { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.stat-icon.cyan { background: rgba(6,182,212,0.15); color: var(--accent-cyan); }

.stat-info { flex: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-size: 1.6rem; font-weight: 700; }
.stat-change { font-size: 0.75rem; margin-top: 4px; }
.stat-change.up { color: var(--accent-green); }
.stat-change.down { color: var(--accent-red); }

/* --- Section Cards --- */
.section-card {
  padding: 24px;
  margin-bottom: 24px;
}

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

.section-title {
  font-size: 1.05rem;
  font-weight: 600;
}

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

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 12px 16px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.data-table tr:hover td { background: var(--bg-tertiary); }

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

/* --- Log Level Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-debug { background: rgba(100,116,139,0.2); color: #94a3b8; }
.badge-info { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.badge-warn { background: rgba(245,158,11,0.15); color: var(--accent-yellow); }
.badge-error { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.badge-fatal { background: rgba(236,72,153,0.2); color: var(--accent-pink); }

.badge-online { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.badge-offline { background: rgba(239,68,68,0.15); color: var(--accent-red); }

/* --- Media Grid & Views --- */
.media-grid {
  display: grid;
  gap: 16px;
}

/* View: Large (Default) */
.media-grid.view-large { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* View: Small */
.media-grid.view-small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.media-grid.view-small .media-info { padding: 8px; }
.media-grid.view-small .media-name { font-size: 0.75rem; }
.media-grid.view-small .media-meta { font-size: 0.65rem; }
.media-grid.view-small .btn-icon { width: 20px; height: 20px; }
.media-grid.view-small .btn-icon span { font-size: 14px; }

/* View: List */
.media-grid.view-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.media-grid.view-list .media-item {
  display: flex;
  flex-direction: row;
  height: 60px;
  align-items: center;
}

.media-grid.view-list .media-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-bottom: none;
  border-right: 1px solid var(--border-color);
}

.media-grid.view-list .media-info {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.media-grid.view-list .media-name { flex: 1; margin-bottom: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 16px; }
.media-grid.view-list .media-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 16px; margin-top: 0; }
.media-grid.view-list .media-meta > div { margin-top: 0; }

.media-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  display: flex;
  flex-direction: column;
}

.media-item:hover { border-color: var(--accent-blue); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.media-grid.view-list .media-item:hover { transform: translateY(0); padding-left: 2px; }

/* Multi-select Checkbox */
.media-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 18px;
  height: 18px;
  z-index: 10;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  accent-color: var(--accent-blue);
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.media-item:hover .media-checkbox,
.media-item.selected .media-checkbox {
  opacity: 1;
}

.media-item.selected {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.05);
}

.media-item.selected .media-thumb {
  opacity: 0.8;
}

/* Toolbar Select Bar */
.media-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--accent-blue);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  box-shadow: var(--shadow-glow);
  animation: fadeSlideDown 0.2s ease;
}

.media-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: var(--border-accent);
}

.media-thumb {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  display: block;
  background: var(--bg-tertiary);
}

.media-info {
  padding: 10px 12px;
}

.media-name {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
}

.media-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translateY(-5px);
  z-index: 20;
}

.media-item:hover .media-actions {
  opacity: 1;
  transform: translateY(0);
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.action-btn.delete:hover {
  color: var(--accent-red);
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

/* List view specific actions */
.view-list .media-actions {
  position: static;
  opacity: 1;
  transform: none;
  margin-left: 12px;
}

.view-list .media-item-actions-wrapper {
  display: flex;
  align-items: center;
}


/* --- Upload Area --- */
.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 24px;
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--accent-blue);
  background: rgba(59,130,246,0.05);
}

.upload-area .material-symbols-outlined {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.upload-area p { color: var(--text-secondary); }

/* --- Filters Bar --- */
.filters-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-select, .filter-input {
  padding: 7px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.filter-select:focus, .filter-input:focus { border-color: var(--accent-blue); }

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

.alerts-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* --- Monitor Charts --- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  padding: 20px;
}

.chart-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-canvas {
  width: 100%;
  height: 200px;
}

/* --- Status Indicator --- */
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.offline {
  background: var(--accent-red);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --- Setup Wizard --- */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
  position: relative;
}

.wizard-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: pointer;
}

.wizard-step-number {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 1;
  transition: all var(--transition-fast);
}

.wizard-step.active .wizard-step-number {
  background: var(--accent-gradient);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.wizard-step.completed .wizard-step-number {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #fff;
}

.wizard-step-label {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.wizard-step.active .wizard-step-label { color: var(--text-primary); }

.wizard-step-line {
  position: absolute;
  top: 18px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: var(--border-color);
  z-index: 0;
}

.wizard-step:last-child .wizard-step-line { display: none; }

.wizard-step.completed .wizard-step-line { background: var(--accent-green); }

.wizard-content {
  animation: fadeSlideUp 0.3s ease;
}

.code-block {
  background: #0d1117;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  position: relative;
}

.code-block .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.72rem;
  transition: all var(--transition-fast);
}

.code-block .copy-btn:hover { border-color: var(--accent-blue); color: var(--text-primary); }

/* --- Settings Page --- */
.api-key-card {
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.api-key-info { flex: 1; }
.api-key-name { font-weight: 500; margin-bottom: 4px; }
.api-key-preview { font-family: monospace; font-size: 0.82rem; color: var(--text-muted); }
.api-key-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.page-btn {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.page-btn:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.page-btn.active { background: var(--accent-gradient); border-color: var(--accent-blue); color: #fff; }
.page-btn:disabled { opacity: 0.3; cursor: default; }

.page-info { color: var(--text-muted); font-size: 0.82rem; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal {
  min-width: 400px;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  animation: fadeSlideUp 0.25s ease;
}

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

.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-body { margin-bottom: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; }

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  animation: slideInRight 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.toast-success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: var(--accent-green); }
.toast-error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: var(--accent-red); }
.toast-info { background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.3); color: var(--accent-blue); }
.toast-warning { background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.3); color: var(--accent-yellow); }

.toast-message { flex: 1; font-size: 0.88rem; }
.toast-close { cursor: pointer; opacity: 0.6; transition: opacity var(--transition-fast); }
.toast-close:hover { opacity: 1; }

/* --- Restart Timeline --- */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  padding-bottom: 24px;
}

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: 2px solid var(--bg-primary);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.timeline-content {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

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

.empty-state .material-symbols-outlined {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p { font-size: 1rem; margin-bottom: 8px; }
.empty-state .sub { font-size: 0.85rem; }

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

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

/* --- Loading Spinner --- */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .stats-grid { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .auth-card { width: 90%; padding: 28px; }
  .modal { min-width: 90%; }
  .alerts-grid-2 { grid-template-columns: 1fr; }
}

/* --- Lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  animation: fadeIn 0.2s ease;
  cursor: zoom-out;
}

.lightbox img, .lightbox video {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: var(--radius-md);
}

/* --- Auth Switch Link --- */
.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.auth-switch a {
  color: var(--accent-blue);
  font-weight: 500;
  cursor: pointer;
}

.auth-switch a:hover { color: var(--accent-purple); }

/* --- Tag --- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-card-hover) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 14px; width: 60%; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 40%; margin-bottom: 12px; }
.skeleton-card { height: 120px; width: 100%; }

/* --- Language Switcher --- */
.lang-switcher {
  position: relative;
}

.lang-dropdown {
  position: relative;
}

.lang-btn {
  font-size: 0.82rem !important;
  padding: 5px 10px !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--bg-tertiary) !important;
  white-space: nowrap;
}

.lang-btn:hover {
  border-color: var(--border-accent) !important;
}

.lang-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  animation: fadeSlideUp 0.15s ease;
}

.lang-dropdown.open .lang-dropdown-menu {
  display: block;
}

.lang-option {
  padding: 9px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-option:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.lang-option.active {
  color: var(--accent-blue);
  font-weight: 500;
  background: rgba(59, 130, 246, 0.08);
}

/* --- Upload Progress --- */
.upload-progress-card {
  padding: 24px;
  width: 400px;
  background: var(--bg-secondary);
}

.progress-container {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin: 16px 0;
}

.progress-bar {
  height: 100%;
  background: var(--accent-gradient-h);
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.upload-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.upload-file-name {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* --- Landing Intro --- */
.landing-shell {
  width: min(1240px, 94vw);
  display: grid;
  grid-template-columns: 1.45fr 420px;
  gap: 24px;
  z-index: 1;
  align-items: stretch;
}

.landing-panel {
  padding: 34px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeSlideUp 0.6s ease;
}

.landing-badge {
  width: fit-content;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.14);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: #67e8f9;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.landing-title {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: -0.6px;
}

.landing-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
  max-width: 72ch;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.feature-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.58);
  padding: 14px;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.feature-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.feature-card .material-symbols-outlined {
  color: var(--accent-cyan);
  font-size: 22px;
  margin-bottom: 8px;
}

.feature-card h3 {
  font-size: 0.93rem;
  margin-bottom: 6px;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.6;
}

@media (max-width: 1160px) {
  .landing-shell {
    grid-template-columns: 1fr;
    max-width: 760px;
  }

  .auth-card {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .landing-shell {
    width: 92vw;
    gap: 16px;
  }

  .landing-panel {
    padding: 22px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }
}

.auth-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: -2px 0 14px;
  flex-wrap: wrap;
}

.auth-checkbox-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
}

.auth-checkbox-option input[type='checkbox'] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent-blue);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 8, 16, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.resource-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.82rem;
  line-height: 1.35;
  min-height: 34px;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


