/* ============================================================
   MidnightBot Dashboard — Linear.app Dark Theme
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  --color-bg: #08090a;
  --color-panel: #0f1011;
  --color-surface: #191a1b;
  --color-text: #f7f8f8;
  --color-text-secondary: #d0d6e0;
  --color-text-muted: #8a8f98;
  --color-text-subtle: #62666d;
  --color-accent: #5e6ad2;
  --color-accent-hover: #828fff;
  --color-accent-muted: rgba(94, 106, 210, 0.15);
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-subtle: rgba(255, 255, 255, 0.05);
  --color-ghost-bg: rgba(255, 255, 255, 0.02);
  --color-hover: rgba(255, 255, 255, 0.04);
  --color-danger: #e5484d;
  --color-success: #30a46c;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-card: 10px;
  --radius-pill: 9999px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, sans-serif;
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --sidebar-width: 260px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text-secondary);
  background-color: var(--color-bg);
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  background-position: 0 0;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ============================================================
   Hamburger (mobile)
   ============================================================ */
.hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.hamburger__line {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--color-text-secondary);
  border-radius: 2px;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

/* Features FAB (mobile only, hidden by default) */
.features-fab {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.features-fab:active {
  transform: translateX(-50%) scale(0.92);
}

.features-fab svg {
  width: 24px;
  height: 24px;
}

/* ============================================================
   Overlay (mobile)
   ============================================================ */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.overlay--visible {
  opacity: 1;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-panel);
  border-right: 1px solid var(--color-border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.sidebar__header {
  padding: 24px 20px 18px;
  flex-shrink: 0;
}

.sidebar__logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.3px;
  transition: opacity var(--transition-fast);
}

.sidebar__logo:hover {
  opacity: 0.8;
}

.sidebar__section-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-subtle);
  padding: 4px 20px 10px;
  flex-shrink: 0;
}

/* --- Guild List --- */
.sidebar__guilds {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

.sidebar__guilds::-webkit-scrollbar {
  width: 4px;
}

.sidebar__guilds::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar__guilds::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

/* --- Guild Item --- */
.guild-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 1px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 400;
  border-left: 2px solid transparent;
  position: relative;
  user-select: none;
}

/* Separator between guild items */
.guild-item::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 1px;
  background: var(--color-border-subtle);
  opacity: 0.6;
}

.guild-item:last-child::after {
  display: none;
}

.guild-item:hover {
  background: #191a1b;
  color: var(--color-text-secondary);
  border-left-color: rgba(255,255,255,0.06);
}

.guild-item--active {
  background: #191a1b;
  color: var(--color-text);
  border-left-color: var(--color-accent);
  border-radius: var(--radius-md);
}

.guild-item--active::after {
  opacity: 0.3;
}

.guild-item__icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-ghost-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.guild-item__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guild-item__name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guild-item__badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-muted);
  color: var(--color-accent);
  font-weight: 500;
  flex-shrink: 0;
}

.guild-item--no-bot {
  cursor: default;
}

/* --- Guild section label --- */
.guild-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-subtle);
  padding: 16px 12px 6px;
}

.guild-section-label:first-child {
  padding-top: 4px;
}

/* --- Add bot button --- */
.guild-item__add-btn {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.guild-item__add-btn:hover {
  background: var(--color-accent-hover);
}

/* --- Loading skeleton in guild list --- */
.guild-skeleton {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 1px;
}

/* ============================================================
   Sidebar User Section
   ============================================================ */
.sidebar__user {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border-subtle);
  flex-shrink: 0;
}

.sidebar__user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sidebar__user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-ghost-bg);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar__user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar__user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__user-skeleton {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar__logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar__logout:hover {
  background: var(--color-hover);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

/* ============================================================
   Skeleton loading
   ============================================================ */
.skeleton {
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton--circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.skeleton--text {
  height: 12px;
  width: 100px;
  border-radius: 4px;
}

.skeleton--text-wide {
  height: 12px;
  width: 160px;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

/* ============================================================
   Main Content Area
   ============================================================ */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: radial-gradient(ellipse at 50% 0%, rgba(94,106,210,0.03) 0%, transparent 60%);
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
}

.empty-state__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 48px 40px;
  background: var(--color-panel);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
}

.empty-state__icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-ghost-bg);
  color: var(--color-text-subtle);
  opacity: 0.6;
  transition: opacity var(--transition-base);
}

