/* ============================================
   Discord-Themed Dark Design System
   ============================================ */

/* --- CSS Variables (Discord palette) --- */
:root {
  --bg-primary: #1e1f22;
  --bg-secondary: #2b2d31;
  --bg-tertiary: #313338;
  --bg-floating: #232428;
  --bg-hover: #35373c;
  --bg-active: #3f4147;
  --bg-accent: #404249;

  --text-primary: #f2f3f5;
  --text-secondary: #b5bac1;
  --text-muted: #6d6f78;
  --text-link: #00a8fc;

  --brand-primary: #5865f2;
  --brand-hover: #4752c4;
  --brand-active: #3c45a5;

  --green: #23a559;
  --green-hover: #1a8245;
  --red: #da373c;
  --red-hover: #a12828;
  --yellow: #f0b232;
  --yellow-hover: #cc9621;

  --border-subtle: #3f4147;
  --border-strong: #4e5058;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-low: 0 1px 4px rgba(0,0,0,0.3);
  --shadow-med: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-high: 0 8px 32px rgba(0,0,0,0.6);

  --font-primary: 'gg sans', 'Noto Sans', Helvetica, Arial, sans-serif;
  --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;

  --transition-fast: 0.15s ease;
  --transition-med: 0.25s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Scrollbar (Discord style) --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* --- Typography --- */
h1 { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); }
h2 { font-size: 1.375rem; font-weight: 700; color: var(--text-primary); }
h3 { font-size: 1.125rem; font-weight: 600; color: var(--text-primary); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }
.mono { font-family: var(--font-mono); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), opacity var(--transition-fast);
  color: #fff;
  line-height: 1.4;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-primary { background: var(--brand-primary); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-primary:active:not(:disabled) { background: var(--brand-active); }

.btn-success { background: var(--green); }
.btn-success:hover:not(:disabled) { background: var(--green-hover); }

.btn-danger { background: var(--red); }
.btn-danger:hover:not(:disabled) { background: var(--red-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }

.btn-lg { padding: 12px 24px; font-size: 1rem; border-radius: var(--radius-md); }
.btn-sm { padding: 4px 10px; font-size: 0.8125rem; }
.btn-block { width: 100%; }

/* --- Inputs --- */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.input {
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color var(--transition-fast);
}
.input:focus { border-color: var(--brand-primary); }
.input::placeholder { color: var(--text-muted); }
.input-error { border-color: var(--red) !important; }

/* --- Cards --- */
.card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border-subtle);
}
.card-elevated {
  background: var(--bg-floating);
  box-shadow: var(--shadow-med);
}

/* --- Badges / Chips --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-common { background: #43444b; color: var(--text-secondary); }
.badge-uncommon { background: #1a5c2e; color: #57f287; }
.badge-rare { background: #1a3a6b; color: #5dadec; }
.badge-legendary { background: #6b3a1a; color: #faa61a; }
.badge-mythical { background: #5c1a6b; color: #e292f7; }
.badge-special { background: #6b1a2a; color: #ff6b81; }

.badge-pending { background: #5a4b1a; color: var(--yellow); }
.badge-confirmed { background: #1a4b2e; color: var(--green); }
.badge-failed { background: #4b1a1a; color: var(--red); }
.badge-processing { background: #1a3a5a; color: #5dadec; }

/* --- Tables --- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}
td {
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* --- Layout helpers --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.gap-xl { gap: 32px; }
.grow { flex: 1; }
.w-full { width: 100%; }
.mt-auto { margin-top: auto; }

/* --- Spinner --- */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-lg { width: 40px; height: 40px; border-width: 4px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Toast / Notification --- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-floating);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-high);
  color: var(--text-primary);
  font-size: 0.875rem;
  animation: slideIn 0.25s ease;
  max-width: 360px;
}
.toast-success { border-left: 4px solid var(--green); }
.toast-error { border-left: 4px solid var(--red); }
.toast-info { border-left: 4px solid var(--brand-primary); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* --- Modal/Overlay --- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--bg-floating);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-high);
}
.modal-header {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
}

/* --- Utility --- */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
