/* ===== Reset & zmienne ===== */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #0b0d17;
  --bg-alt: #10131f;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e6e8ef;
  --text-dim: #9aa0b4;
  --blurple: #5865f2;
  --blurple-2: #7c3aed;
  --green: #23a55a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  background: rgba(88, 101, 242, 0.15);
  color: #b4bcff;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

.container {
  width: min(1180px, 92%);
  margin-inline: auto;
}

/* ===== Tło dekoracyjne ===== */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.35;
  z-index: -1;
  pointer-events: none;
}
.bg-glow--1 { width: 600px; height: 600px; background: var(--blurple); top: -200px; left: -200px; }
.bg-glow--2 { width: 500px; height: 500px; background: var(--blurple-2); bottom: -200px; right: -200px; }

/* ===== Nawigacja ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 13, 23, 0.7);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1rem 0; }
.nav__logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; }
.nav__logo-icon { 
  width: 48px !important; 
  height: 48px !important; 
  object-fit: contain; 
  border-radius: 8px; 
  margin-right: 8px; /* Dodatkowy odstęp od napisu Fusion Bot */
}
.nav__links { display: flex; gap: 2rem; margin-left: auto; }
.nav__links a { color: var(--text-dim); font-size: 0.95rem; font-weight: 500; transition: color 0.2s; }
.nav__links a:hover { color: var(--text); }