.empty-state:hover .empty-state__icon {
  opacity: 0.8;
}

.empty-state__heading {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.3px;
}

.empty-state__text {
  font-size: 14px;
  color: var(--color-text-muted);
  max-width: 300px;
  line-height: 1.6;
}

/* ============================================================
   Settings Panel
   ============================================================ */
.settings-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 32px 32px 0 32px;
  margin: 0;
  min-height: 0;
  overflow: hidden;
}

.settings-panel__header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.settings-panel__guild-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border-subtle);
}

.settings-panel__guild-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-panel__title {
  font-size: 26px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.settings-panel__subtitle {
  font-size: 13px;
  color: var(--color-text-subtle);
  margin-top: 2px;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

/* Premium badge in header (next to guild name/ID) */
.settings-panel__premium-badge {
  margin-left: 16px;
  flex-shrink: 0;
  max-width: 380px;
}

.settings-panel__premium-badge .sub-banner {
  padding: 6px 12px;
  font-size: 12px;
  gap: 8px;
  border-radius: var(--radius-md);
}

.settings-panel__premium-badge .sub-banner__icon {
  font-size: 18px;
}

.settings-panel__premium-badge .sub-banner__info strong {
  font-size: 11px;
}

.settings-panel__premium-badge .sub-banner__info p {
  font-size: 11px;
  line-height: 1.4;
}

.settings-panel__premium-badge .sub-banner__cancel {
  font-size: 11px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* ============================================================
   Tabs (DEPRECATED - kept for potential reuse)
   ============================================================ */
.tabs-wrapper {
  display: none;
}
.tabs, .tab, .tabs__arrow {
  display: none;
}

/* ============================================================
   Features Layout (vertical feature nav + content)
   ============================================================ */
.features-layout {
  display: flex;
  flex: 1;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

/* --- Feature Navigation (middle column) --- */
.features-nav {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px 20px 0;
  border-right: 1px solid var(--color-border-subtle);
  overflow-y: auto;
  overflow-x: hidden;
}

.features-nav::-webkit-scrollbar {
  width: 3px;
}

.features-nav::-webkit-scrollbar-track {
  background: transparent;
}

.features-nav::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 13.5px;
  font-weight: 450;
  letter-spacing: -0.1px;
  border: none;
  border-left: 2.5px solid transparent;
  background: transparent;
  text-align: left;
  width: 100%;
  font-family: var(--font-sans);
  transition: background var(--transition-fast) cubic-bezier(0.22, 1, 0.36, 1),
    color var(--transition-fast) cubic-bezier(0.22, 1, 0.36, 1),
    border-color var(--transition-fast) cubic-bezier(0.22, 1, 0.36, 1),
    transform var(--transition-fast) cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow var(--transition-fast) cubic-bezier(0.22, 1, 0.36, 1);
  user-select: none;
  white-space: nowrap;
  position: relative;
  outline: none;
}

.feature-item::after {
  content: '→';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  font-size: 13px;
  opacity: 0;
  color: var(--color-accent);
  transition: opacity var(--transition-fast) cubic-bezier(0.22, 1, 0.36, 1),
    transform var(--transition-fast) cubic-bezier(0.22, 1, 0.36, 1);
}

.feature-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text);
  border-left-color: rgba(255, 255, 255, 0.12);
  padding-left: 20px;
  transform: translateX(2px);
}

.feature-item:hover::after {
  opacity: 0.5;
  transform: translateY(-50%) translateX(0);
}

.feature-item:active {
  transform: translateX(1px) scale(0.985);
}

.feature-item--active {
  background: linear-gradient(135deg, rgba(94, 106, 210, 0.12) 0%, rgba(94, 106, 210, 0.05) 100%);
  color: var(--color-text);
  border-left-color: var(--color-accent);
  font-weight: 500;
  box-shadow: inset 0 0 20px rgba(94, 106, 210, 0.05);
}

.feature-item--active:hover {
  padding-left: 16px;
  transform: none;
  background: linear-gradient(135deg, rgba(94, 106, 210, 0.15) 0%, rgba(94, 106, 210, 0.07) 100%);
}

.feature-item--active::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
  color: var(--color-accent);
}

