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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }

:root {
  --accent:       #5865F2;
  --accent-glow:  rgba(88, 101, 242, 0.18);
  --accent-dim:   rgba(88, 101, 242, 0.08);

  --bg:           #0b0c10;

  --surface:      #13151c;
  --surface-2:    #1a1d27;
  --surface-3:    #20232f;
  --surface-hover: #1e2130;

  --border:       rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.12);

  --text:         #eceef5;
  --text-2:       #9ea3b8;
  --muted:        #555b75;

  --danger:       #ed4245;
  --danger-dim:   rgba(237, 66, 69, 0.12);
  --success:      #3ba55d;
  --success-dim:  rgba(59, 165, 93, 0.12);
  --warn:         #faa81a;

  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;

  --shadow-sm:    0 1px 3px rgba(0,0,0,0.4);
  --shadow:       0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:    0 12px 40px rgba(0,0,0,0.6);

  --font:         'Sora', system-ui, sans-serif;
  --mono:         'JetBrains Mono', monospace;

  --navbar-h:     56px;
  --sidebar-w:    320px;
  --transition:   0.18s ease;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(11, 12, 16, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text);
  transition: opacity var(--transition);
}

.nav-brand .ti { font-size: 18px; color: var(--accent); }
.nav-brand:hover { opacity: 0.8; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
}

.nav-user .btn-sm {
  border-radius: 99px;
  padding: 4px 8px;
}

.nav-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-2);
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform 0.1s;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}

.btn:hover { background: var(--surface-3); color: var(--text); }
.btn:active { transform: scale(0.975); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-danger {
  background: var(--danger-dim);
  border-color: rgba(237, 66, 69, 0.25);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}

.btn-ghost:hover { background: var(--surface-3); color: var(--text); border-color: var(--border); }

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  gap: 5px;
}

.icon-btn {
  width: 28px; height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-dim); color: var(--danger); }

/* ── Badge ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.badge-live {
  background: rgba(59, 165, 93, 0.12);
  color: #3ba55d;
  border-color: rgba(59, 165, 93, 0.25);
}

.badge-ended {
  background: var(--surface-3);
  color: var(--muted);
  border-color: var(--border-strong);
}

/* ── Form inputs ─────────────────────────────────────────── */
input[type="text"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 80px; line-height: 1.55; }

select {
  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='%23555b75' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

select option { background: var(--surface-2); color: var(--text); }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.opt-label { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; color: var(--muted); }
.field-group { display: flex; flex-direction: column; gap: 6px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Panel ───────────────────────────────────────────────── */
.panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.panel-title .ti { color: var(--accent); }

/* ── Main layout ─────────────────────────────────────────── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 28px 80px;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--text);
}

.text-muted { color: var(--text-2); font-size: 14px; margin-top: 4px; }

/* ── Poll grid (dashboard) ───────────────────────────────── */
.poll-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.poll-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  animation: card-in 0.3s ease both;
}

.poll-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

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

.poll-card-bar { height: 3px; flex-shrink: 0; }

.poll-card-body {
  padding: 18px 20px 14px;
  flex: 1;
}

.poll-card-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.poll-card-question {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  margin-bottom: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.poll-card-timer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-bar-track {
  flex: 1;
  height: 3px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1s linear;
}

.timer-text {
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.poll-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 14px;
  flex-wrap: wrap;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 100px 20px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-state .ti { font-size: 52px; display: block; }
.empty-state h2 { font-size: 20px; font-weight: 700; color: var(--text-2); }
.empty-state p  { font-size: 14px; max-width: 300px; line-height: 1.6; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
  flex-direction: column;
}

.login-wrap {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  animation: fade-up 0.35s ease both;
}

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

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.login-brand-name {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

.login-brand-sub {
  font-size: 13px;
  color: var(--accent);
  text-align: center;
}

.login-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.btn-discord {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  background: #5865F2;
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 20px rgba(88,101,242,0.35);
}

.btn-discord .ti { font-size: 19px; }
.btn-discord:hover { background: #4752c4; box-shadow: 0 6px 28px rgba(88,101,242,0.45); }
.btn-discord:active { transform: scale(0.98); }

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-perks { display: flex; flex-direction: column; gap: 9px; }

.login-perk {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
}

.login-perk .ti { font-size: 15px; color: var(--accent); flex-shrink: 0; }

.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--danger-dim);
  border: 1px solid rgba(237,66,69,0.25);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

.login-footer {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

/* ── Delete modal ────────────────────────────────────────── */
#delete-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#delete-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  max-width: 400px;
  width: calc(100% - 40px);
  box-shadow: var(--shadow-card);
  animation: fade-up 0.2s ease;
  text-align: center;
}

#delete-modal-icon {
  width: 52px; height: 52px;
  background: var(--danger-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 22px;
  color: var(--danger);
}

#delete-modal h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

#delete-modal p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 24px;
}

#delete-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ── Tabler icon alignment ───────────────────────────────── */
.ti { display: inline-block; vertical-align: middle; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .main    { padding: 20px 16px 60px; }
  .navbar  { padding: 0 16px; }
  .poll-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .nav-username { display: none; }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  transition: color var(--transition), background var(--transition);
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.poll-card-actions .btn-sm {
  height: 30px;
  padding-top: 0;
  padding-bottom: 0;
}