/* ===== Przyciski ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.btn--primary { background: linear-gradient(135deg, var(--blurple), var(--blurple-2)); color: #fff; box-shadow: 0 8px 24px rgba(88, 101, 242, 0.35); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(88, 101, 242, 0.5); }
.btn--ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn--ghost:hover { background: var(--surface-hover); }
.btn--sm { padding: 0.5rem 1rem; font-size: 0.9rem; }
.btn--lg { padding: 0.9rem 1.8rem; font-size: 1rem; }
.btn--xl { padding: 1.1rem 2.4rem; font-size: 1.1rem; }
.btn--danger { background: #e74c3c; color: white; }
.btn--danger:hover { background: #c0392b; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ===== Hero ===== */
.hero { padding: 6rem 0 4rem; text-align: center; }
.hero__badge { display: inline-block; padding: 0.4rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 1.5rem; }
.hero__title { font-size: clamp(2.2rem, 6vw, 4.5rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 1.5rem; }
.gradient-text { background: linear-gradient(135deg, var(--blurple), var(--blurple-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__subtitle { font-size: 1.15rem; color: var(--text-dim); max-width: 620px; margin: 0 auto 2.5rem; }
.hero__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; max-width: 620px; margin-inline: auto; }
.stat { padding: 1.5rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.stat__value { font-size: 2rem; font-weight: 800; background: linear-gradient(135deg, var(--blurple), var(--blurple-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat__label { font-size: 0.85rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

/* ===== Sekcje ===== */
.section { padding: 6rem 0; }
.section--alt { background: var(--bg-alt); }
.section__title { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; text-align: center; letter-spacing: -0.02em; margin: 0 0 1rem; }
.section__lead { text-align: center; color: var(--text-dim); font-size: 1.05rem; margin: 0 0 3.5rem; }

/* ===== Grid & karty ===== */
.grid--features { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.card { padding: 2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: transform 0.2s, border-color 0.2s; }
.card:hover { transform: translateY(-4px); border-color: rgba(88, 101, 242, 0.5); }
.card__icon { font-size: 2rem; margin-bottom: 1rem; }
.card__title { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.75rem; }
.card__text { color: var(--text-dim); font-size: 0.95rem; margin: 0; }

/* ===== Komendy ===== */
.commands { display: grid; gap: 1rem; max-width: 900px; margin-inline: auto; }
.command { padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: grid; grid-template-columns: auto auto 1fr; gap: 1rem; align-items: center; }
.command__name { background: linear-gradient(135deg, var(--blurple), var(--blurple-2)); color: #fff; padding: 0.4rem 0.9rem; border-radius: 8px; font-weight: 600; font-size: 0.9rem; }
.command__badge { font-size: 0.75rem; padding: 0.25rem 0.7rem; background: rgba(35, 165, 90, 0.15); color: var(--green); border-radius: 999px; font-weight: 600; white-space: nowrap; }
.command__desc { color: var(--text-dim); margin: 0; grid-column: 1 / -1; font-size: 0.95rem; }
.commands-loading { text-align: center; padding: 2rem; color: var(--text-dim); font-style: italic; grid-column: 1 / -1; }

/* ===== Panel Administratora ===== */
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; max-width: 800px; margin: 0 auto; }
.admin-auth { text-align: center; padding: 2rem 0; }
.cogs-header { display: grid; grid-template-columns: 2fr 1fr 1fr; padding: 1rem; border-bottom: 1px solid var(--border); font-weight: 600; color: var(--text-dim); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }
.cog-row { display: grid; grid-template-columns: 2fr 1fr 1fr; align-items: center; padding: 1rem; border-bottom: 1px solid var(--border); }
.cog-row:last-child { border-bottom: none; }
.cog-name { font-family: monospace; font-size: 1rem; color: var(--text); }
.cog-status { font-size: 0.85rem; font-weight: 600; }
.cog-status.loaded { color: var(--green); }
.cog-status.unloaded { color: #e74c3c; }
.cog-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

/* ===== Footer ===== */
.footer { border-top: 1px solid var(--border); padding: 2.5rem 0; background: var(--bg-alt); }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer__copy { color: var(--text-dim); font-size: 0.85rem; margin: 0; }

/* ===== Animacje wejścia ===== */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ===== Selektor serwera ===== */
.server-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.server-selector label {
  font-weight: 600;
  color: var(--text);
}
.input-select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  outline: none;
  min-width: 250px;
}
.input-select:focus {
  border-color: var(--blurple);
}

/* ===== Zakładki (Tabs) ===== */
.tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.tab-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--blurple);
  border-bottom-color: var(--blurple);
}
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* ===== Ustawienia Cogów ===== */
.cog-settings-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}
.cog-settings-box h4 { margin-top: 0; color: var(--text); }

.cog-settings-desc {
  color: var(--text-dim);
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.cog-settings-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.75rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-field > label {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 500;
}

.form-field input[type="text"],
.form-field input[type="number"],
.form-field textarea,
.form-field select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--blurple);
}

.form-field textarea {
  resize: vertical;
  min-height: 80px;
}

.form-field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
}

.form-field--checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--blurple);
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}

.form-field--checkbox span {
  font-size: 0.95rem;
  color: var(--text);
}

.cog-settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 0.5rem;
}

.cog-settings-status {
  font-size: 0.9rem;
  color: var(--text-dim);
  transition: color 0.2s;
}

.cog-settings-status.success { color: var(--green); }
.cog-settings-status.error   { color: #e74c3c; }

/* ===== Menedżer YouTube ===== */
.yt-manager-container {
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
  padding-top: 1.5rem;
}

.yt-add-form {
  background: var(--bg);
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.yt-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 768px) {
  .yt-form-grid { grid-template-columns: 1fr; }
}

.yt-channels-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- Nowy layout wiersza kanału (naprawa uciętych przycisków) --- */
.yt-channel-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

@media (min-width: 900px) {
  .yt-channel-row {
    flex-direction: row;
    align-items: flex-start;
  }
}

.yt-channel-row > div:first-child {
  flex: 1;
  min-width: 200px;
}

.yt-row-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  flex: 3;
}

.yt-row-settings .form-field {
  flex: 1;
  min-width: 150px;
}

.yt-row-actions {
  display: flex;
  gap: 0.5rem;
  align-self: flex-end;
  padding-bottom: 2px;
}

.yt-row-actions .btn {
  white-space: nowrap;
}

/* --- Naprawa wyglądu pola wyboru wielu ról (ciemny motyw) --- */
select[multiple] {
  background-color: var(--bg) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem;
  outline: none;
  cursor: pointer;
  /* Ważne dla przeglądarek opartych na Chromium: */
  scrollbar-width: thin;
  scrollbar-color: var(--blurple) var(--bg);
}

select[multiple]:focus {
  border-color: var(--blurple);
}

/* Wymuszenie ciemnego tła dla poszczególnych opcji */
select[multiple] option {
  background-color: var(--bg);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 2px;
}

/* Wygląd zaznaczonej opcji (zamiast systemowego szarego) */
select[multiple] option:checked {
  background: linear-gradient(135deg, var(--blurple), var(--blurple-2)) !important;
  color: white !important;
  font-weight: 600;
}

/* Specjalny fix dla Chrome/Edge, aby usunąć systemowy biały prostokąt zaznaczenia */
select[multiple] option:checked::before {
  content: "" !important;
}

/* Przycisk logowania przez Discord */
.btn--discord {
  background: #5865F2;
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn--discord:hover {
  background: #4752C4;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.4);
}
.btn--discord svg {
  fill: currentColor;
}