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

:root {
  --bg-primary: #0a0a0d;
  --bg-secondary: #111216;
  --bg-tertiary: #191b22;
  --bg-card: #20222b;
  --bg-input: #15171d;
  
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --accent-light: #727cff;
  --accent-glow: rgba(88, 101, 242, 0.2);
  
  --text-primary: #f2f3f5;
  --text-secondary: #b5bac1;
  --text-muted: #949ba4;
  
  --success: #23a55a;
  --warning: #f0b232;
  --danger: #f23f43;
  --info: #00b0f4;

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overflow-x: hidden;
  height: 100vh;
  display: flex;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Layout */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(88, 101, 242, 0.4);
}

.logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(to right, #ffffff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-menu {
  flex: 1;
  padding: 20px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.menu-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.menu-item.active {
  background-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(0, 0, 0, 0.1);
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-avatar {
  width: 32px;
  height: 32px;
  background-color: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border: 2px solid var(--accent);
}

.admin-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  padding: 6px;
  border-radius: 5px;
}

.btn-logout:hover {
  color: var(--danger);
  background-color: rgba(242, 63, 67, 0.1);
}

/* Main Content Wrapper */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
}

/* Top Header Bar */
.top-header {
  height: 80px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 90;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.bot-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: rgba(255, 255, 255, 0.03);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
  box-shadow: 0 0 8px currentColor;
}

.status-dot.online { color: var(--success); background-color: var(--success); }
.status-dot.offline { color: var(--danger); background-color: var(--danger); }
.status-dot.connecting { color: var(--warning); background-color: var(--warning); animation: pulse 1s infinite alternate; }

.server-selector-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.server-select {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.server-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Page Sections */
.content-body {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.section {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.section.active {
  display: block;
}

/* Grid System */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.card-stat {
  background-color: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 140px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.card-stat:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  border-color: rgba(88, 101, 242, 0.2);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  margin-top: 10px;
}

.stat-icon {
  width: 42px;
  height: 42px;
  background-color: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-light);
}

/* Dashboard Bottom Grid */
.grid-main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  margin-top: 32px;
}

.panel {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Logs and Activity lists */
.log-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
}

.log-item {
  background-color: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.log-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.log-item.error { border-left-color: var(--danger); }
.log-item.role_assigned { border-left-color: var(--success); }
.log-item.member_joined { border-left-color: var(--info); }
.log-item.member_left { border-left-color: var(--warning); }
.log-item.system { border-left-color: var(--accent); }

.log-message {
  font-weight: 500;
  color: var(--text-primary);
}

.log-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Buttons and Controls */
.btn {
  background-color: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn:hover {
  background-color: var(--accent-hover);
  box-shadow: 0 4px 15px rgba(88, 101, 242, 0.3);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.btn-success { background-color: var(--success); }
.btn-success:hover { background-color: #1a7a42; box-shadow: 0 4px 15px rgba(35, 165, 90, 0.3); }

.btn-danger { background-color: var(--danger); }
.btn-danger:hover { background-color: #c93538; box-shadow: 0 4px 15px rgba(242, 63, 67, 0.3); }

.btn-warning { background-color: var(--warning); color: #000; }
.btn-warning:hover { background-color: #d69f2e; box-shadow: 0 4px 15px rgba(240, 178, 50, 0.3); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none !important;
}

/* Forms styling */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-text, .textarea, .select-input {
  background-color: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.input-text:focus, .textarea:focus, .select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.textarea {
  min-height: 100px;
  resize: vertical;
}

/* Toggle Switch */
.switch-container {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  transition: .3s;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(24px);
  background-color: #fff;
}

/* Embed Preview Mockup */
.embed-preview {
  background-color: #2b2d31;
  border-radius: 5px;
  border-left: 4px solid var(--accent);
  padding: 16px;
  margin-top: 16px;
  max-width: 520px;
  font-size: 0.9rem;
}

.embed-preview-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
  color: #fff;
}

.embed-preview-desc {
  color: #dbdee1;
  line-height: 1.4;
  margin-bottom: 12px;
}

.embed-preview-image {
  max-width: 100%;
  border-radius: 4px;
  margin-top: 8px;
  max-height: 200px;
  object-fit: cover;
}

/* Tab Panels / Sub-navigation */
.sub-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 12px;
}

.sub-tab {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  font-size: 0.9rem;
}

.sub-tab:hover {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.sub-tab.active {
  background-color: rgba(88, 101, 242, 0.1);
  color: var(--accent-light);
}

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

@keyframes pulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* Toast Notification style */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
}

.toast {
  background-color: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid var(--accent);
  color: var(--text-primary);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

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

/* Mobile Responsiveness */
@media (max-width: 1024px) {
  .grid-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }
  
  .sidebar-menu {
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
  }
  
  .menu-item {
    padding: 8px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
  }
  
  .top-header {
    height: auto;
    padding: 16px;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
  
  .content-body {
    padding: 16px;
  }
}
