/* ============================================
   NEXUSAI — Dashboard Styles
   ============================================ */

.dash-body {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-primary);
}

/* ============ SIDEBAR ============ */
.dash-sidebar {
  width: 260px;
  min-width: 260px;
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow: hidden;
  z-index: 100;
}

.dash-sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Nav */
.dash-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.dash-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.dash-nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.dash-nav-item.active {
  background: rgba(124,77,255,0.12);
  color: var(--text-primary);
  font-weight: 600;
}
.dash-nav-item svg { flex-shrink: 0; }

.admin-nav-item {
  color: rgba(255,64,129,0.8) !important;
}
.admin-nav-item:hover, .admin-nav-item.active {
  background: rgba(255,64,129,0.1) !important;
  color: #ff4081 !important;
}

.dash-nav-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,64,129,0.6);
}
.dash-nav-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,64,129,0.2);
}

/* Sidebar Footer */
.dash-sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.dash-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
}
.dash-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.dash-user-details { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dash-user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-user-role { font-size: 0.72rem; color: var(--text-muted); }

.dash-sidebar-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(124,77,255,0.08);
  border: 1px solid rgba(124,77,255,0.2);
  transition: var(--transition);
  text-decoration: none;
}
.dash-sidebar-action-btn:hover { color: var(--text-primary); border-color: var(--accent); background: rgba(124,77,255,0.15); }

/* ============ MAIN ============ */
.dash-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

/* Top Bar */
.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(8,8,16,0.8);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
  gap: 16px;
}
.dash-topbar-left { display: flex; align-items: center; gap: 12px; }
.dash-topbar-right { display: flex; align-items: center; gap: 12px; }

.dash-menu-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
  display: flex;
  align-items: center;
}
.dash-menu-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.dash-breadcrumb {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.admin-status-pill {
  padding: 6px 14px;
  background: rgba(255,64,129,0.15);
  border: 1px solid rgba(255,64,129,0.4);
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ff4081;
  animation: pillPulse 2s ease-in-out infinite;
}
@keyframes pillPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,64,129,0.3); }
  50% { box-shadow: 0 0 0 6px rgba(255,64,129,0); }
}

/* ============ TABS ============ */
.dash-tab {
  display: none;
  flex: 1;
  overflow-y: auto;
}
.dash-tab.active-tab { display: block; }

.dash-content {
  padding: 32px 28px;
  max-width: 1200px;
}

.dash-page-header { margin-bottom: 32px; }
.dash-page-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.dash-page-header p { font-size: 0.9rem; color: var(--text-secondary); }

.admin-page-header h1 { color: var(--text-primary); }
.admin-header-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(255,64,129,0.15);
  border: 1px solid rgba(255,64,129,0.3);
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #ff4081;
  margin-bottom: 12px;
}

/* ============ STATS ROW ============ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-bright); transform: translateY(-2px); }
.admin-stat { border-color: rgba(255,64,129,0.15); }
.admin-stat:hover { border-color: rgba(255,64,129,0.35); }

.stat-card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-card-info { flex: 1; min-width: 0; }
.stat-card-num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.stat-card-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.stat-card-trend {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 50px;
  white-space: nowrap;
}
.stat-card-trend.up { background: rgba(178,255,89,0.1); color: var(--neon-green); }
.stat-card-trend.down { background: rgba(255,64,129,0.1); color: #ff4081; }
.stat-card-trend.neutral { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* ============ CHARTS ============ */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.chart-large { grid-column: 1; }

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.chart-header h3 { font-size: 0.95rem; font-weight: 700; }
.chart-legend { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text-muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ============ RECENT ============ */
.recent-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.recent-header h3 { font-size: 0.95rem; font-weight: 700; }
.view-all-link { font-size: 0.82rem; color: var(--accent); font-weight: 600; cursor: pointer; }
.view-all-link:hover { color: var(--accent-2); }

.recent-list { display: flex; flex-direction: column; gap: 2px; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  transition: var(--transition);
}
.recent-item:hover { background: rgba(255,255,255,0.03); }
.recent-icon { font-size: 1rem; flex-shrink: 0; }
.recent-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.recent-title { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-meta { font-size: 0.75rem; color: var(--text-muted); }
.recent-action { font-size: 0.78rem; color: var(--accent); font-weight: 600; white-space: nowrap; transition: var(--transition); }
.recent-action:hover { color: var(--accent-2); }

/* ============ ACTIVITY LOG ============ */
.activity-log {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
}
.activity-log h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 16px; }
.log-list { display: flex; flex-direction: column; gap: 2px; }
.log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.log-item:last-child { border-bottom: none; }
.log-time { font-size: 0.72rem; color: var(--text-muted); min-width: 80px; }
.log-icon { font-size: 0.9rem; }
.log-text { flex: 1; }
.log-model { font-size: 0.72rem; color: var(--accent); font-weight: 600; }

/* ============ TABLES ============ */
.models-table-wrap, .users-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}

