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

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

:root {
  --bg:       #1a1a2e;
  --surface:  #16213e;
  --surface2: #0f3460;
  --accent:   #5865f2;
  --accent-h: #4752c4;
  --accent-glow: rgba(88, 101, 242, 0.18);
  --text:     #e0e0e0;
  --text-dim: #8e9297;
  --success:  #3ba55c;
  --danger:   #ed4245;
  --radius:   10px;
  --radius-sm: 6px;
  --sidebar:  248px;
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 0.95rem;
  font-weight: 400;
}

/* ── Login page ─────────────────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(88,101,242,0.08) 0%, transparent 70%), var(--bg);
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 3rem;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 24px 64px rgba(0,0,0,0.5);
}

.login-card h1 {
  font-family: 'Syne', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.login-card p { color: var(--text-dim); margin-bottom: 2rem; font-weight: 300; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.6rem 1.3rem;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-discord      { background: var(--accent); color: #fff; box-shadow: 0 2px 12px rgba(88,101,242,0.35); }
.btn-discord:hover { background: var(--accent-h); box-shadow: 0 4px 20px rgba(88,101,242,0.45); }
.btn-save         { background: var(--success); color: #fff; }
.btn-save:hover   { background: #2d8049; }
.btn-sm           { padding: 0.3rem 0.75rem; font-size: 0.82rem; border-radius: var(--radius-sm); }
.btn-danger       { background: var(--danger); color: #fff; }

/* ── Guild picker ──────────────────────────────────────────────────────────── */
.page-header {
  padding: 1rem 2rem;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}

.page-header h1 {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-header .user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.guild-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.875rem;
  padding: 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

.guild-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05);
}

.guild-card:hover {
  background: var(--surface2);
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px rgba(88,101,242,0.3), 0 8px 24px rgba(0,0,0,0.3);
}

.guild-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--surface2);
  object-fit: cover;
}

.guild-icon-placeholder {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--surface2));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-size: 1.3rem; font-weight: 700;
}

.guild-name { font-weight: 500; font-size: 0.9rem; }

/* ── Dashboard layout ────────────────────────────────────────────────────────── */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar);
  background: var(--surface);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.sidebar-header {
  padding: 1.25rem 1.1rem;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05);
}

.sidebar-header .guild-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  word-break: break-word;
  letter-spacing: -0.01em;
}

.sidebar-header .back-link {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-decoration: none;
  display: block;
  margin-bottom: 0.6rem;
  transition: color 0.1s;
}

.sidebar-header .back-link:hover { color: var(--text); }

.sidebar-nav { flex: 1; padding: 0.625rem 0.5rem; overflow-y: auto; }

.nav-section {
  padding: 0.5rem 0.6rem 0.25rem;
  font-family: 'Syne', sans-serif;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  opacity: 0.7;
}

.nav-item {
  display: block;
  padding: 0.475rem 0.75rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 400;
  border-radius: var(--radius-sm);
  margin-bottom: 1px;
  transition: color 0.1s, background 0.1s;
  cursor: pointer;
}

.nav-item:hover   { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-item.active  {
  color: #fff;
  background: var(--accent-glow);
  font-weight: 500;
  box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar-footer {
  padding: 0.875rem 1.1rem;
  box-shadow: 0 -1px 0 rgba(255,255,255,0.05);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.main-content {
  margin-left: var(--sidebar);
  flex: 1;
  padding: 2.25rem 2.5rem;
  max-width: calc(var(--sidebar) + 820px);
}

/* ── Sections ──────────────────────────────────────────────────────────────── */
.section { display: none; }
.section.active { display: block; }

.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  color: #fff;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 0.875rem;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 2px 8px rgba(0,0,0,0.2);
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  margin-bottom: 1rem;
}

/* ── Form elements ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

label {
  display: block;
  font-family: 'Syne', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.55rem 0.8rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 400;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
input[type="number"] { width: 100px; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 0.9rem; font-weight: 500; }
.toggle-label small { display: block; color: var(--text-dim); font-size: 0.8rem; font-weight: 300; margin-top: 0.1rem; }

.toggle {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.radio-group { display: flex; gap: 1rem; padding: 0.25rem 0; }
.radio-group label {
  text-transform: none;
  letter-spacing: 0;
  font-family: 'Outfit', sans-serif;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 400;
}

.embed-fields { margin-top: 0.875rem; display: none; }
.embed-fields.visible { display: block; }

input[type="color"] {
  width: 44px; height: 36px;
  padding: 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--bg);
}

/* ── Save feedback ──────────────────────────────────────────────────────────── */
.save-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

.save-feedback {
  font-size: 0.85rem;
  color: var(--success);
  opacity: 0;
  transition: opacity 0.3s;
}

.save-feedback.visible { opacity: 1; }
.save-feedback.error   { color: var(--danger); }

/* ── Hint text ──────────────────────────────────────────────────────────────── */
.hint {
  font-size: 0.79rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
  font-weight: 300;
  line-height: 1.5;
}

/* ── Format tips box ────────────────────────────────────────────────────────── */
.format-tips {
  margin-top: 0.6rem;
  padding: 0.75rem 1rem;
  background: rgba(88,101,242,0.07);
  border: 1px solid rgba(88,101,242,0.2);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.format-tips .hint { margin-top: 0; }

.format-tips code {
  font-family: 'Courier New', monospace;
  font-size: 0.8em;
  background: rgba(255,255,255,0.08);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  color: #c9d1f7;
}

/* ── Char counter ───────────────────────────────────────────────────────────── */
.textarea-wrap { position: relative; }

.char-counter {
  position: absolute;
  bottom: 0.4rem;
  right: 0.6rem;
  font-size: 0.73rem;
  color: var(--text-dim);
  pointer-events: none;
  font-family: 'Syne', sans-serif;
  opacity: 0.7;
  transition: color 0.15s;
}

.char-counter.warn  { color: #f0b429; opacity: 1; }
.char-counter.over  { color: var(--danger); opacity: 1; }

.textarea-wrap textarea { padding-bottom: 1.75rem; }

/* ── Error text ─────────────────────────────────────────────────────────────── */
.error-text { color: var(--danger); font-size: 0.85rem; margin-top: 0.5rem; }

/* ── Multi-select roles ──────────────────────────────────────────────────────── */
select[multiple] { height: 120px; }

/* ── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .sidebar { width: 100%; height: auto; position: relative; }
  .main-content { margin-left: 0; padding: 1.5rem; }
  .dashboard-layout { flex-direction: column; }
}
