@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --background: #0e0e16;
  --sidebar: #15151f;
  --panel: #191925;
  --hover: #222233;
  --border: #292939;
  --purple: #8b5cf6;
  --purple-light: #b49aff;
  --text: #f1f1f7;
  --muted: #9292aa;
  --green: #22c55e;
  --red: #ef4444;
  --sidebar-width: 250px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--background);
  color: var(--text);
  font-family: "Inter", sans-serif;
  min-height: 100vh;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  color: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* SIDEBAR */

.sidebar {
  width: var(--sidebar-width);
  height: 100dvh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 22px 14px;
  overflow-y: auto;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 8px 28px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, #a855f7, #6d28d9);
  font-size: 22px;
  box-shadow: 0 5px 25px #8b5cf633;
}

.logo h2 {
  font-size: 21px;
  font-weight: 800;
}

.logo span {
  color: var(--muted);
  font-size: 11px;
}

.nav-label {
  color: #72728a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 16px 12px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  background: transparent;
  padding: 12px;
  margin-bottom: 4px;
  border-radius: 8px;
  color: var(--muted);
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  transition: 0.2s;
}

.nav-item i {
  width: 19px;
  text-align: center;
}

.nav-item:hover {
  background: var(--hover);
  color: white;
}

.nav-item.active {
  background: #8b5cf61c;
  color: var(--purple-light);
  box-shadow: inset 3px 0 var(--purple);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 20px 8px 0;
  border-top: 1px solid var(--border);
}

.bot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #302347;
  display: grid;
  place-items: center;
  color: var(--purple-light);
  overflow: hidden;
  flex-shrink: 0;
}

.bot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-footer strong {
  font-size: 13px;
}

.bot-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 10px #22c55e66;
}

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

/* MAIN */

.main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  min-height: 72px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  padding: 15px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header h2 {
  font-size: 18px;
}

.connection-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--hover);
  border-radius: 20px;
  font-size: 12px;
  color: var(--muted);
}

.connection-badge.online {
  color: var(--green);
  background: #22c55e15;
}

.connection-badge.offline {
  color: var(--red);
  background: #ef444415;
}

.login-button,
.primary-button {
  background: var(--purple);
  border-radius: 8px;
  padding: 11px 17px;
  font-size: 13px;
  font-weight: 600;
  transition: 0.2s;
}

.login-button:hover,
.primary-button:hover {
  background: #7c3aed;
}

.icon-button {
  background: transparent;
  padding: 8px;
  font-size: 20px;
  display: none;
}

.content {
  padding: 30px;
  flex: 1;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: fade-in 0.25s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* WELCOME */

.welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  padding: 32px;
  border-radius: 16px;
  background: linear-gradient(110deg, #291b46, #1a1929);
  border: 1px solid #49316c;
  margin-bottom: 25px;
}

.welcome h1 {
  font-size: 28px;
  margin-bottom: 9px;
}

.welcome p {
  color: #b8a8d6;
  font-size: 14px;
}

.welcome-icon {
  font-size: 85px;
  color: #8b5cf633;
  transform: rotate(-12deg);
}

/* STATISTIQUES */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 22px;
  border-radius: 13px;
  transition: 0.2s;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: #8b5cf666;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 19px;
  margin-bottom: 18px;
}

.stat-icon.purple {
  background: #8b5cf622;
  color: #a78bfa;
}

.stat-icon.blue {
  background: #3b82f622;
  color: #60a5fa;
}

.stat-icon.green {
  background: #22c55e22;
  color: #4ade80;
}

.stat-icon.orange {
  background: #f59e0b22;
  color: #fbbf24;
}

.stat-card > span {
  font-size: 13px;
  color: var(--muted);
}

.stat-card h2 {
  font-size: 29px;
  margin: 9px 0;
  overflow-wrap: anywhere;
}

.stat-card small {
  font-size: 11px;
  color: #74748b;
}

/* PANELS */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 24px;
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 24px;
}