.models-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.models-table th {
  padding: 14px 20px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.models-table td {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-secondary);
  vertical-align: middle;
}
.models-table tr:last-child td { border-bottom: none; }
.models-table tr:hover td { background: rgba(255,255,255,0.02); }

.table-model-name { font-weight: 600; color: var(--text-primary); }
.table-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
}
.badge-active { background: rgba(178,255,89,0.1); color: var(--neon-green); border: 1px solid rgba(178,255,89,0.2); }
.badge-admin { background: rgba(255,64,129,0.1); color: #ff4081; border: 1px solid rgba(255,64,129,0.2); }
.badge-free { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border); }
.badge-pro { background: rgba(124,77,255,0.15); color: var(--accent); border: 1px solid rgba(124,77,255,0.3); }

.table-action-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(124,77,255,0.1);
  border: 1px solid rgba(124,77,255,0.2);
  color: var(--accent);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-body);
}
.table-action-btn:hover { background: rgba(124,77,255,0.2); }

/* ============ HISTORY GRID ============ */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
  cursor: pointer;
}
.history-card:hover { border-color: var(--border-bright); transform: translateY(-2px); }
.history-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.history-card-model { font-size: 0.72rem; font-weight: 700; color: var(--accent); }
.history-card-time { font-size: 0.72rem; color: var(--text-muted); margin-left: auto; }
.history-card-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.history-card-preview { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }

/* ============ SETTINGS ============ */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
}
.settings-section h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.settings-desc { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.6; }

.admin-gate { display: flex; flex-direction: column; gap: 12px; }
.admin-input-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.admin-password-input {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.admin-password-input:focus { border-color: var(--border-bright); }
.admin-password-input::placeholder { color: var(--text-muted); }

.admin-feedback {
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 20px;
  transition: var(--transition);
}
.feedback-success { color: var(--neon-green); }
.feedback-error { color: #ff4081; }

.admin-active-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-active-info { display: flex; flex-direction: column; gap: 6px; }
.admin-active-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(255,64,129,0.15);
  border: 1px solid rgba(255,64,129,0.3);
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ff4081;
  width: fit-content;
}
.admin-active-info p { font-size: 0.85rem; color: var(--text-secondary); }

.settings-form { display: flex; flex-direction: column; gap: 16px; max-width: 480px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); }
.settings-input {
  padding: 11px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.settings-input:focus { border-color: var(--border-bright); }

.settings-toggles { display: flex; flex-direction: column; gap: 0; }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); display: block; margin-bottom: 2px; }
.toggle-desc { font-size: 0.78rem; color: var(--text-muted); }

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 24px;
  transition: 0.3s;
  border: 1px solid var(--border);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 2px; top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: rgba(124,77,255,0.3); border-color: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); background: var(--accent); }

/* ============ ADMIN SECTIONS ============ */
.admin-section {
  background: var(--bg-card);
  border: 1px solid rgba(255,64,129,0.15);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
}
.admin-section h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 20px; }

.uncensored-stats { display: flex; flex-direction: column; gap: 14px; }
.uncensored-stat { display: flex; align-items: center; gap: 12px; }
.unc-model { font-size: 0.84rem; font-weight: 600; color: var(--text-secondary); min-width: 180px; }
.unc-bar-wrap { flex: 1; height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.unc-bar { height: 100%; background: linear-gradient(90deg, #ff4081, #ff9100); border-radius: 3px; transition: width 1s ease; }
.unc-count { font-size: 0.78rem; color: var(--text-muted); min-width: 80px; text-align: right; }

/* Admin Models Grid */
.admin-models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.admin-model-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-model-card.admin-only-card { border-color: rgba(255,64,129,0.2); }
.amc-header { display: flex; align-items: center; gap: 10px; }
.amc-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.amc-name { font-weight: 700; font-size: 0.9rem; flex: 1; }
.amc-maker { font-size: 0.72rem; color: var(--text-muted); }
.amc-toggle { display: flex; align-items: center; justify-content: space-between; }
.amc-toggle span { font-size: 0.8rem; color: var(--text-secondary); }

/* Users toolbar */
.users-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.users-toolbar-right { display: flex; align-items: center; gap: 12px; }
.users-count { font-size: 0.82rem; color: var(--text-muted); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .dash-sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
  }
  .dash-sidebar.mobile-open { transform: translateX(0); }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dash-content { padding: 20px 16px; }
  .dash-topbar { padding: 12px 16px; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .admin-input-row { flex-direction: column; align-items: stretch; }
  .admin-active-panel { flex-direction: column; align-items: flex-start; }
}