.feature-item--premium {
  border-left-color: rgba(240, 168, 48, 0.3) !important;
  background: linear-gradient(90deg, rgba(240,168,48,0.06) 0%, transparent 100%);
}

.feature-item--premium.feature-item--active {
  border-left-color: #f0a830 !important;
  background: linear-gradient(90deg, rgba(240,168,48,0.12) 0%, rgba(240,168,48,0.04) 100%);
}

.features-nav__separator {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #f0a830;
  padding: 16px 16px 8px;
  margin-top: 4px;
  border-top: 1px solid rgba(240,168,48,0.15);
  display: flex;
  align-items: center;
  gap: 6px;
}

.feature-item__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  opacity: 0.65;
  transition: transform var(--transition-fast) cubic-bezier(0.22, 1, 0.36, 1),
    opacity var(--transition-fast) cubic-bezier(0.22, 1, 0.36, 1);
}

.feature-item:hover .feature-item__icon {
  opacity: 0.9;
  transform: scale(1.1);
}

.feature-item--active .feature-item__icon {
  opacity: 1;
  transform: scale(1.05);
}

.feature-item__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Feature Content (right column) --- */
.features-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 20px 36px;
  min-width: 0;
}

.features-content::-webkit-scrollbar {
  width: 4px;
}

.features-content::-webkit-scrollbar-track {
  background: transparent;
}

.features-content::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

/* Feature panels */
.feature-panel {
  display: none;
}

.feature-panel--active {
  display: block;
}

/* ============================================================
   Form Styles
   ============================================================ */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group__label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.1px;
}

.form-group__desc {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.45;
  margin-bottom: 6px;
}

.form-group__input {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-ghost-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast);
  letter-spacing: -0.1px;
}

.form-group__input:hover:not(:disabled) {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.03);
}

.form-group__input::placeholder {
  color: var(--color-text-subtle);
}

.form-group__input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-muted);
  background: rgba(255,255,255,0.03);
}

.form-group__input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- Select Dropdown --- */
.form-group__select {
  width: 100%;
  padding: 10px 14px;
  padding-right: 36px;
  background: var(--color-ghost-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast);
  letter-spacing: -0.1px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8f98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  margin-bottom: 8px;
}

.form-group__select:hover {
  border-color: rgba(255,255,255,0.12);
  background-color: rgba(255,255,255,0.03);
}

.form-group__select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-muted);
  background-color: rgba(255,255,255,0.03);
}

.form-group__select option {
  background: var(--color-surface);
  color: var(--color-text);
  padding: 8px;
}

.form-group__actions {
  padding-top: 12px;
}

/* --- Checkbox --- */
.form-group__checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  letter-spacing: -0.1px;
}

.form-group__checkbox {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-ghost-bg);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all var(--transition-fast);
  position: relative;
}

.form-group__checkbox:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.form-group__checkbox:checked::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 5px;
  width: 5px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.form-group__checkbox:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Form notice banner --- */
.form-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.form-notice svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--color-accent);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.15px;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast), transform var(--transition-fast),
    box-shadow var(--transition-fast), opacity var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn--primary {
  background: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
}

.btn--primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  box-shadow: 0 2px 12px rgba(94, 106, 210, 0.35);
}

.btn--primary:active {
  transform: scale(0.98);
}

