/* ---------- Theme Variables ---------- */
:root {
  --bg: #0f1222;
  --panel: #15182a;
  --card: #1b1f34;
  --muted: #9aa3b2;
  --text: #e6e9f2;
  --accent: #8b5cf6;    /* purple */
  --accent-2: #22d3ee;  /* cyan */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .03);

  --sidebar-width: 260px;
}

:root[data-theme="light"] {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --card: #ffffff;
  --text: #0b1020;
  --muted: #5b6473;
  --shadow: 0 10px 30px rgba(0, 0, 0, .08);
}

/* ---------- Base / Reset ---------- */
* {
  box-sizing: border-box;
}
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;         /* hide horizontal overflow */
  width: 100vw;                /* ensure width is bounded */
  max-width: 100%;
  background:
    radial-gradient(1200px 600px at -10% -20%, rgba(139, 92, 246, .18), transparent 60%),
    radial-gradient(800px 500px at 110% 10%, rgba(34, 211, 238, .14), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
img, svg, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Critical: prevent grid/flex children from forcing overflow */
.app-shell, .content, .card, .grid-3, .grid-2, .table, .table-row, .table-row > div {
  min-width: 0;
}

/* ---------- App Shell & Layout ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.sidebar {
  background: linear-gradient(180deg, rgba(22, 26, 45, .9), rgba(17, 20, 37, .95));
  border-right: 1px solid rgba(255, 255, 255, .06);
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .03);
}
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.brand-name {
  font-weight: 700;
  letter-spacing: .2px;
}

.sidebar-nav {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--text);
  border-radius: 10px;
  opacity: .85;
}
.nav-item:hover {
  background: rgba(255, 255, 255, .06);
  opacity: 1;
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, .25), rgba(34, 211, 238, .18));
}

.sidebar-section {
  margin-top: 24px;
}
.section-title {
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 0 8px 10px;
}
.server-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.server-pill {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.server-pill:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}

.content {
  padding: 28px 34px;
}

/* ---------- Header / Search / User ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
  flex-wrap: wrap;
}
.search {
  flex: 1 1 320px;
  min-width: 0;
}
.search input {
  width: 100%;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1020;
}
.user-meta .name {
  font-weight: 600;
  font-size: 14px;
}
.user-meta .tag {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Flash / Alerts ---------- */
.flash-stack {
  display: grid;
  gap: 10px;
  margin: 12px 0 18px;
}
.flash {
  background: rgba(34, 211, 238, .15);
  border: 1px solid rgba(34, 211, 238, .35);
  padding: 10px 12px;
  border-radius: 12px;
}
.flash-warn {
  background: rgba(245, 158, 11, .15);
  border: 1px solid rgba(245, 158, 11, .35);
}

/* ---------- Grid Utilities ---------- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* ---------- Cards / Tables / KPI ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .06);
}
.card-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.kpi {
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(139, 92, 246, .35), transparent);
}
.kpi-label {
  font-size: 12px;
  color: var(--muted);
}
.kpi-value {
  font-size: 32px;
  font-weight: 800;
  margin-top: 6px;
}

.table {
  display: grid;
  gap: 8px;
  overflow-x: auto;
}
.table-head {
  opacity: .7;
}
.table-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1fr);
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .02);
  gap: 8px;
}
.table-row + .table-row {
  border-top: 1px solid rgba(255, 255, 255, .04);
}

.mono {
  font-feature-settings: "tnum" 1, "lnum" 1;
}
.muted {
  color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, .04);
  cursor: pointer;
  line-height: 1.1;
  min-height: 40px;
}
.btn:hover {
  background: rgba(255, 255, 255, .08);
}
.btn.small {
  padding: 8px 10px;
  font-size: 12px;
  min-height: 34px;
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1020;
  border: none;
  font-weight: 700;
}

/* ---------- Hero / Forms ---------- */
.hero-card {
  text-align: center;
  padding: 40px;
  border: 1px dashed rgba(255, 255, 255, .12);
  border-radius: 20px;
  background: rgba(255, 255, 255, .03);
}
.hero-card h1 {
  margin-top: 0;
  margin-bottom: 6px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.actions {
  display: flex;
  gap: 10px;
}

.form-card { }
.form-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.form-grid input {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  outline: none;
  min-height: 40px;
  width: 100%;
}
.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ---------- Coming Soon (landing) ---------- */
body.coming {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(60% 60% at 50% 30%, #2a2a2a 0%, #1b1b1b 40%, #111 100%);
  background-attachment: fixed;
  display: grid;
  place-items: center;
  color: #e8f1ff;
}
.coming-wrap {
  text-align: center;
  display: grid;
  gap: 20px;
  padding: 24px;
}
.logo-glow {
  width: min(420px, 70vw);
  height: auto;
  filter: drop-shadow(0 0 14px rgba(0, 140, 255, 0.65))
    drop-shadow(0 0 28px rgba(0, 140, 255, 0.35));
  display: block;
  margin-inline: auto;
  transform-origin: center;
  transition: transform 220ms ease, filter 220ms ease;
  will-change: transform, filter;
}
.coming-title {
  font: 800 clamp(28px, 6vw, 56px) / 1.1 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: .02em;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(0, 153, 255, .7), 0 0 22px rgba(0, 153, 255, .55), 0 0 46px rgba(0, 153, 255, .35);
  animation: glowPulse 3.2s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% {
    text-shadow: 0 0 8px rgba(0, 153, 255, .7), 0 0 22px rgba(0, 153, 255, .55), 0 0 46px rgba(0, 153, 255, .35);
  }
  50% {
    text-shadow: 0 0 12px rgba(0, 153, 255, .8), 0 0 30px rgba(0, 153, 255, .65), 0 0 60px rgba(0, 153, 255, .45);
  }
}
.coming .logo-glow:hover,
.coming .logo-glow:focus-visible {
  transform: scale(1.06);
  filter: drop-shadow(0 0 18px rgba(0, 140, 255, 0.75))
    drop-shadow(0 0 42px rgba(0, 140, 255, 0.55))
    drop-shadow(0 0 72px rgba(0, 140, 255, 0.35));
}

/* ---------- Callback page ---------- */
.callback-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at -10% -20%, rgba(139, 92, 246, .18), transparent 60%),
    radial-gradient(800px 500px at 110% 10%, rgba(34, 211, 238, .14), transparent 50%),
    var(--bg);
}
.callback-wrap {
  width: min(720px, 92vw);
}

/* ---------- Motion Preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .logo-glow {
    transition: none;
  }
}

/* =========================================================
   RESPONSIVE ENHANCEMENTS
   ========================================================= */

/* Medium collapse */
@media (max-width: 1100px) {
  :root {
    --sidebar-width: 76px;
  }
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .brand-name {
    display: none;
  }
  .app-shell {
    grid-template-columns: var(--sidebar-width) 1fr;
  }
}

/* ------ Mobile layout (phones & small tablets) ------ */
.mobile-topbar {
  display: none;
}

@media (max-width: 860px) {
  /* Show mobile topbar; hide desktop login */
  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    background: linear-gradient(180deg, rgba(22, 26, 45, .96), rgba(17, 20, 37, .92));
    border-bottom: 1px solid rgba(255, 255, 255, .06);
  }
  .mobile-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
  }
  .mobile-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
  }

  /* Hide desktop login on mobile */
  .header-actions {
    display: none !important;
  }

  /* App shell stacks; sidebar becomes an off-canvas drawer */
  .app-shell {
    display: block;
    min-height: 100dvh;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(76vw, 320px);
    max-width: 320px;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    box-shadow: 16px 0 40px rgba(0, 0, 0, .35);
    contain: layout paint;
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  /* Dim overlay when drawer is open */
  body.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(2px);
  }

  /* Prevent background scroll when sidebar is open */
  body.sidebar-open {
    overflow: hidden;
  }

  /* Content spacing */
  .content {
    padding: 16px 14px 24px;
  }
  .header {
    gap: 10px;
  }
  .search {
    flex: 1 1 100%;
    min-width: 0;
  }
  .search input {
    width: 100%;
  }

  /* Grids stack */
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }

  /* Tighter cards */
  .card {
    padding: 14px;
  }
  .hero-card {
    padding: 24px;
  }

  /* Form grid becomes 1–2 columns */
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  @media (max-width: 520px) {
    .form-grid {
      grid-template-columns: 1fr;
    }
  }

  /* Hide long labels in the narrow sidebar */
  .brand-name {
    display: none;
  }
}

/* ---------- Login button visibility fixes ---------- */
/* Hide mobile login by default (desktop state) */
#discord-login-mobile {
  display: none;
}

@media (max-width: 860px) {
  #discord-login-mobile {
    display: inline-flex;
  }
}

.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }

/* add at end of style.css */
.server-pill img { width: 100%; height: 100%; border-radius: 12px; object-fit: cover; display: block; }

/* at end of style.css */
.user-chip .avatar { width: 28px; height: 28px; }
.user-chip .avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.server-pill { width: 38px; height: 38px; }
.server-pill img { width: 100%; height: 100%; border-radius: 12px; object-fit: cover; display: block; }

/* ---------- Bot Card Polish (for bsettings.html) ---------- */
.card h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 700;
}

.card p {
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.5;
}



