/* Valtheris Dashboard - dark, premium, minimalist design system matching the bot's embed branding. */

:root {
  --bg: #0b0b10;
  --bg-elevated: #131319;
  --bg-card: #16161f;
  --bg-hover: #1d1d28;
  --border: #26262f;
  --text: #e8e8ee;
  --text-muted: #9a9aa8;
  --text-faint: #6b6b78;

  --brand: #8b5cf6;
  --brand-hover: #7c4ded;
  --success: #2ecc71;
  --error: #e74c3c;
  --warning: #f5a623;
  --info: #5aa9e6;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

.layout {
  display: flex;
  min-height: 100vh;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 20px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.2px;
}

.sidebar-brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 12px var(--brand);
}

.nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 16px 10px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.nav-link:hover { background: var(--bg-hover); color: var(--text); }
.nav-link.active { background: rgba(139, 92, 246, 0.14); color: var(--brand); }

.sidebar-user {
  margin-top: 20px;
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-user .name { font-size: 13px; font-weight: 600; }
.sidebar-user .logout { font-size: 12px; color: var(--text-faint); }
.sidebar-user .logout:hover { color: var(--error); }

/* ---------------- Main ---------------- */
.main { flex: 1; min-width: 0; }

.topbar {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 { margin: 0; font-size: 20px; font-weight: 700; }
.topbar p { margin: 2px 0 0; color: var(--text-muted); font-size: 13px; }

.content { padding: 28px 32px 60px; max-width: 1100px; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}

.card h2 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.card .subtitle { color: var(--text-muted); font-size: 13px; margin: 0 0 18px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.stat-tile {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.stat-tile .value { font-size: 26px; font-weight: 700; }
.stat-tile .label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------------- Forms ---------------- */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.field { margin-bottom: 18px; }
.field-hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; }

input[type="text"], input[type="number"], input[type="password"], input[type="email"],
input[type="url"], textarea, select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
}

textarea { resize: vertical; min-height: 80px; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: auto; }

.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row > .field { flex: 1; min-width: 180px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-danger { background: transparent; border-color: var(--error); color: var(--error); }
.btn-danger:hover { background: rgba(231, 76, 60, 0.12); }
.btn-sm { padding: 6px 10px; font-size: 12px; }

/* ---------------- Tables ---------------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-faint); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
.empty-row td { color: var(--text-faint); text-align: center; padding: 24px; }

/* ---------------- Badges ---------------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-success { background: rgba(46, 204, 113, 0.15); color: var(--success); }
.badge-error { background: rgba(231, 76, 60, 0.15); color: var(--error); }
.badge-warning { background: rgba(245, 166, 35, 0.15); color: var(--warning); }
.badge-info { background: rgba(90, 169, 230, 0.15); color: var(--info); }
.badge-muted { background: var(--bg-elevated); color: var(--text-faint); }

/* ---------------- Toasts ---------------- */
.toasts { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--success); box-shadow: var(--shadow); padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; min-width: 240px; animation: slide-in 0.2s ease-out; }
.toast.error { border-left-color: var(--error); }

@keyframes slide-in { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---------------- Modal ---------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none; align-items: center; justify-content: center; z-index: 300; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: 420px; max-width: 90vw; box-shadow: var(--shadow); }
.modal h3 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------------- Embed live preview ---------------- */
.discord-preview {
  background: #313338;
  border-radius: var(--radius);
  padding: 16px;
  font-family: "gg sans", "Inter", sans-serif;
  color: #dbdee1;
}

.discord-embed {
  border-left: 4px solid #8b5cf6;
  background: #2b2d31;
  border-radius: 4px;
  padding: 12px 16px;
  max-width: 480px;
}

.discord-embed .author { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #dbdee1; }
.discord-embed .title { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.discord-embed .description { font-size: 13px; color: #dbdee1; white-space: pre-wrap; margin-bottom: 10px; }
.discord-embed .fields { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
.discord-embed .fields.has-inline { grid-template-columns: 1fr 1fr; }
.discord-embed .field-name { font-size: 12px; font-weight: 700; color: #fff; margin-bottom: 2px; }
.discord-embed .field-value { font-size: 12px; color: #dbdee1; }
.discord-embed .thumbnail { float: right; width: 64px; height: 64px; border-radius: 4px; object-fit: cover; margin-left: 10px; }
.discord-embed .image { width: 100%; border-radius: 4px; margin-top: 10px; }
.discord-embed .footer { font-size: 11px; color: #949ba4; margin-top: 10px; }

/* ---------------- Misc ---------------- */
.access-denied, .login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  gap: 12px;
  padding: 20px;
}

.access-denied .icon, .login-screen .icon { font-size: 40px; }
.access-denied h1, .login-screen h1 { margin: 0; font-size: 22px; }
.access-denied p, .login-screen p { color: var(--text-muted); max-width: 420px; }

.discord-login-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: #5865f2; color: white; padding: 12px 22px;
  border-radius: var(--radius-sm); font-weight: 700; margin-top: 14px;
}
.discord-login-btn:hover { background: #4752c4; }

.reward-role-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

.placeholder-chip {
  display: inline-block; background: var(--bg-elevated); border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 999px; font-size: 12px; margin: 2px; font-family: monospace; cursor: pointer;
}
.placeholder-chip:hover { border-color: var(--brand); color: var(--brand); }

.error-list { background: rgba(231, 76, 60, 0.1); border: 1px solid rgba(231, 76, 60, 0.3); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 18px; color: var(--error); font-size: 13px; }
.error-list ul { margin: 4px 0 0; padding-left: 18px; }

.progress-bar { background: var(--bg-elevated); border-radius: 999px; height: 8px; overflow: hidden; margin-top: 10px; }
.progress-bar-fill { background: var(--brand); height: 100%; transition: width 0.3s ease; }