.btn--primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn--loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn--loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   Toast Notifications
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 400;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.3s ease;
  max-width: 360px;
  letter-spacing: -0.1px;
}

.toast--success {
  border-left: 3px solid var(--color-success);
}

.toast--error {
  border-left: 3px solid var(--color-danger);
}

.toast--out {
  animation: toast-out 0.25s ease forwards;
}

.toast__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.toast__message {
  flex: 1;
  line-height: 1.4;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
}

/* ============================================================
   Spinner (full-page)
   ============================================================ */
.spinner-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  z-index: 500;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ============================================================
   Responsive: Tablet
   ============================================================ */
@media (max-width: 1024px) {
  .settings-panel {
    padding: 24px 24px 0 24px;
  }

  .settings-panel__title {
    font-size: 22px;
  }

  .features-nav {
    width: 200px;
  }

  .features-content {
    padding-left: 24px;
  }
}

/* ============================================================
   Responsive: Mobile (<768px)
   ============================================================ */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .features-fab {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

  .sidebar--open {
    transform: translateX(0);
  }

  .overlay {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
  }

  .overlay--visible {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    margin-left: 0;
    padding-top: 52px;
  }

  .settings-panel {
    padding: 16px 16px 0 16px;
  }

  .settings-panel__header {
    gap: 12px;
    padding-bottom: 20px;
  }

  .settings-panel__guild-icon {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .settings-panel__title {
    font-size: 20px;
  }

  .empty-state__inner {
    padding: 36px 24px;
    max-width: 100%;
  }

  /* Premium badge in header — mobile */
  .settings-panel__header {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .settings-panel__premium-badge {
    margin-left: 16px;
    max-width: 100%;
  }

  .settings-panel__premium-badge .sub-banner {
    justify-content: flex-start;
  }
  .features-layout {
    flex-direction: column;
    position: relative;
  }

  .features-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 95;
    background: var(--color-panel);
    border-bottom: 1px solid var(--color-border-subtle);
    padding: 60px 16px 16px 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    max-height: 50vh;
  }

  .features-nav--open {
    display: flex;
    animation: slide-down 0.25s ease;
  }

  @keyframes slide-down {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
  }

  .features-content {
    padding-left: 0;
    padding-top: 4px;
  }

  .form-group__input {
    padding: 10px 12px;
  }

  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    max-width: 100%;
  }
}

/* ============================================================
   API Keys Panel
   ============================================================ */
.apikeys-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.apikeys-header {
  margin-bottom: 4px;
}

.apikeys-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.2px;
  margin-bottom: 4px;
}

.apikeys-desc {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.apikeys-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  background: var(--color-ghost-bg);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}

.apikeys-input-row {
  display: flex;
  gap: 8px;
}

.apikeys-input-row .form-group__input {
  flex: 1;
}

.apikeys-toggle-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-ghost-bg);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.apikeys-toggle-btn:hover {
  background: var(--color-hover);
  border-color: rgba(255,255,255,0.12);
  color: var(--color-text-secondary);
}

.apikeys-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.apikeys-list-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  letter-spacing: -0.1px;
}

.apikeys-list-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.apikeys-empty {
  font-size: 13px;
  color: var(--color-text-subtle);
  padding: 20px;
  text-align: center;
  border: 1px dashed var(--color-border-subtle);
  border-radius: var(--radius-md);
}

.apikeys-empty--error {
  color: var(--color-danger);
  border-color: rgba(229, 72, 77, 0.3);
}

.apikeys-loading {
  font-size: 13px;
  color: var(--color-text-muted);
  padding: 20px;
  text-align: center;
}

.apikeys-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--color-ghost-bg);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.apikeys-item:hover {
  border-color: var(--color-border);
}