.panel-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.panel-header h3 i {
  color: var(--purple-light);
  margin-right: 7px;
}

.live-label {
  color: var(--green);
  font-size: 11px;
}

.chart-container {
  height: 260px;
  position: relative;
}

.system-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.system-status {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

.system-status.online {
  color: var(--green);
}

.system-status.offline {
  color: var(--red);
}

/* ACCÈS RAPIDES */

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.quick-card {
  background: #202030;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 23px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  transition: 0.2s;
}

.quick-card i {
  color: var(--purple-light);
  font-size: 23px;
}

.quick-card:hover {
  background: #2e2244;
  border-color: var(--purple);
}

/* AUTRES PAGES */

.module-heading {
  margin-bottom: 25px;
}

.module-heading h1 {
  font-size: 28px;
  margin-bottom: 10px;
}

.module-heading p {
  color: var(--muted);
  font-size: 14px;
}

.empty-state {
  min-height: 350px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 20px;
}

.empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: #8b5cf620;
  color: var(--purple-light);
  font-size: 30px;
  display: grid;
  place-items: center;
}

.empty-state p {
  color: var(--muted);
  font-size: 14px;
  max-width: 400px;
  line-height: 1.7;
}

footer {
  text-align: center;
  color: #67677e;
  padding: 22px;
  font-size: 12px;
}

.overlay {
  display: none;
}

::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-thumb {
  background: #39394e;
  border-radius: 10px;
}

/* RESPONSIVE */

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 800px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .icon-button {
    display: block;
  }

  .header {
    padding: 15px;
  }

  .content {
    padding: 16px;
  }

  .overlay.active {
    display: block;
    position: fixed;
    inset: 0;
    background: #0009;
    z-index: 90;
  }

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

  .welcome-icon {
    display: none;
  }

  .welcome {
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .header-right {
    gap: 6px;
  }

  .login-button {
    display: none;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    padding: 15px;
  }

  .stat-card h2 {
    font-size: 23px;
  }

  .welcome h1 {
    font-size: 23px;
  }

  .panel {
    padding: 17px;
  }
}

/* AUTHENTIFICATION DISCORD */

.login-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: white;
  background: #5865f2;
}

.login-button:hover {
  background: #4752c4;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #202030;
  padding: 7px 12px;
  border: 1px solid #303044;
  border-radius: 10px;
}

[hidden] {
  display: none !important;
}

.user-profile img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
}

.user-profile span {
  font-size: 13px;
  font-weight: 600;
}

.logout-button {
  background: #ef444420;
  color: #f87171;
  padding: 9px;
  border-radius: 7px;
  transition: 0.2s;
}

.logout-button:hover {
  background: #ef444440;
}

@media (max-width: 480px) {
  .user-profile span {
    display: none;
  }

  .login-button {
    font-size: 11px;
    padding: 9px;
  }
}

/* Sélection des serveurs */
.guild-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr)); gap:18px; margin-top:20px; }
.guild-card { display:flex; flex-direction:column; align-items:center; text-align:center; gap:14px; padding:24px; background:var(--hover); border:1px solid var(--border); border-radius:14px; min-width:0; }
.guild-card h3 { overflow-wrap:anywhere; font-size:17px; }
.guild-card p, #guild-status, #guild-details { color:var(--muted); font-size:13px; }
.guild-avatar { width:76px; height:76px; border-radius:24px; background:#382653; color:var(--purple-light); display:grid; place-items:center; font-size:25px; font-weight:700; overflow:hidden; }
.guild-avatar img { width:100%; height:100%; object-fit:cover; }
.guild-action { margin-top:auto; width:100%; text-decoration:none; color:white; text-align:center; }
#back-guilds { margin-top:20px; }

#guild-settings-form {display:grid;gap:14px;max-width:420px;margin:24px 0;}
#guild-settings-form input {background:#202030;color:#fff;border:1px solid #39394e;border-radius:8px;padding:10px;font:inherit;}
#guild-color {height:48px;width:100%;}
#settings-status {color:#b49aff;}
