/* ========================================
   NullBot Dashboard — Custom Styles
   On top of Pico CSS (dark theme)
   ======================================== */

:root {
  --discord-blurple: #5865f2;
  --discord-green: #57f287;
  --discord-yellow: #fee75c;
  --discord-red: #ed4245;
  --discord-dark: #1a1a2e;
  --sidebar-width: 260px;
  --card-radius: 16px;
}

/* ---- Login Page ---- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-card {
  text-align: center;
  max-width: 400px;
  padding: 3rem 2.5rem;
  border-radius: var(--card-radius);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.login-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0;
}

.login-header p {
  font-size: 1.1rem;
  opacity: 0.6;
  margin-top: 0.25rem;
}

.login-description {
  margin: 1.5rem 0 2rem;
  opacity: 0.8;
}

.discord-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--discord-blurple);
  color: white;
  padding: 0.85rem 2rem;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease;
  border: none;
}

.discord-btn:hover {
  background: #4752c4;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(88, 101, 242, 0.4);
}

/* ---- Dashboard Layout ---- */
body:has(.sidebar) {
  display: flex;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.sidebar-header h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.sidebar-header select {
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar nav li {
  margin: 0;
  padding: 0;
}

.nav-link {
  display: block;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.15s ease;
  font-size: 0.9rem;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
}

.nav-link.active {
  background: var(--discord-blurple);
  color: white;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.user-info img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.logout-btn {
  display: block;
  text-align: center;
  font-size: 0.8rem;
  padding: 0.5rem;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.5);
  transition: all 0.15s ease;
}

.logout-btn:hover {
  color: var(--discord-red);
  background: rgba(237, 66, 69, 0.1);
}

/* ---- Main Content ---- */
.dashboard-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 900px;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  padding: 1.25rem;
  border-radius: var(--card-radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  transition: all 0.2s ease;
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-2px);
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--discord-blurple);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  opacity: 0.6;
  margin-top: 0.25rem;
}

/* ---- Tables ---- */
.leaderboard-row,
.warning-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.leaderboard-row:last-child,
.warning-row:last-child {
  border-bottom: none;
}

.leaderboard-row img,
.warning-row img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--discord-blurple);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.rank-badge.gold {
  background: #ffd700;
  color: #1a1a2e;
}
.rank-badge.silver {
  background: #c0c0c0;
  color: #1a1a2e;
}
.rank-badge.bronze {
  background: #cd7f32;
  color: white;
}

.user-details {
  flex: 1;
}

.user-details .username {
  font-weight: 600;
  font-size: 0.9rem;
}

.user-details .meta {
  font-size: 0.75rem;
  opacity: 0.5;
}

.xp-bar {
  width: 100px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    var(--discord-blurple),
    var(--discord-green)
  );
  transition: width 0.3s ease;
}

/* ---- Forms ---- */
.inline-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.inline-form input {
  margin-bottom: 0;
}

.inline-form button {
  white-space: nowrap;
  width: auto;
}

/* ---- Tags ---- */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
}

.tag .remove-tag {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.tag .remove-tag:hover {
  opacity: 1;
  color: var(--discord-red);
}

/* ---- Auto-reply rows ---- */
.autoreply-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.autoreply-row:last-child {
  border-bottom: none;
}

.autoreply-trigger {
  font-weight: 600;
  color: var(--discord-blurple);
}

.autoreply-response {
  opacity: 0.7;
  flex: 1;
  margin: 0 1rem;
}

/* ---- Warning rows ---- */
.warning-row {
  justify-content: space-between;
}

.warning-info {
  flex: 1;
}

.warning-reason {
  font-size: 0.85rem;
}

.warning-meta {
  font-size: 0.75rem;
  opacity: 0.5;
}

.delete-btn {
  background: transparent;
  border: 1px solid rgba(237, 66, 69, 0.3);
  color: var(--discord-red);
  padding: 0.3rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.15s;
  width: auto;
}

.delete-btn:hover {
  background: rgba(237, 66, 69, 0.15);
}

/* ---- Toast Notifications ---- */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: white;
  backdrop-filter: blur(10px);
  animation:
    toastIn 0.3s ease,
    toastOut 0.3s ease 2.7s forwards;
  pointer-events: none;
}

.toast.success {
  background: rgba(87, 242, 135, 0.2);
  border: 1px solid rgba(87, 242, 135, 0.3);
  color: var(--discord-green);
}

.toast.error {
  background: rgba(237, 66, 69, 0.2);
  border: 1px solid rgba(237, 66, 69, 0.3);
  color: var(--discord-red);
}

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

@keyframes toastOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ---- Empty States ---- */
.empty-state {
  text-align: center;
  padding: 2rem;
  opacity: 0.5;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: relative;
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  body:has(.sidebar) {
    flex-direction: column;
  }

  .dashboard-main {
    margin-left: 0;
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