.apikeys-item__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.apikeys-item__provider {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.apikeys-item__key {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 13px;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apikeys-item__meta {
  font-size: 11px;
  color: var(--color-text-subtle);
}

.apikeys-delete-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.apikeys-delete-btn:hover {
  background: rgba(229, 72, 77, 0.1);
  border-color: rgba(229, 72, 77, 0.3);
  color: var(--color-danger);
}

/* Ghost button variant */
.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.btn--ghost:hover {
  background: var(--color-hover);
  color: var(--color-text-secondary);
  border-color: rgba(255,255,255,0.12);
}

/* ============================================================
   List Panel (used by Streamers, Reminders, Monitored, Autoroles)
   ============================================================ */
.list-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.list-panel-header {
  margin-bottom: 4px;
}

.list-panel-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.2px;
  margin-bottom: 4px;
}

.list-panel-desc {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.list-panel-form {
  padding: 16px;
  background: var(--color-ghost-bg);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}

.list-panel-form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

/* ============================================================
   Data List (shared list component)
   ============================================================ */
.data-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.data-list-empty {
  font-size: 13px;
  color: var(--color-text-subtle);
  padding: 20px;
  text-align: center;
  border: 1px dashed var(--color-border-subtle);
  border-radius: var(--radius-md);
}

.data-list-empty--error {
  color: var(--color-danger);
  border-color: rgba(229, 72, 77, 0.3);
}

.data-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--color-ghost-bg);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.data-list-item:hover {
  border-color: var(--color-border);
}

.data-list-item__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.data-list-item__primary {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

.data-list-item__secondary {
  font-size: 12px;
  color: var(--color-text-muted);
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

.data-list-item__badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-muted);
  color: var(--color-accent);
  font-weight: 500;
  font-family: var(--font-sans);
}

.data-list-item__delete {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.data-list-item__delete:hover {
  background: rgba(229, 72, 77, 0.1);
  border-color: rgba(229, 72, 77, 0.3);
  color: var(--color-danger);
}

/* ============================================================
   Autoroles info
   ============================================================ */
.autoroles-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.autoroles-info strong {
  color: var(--color-text);
  font-size: 14px;
}

.autoroles-note {
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0;
}

.autoroles-steps {
  margin-top: 4px;
}

.autoroles-steps p {
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 4px;
  padding-left: 8px;
  border-left: 2px solid var(--color-accent);
}

/* ============================================================
   Bot Status Widget (sidebar)
   ============================================================ */
.sidebar__status {
  padding: 10px 16px;
  border-top: 1px solid var(--color-border-subtle);
  flex-shrink: 0;
}

.sidebar__status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--color-text-subtle);
}

.sidebar__status-dot--online {
  background: var(--color-success);
  box-shadow: 0 0 6px rgba(48, 164, 108, 0.5);
}

.sidebar__status-dot--offline {
  background: var(--color-danger);
  box-shadow: 0 0 6px rgba(229, 72, 77, 0.3);
}

.sidebar__status-dot--loading {
  background: var(--color-text-subtle);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.sidebar__status-label {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 400;
}

.sidebar__status-guild-count {
  font-size: 12px;
  color: var(--color-text-subtle);
  font-weight: 400;
  margin-left: 8px;
}

.subscription-banner {
  margin-bottom: 16px;
}

.sub-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 10px;
  font-size: 14px;
}

.sub-banner--active {
  background: rgba(94, 106, 210, 0.1);
  border: 1px solid rgba(94, 106, 210, 0.25);
}

.sub-banner--canceled {
  background: rgba(240, 168, 48, 0.1);
  border: 1px solid rgba(240, 168, 48, 0.25);
}

.sub-banner--none {
  background: var(--color-ghost-bg);
  border: 1px solid var(--color-border);
}

.sub-banner__icon {
  font-size: 24px;
  flex-shrink: 0;
}

.sub-banner__info {
  flex: 1;
}

.sub-banner__info strong {
  color: var(--color-text);
  display: block;
  margin-bottom: 2px;
}

.sub-banner__info p {
  color: var(--color-text-muted);
  margin: 0;
  font-size: 13px;
}

.sub-banner__info a {
  color: var(--color-accent);
  text-decoration: underline;
}

.sub-banner__cancel {
  white-space: nowrap;
  font-size: 13px;
}
