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

/* ==========================================================================
   Red & black dashboard theme
   Two page layouts share this file:
     - sidebar pages  (tickets, claim_tickets, config_logs)  -> .sidebar + .t-content
     - topbar pages   (index, permissions)                    -> .topbar + .container
   ========================================================================== */

:root {
  color-scheme: dark;

  /* surfaces, darkest to lightest */
  --bg-base:    #0b0b0c;
  --bg-side:    #070708;
  --bg-surface: #131315;
  --bg-overlay: #1a1a1d;
  --bg-muted:   #232327;
  --input-bg:   #0e0e10;
  --border:     #2b2b30;
  --border-hi:  #3b3b42;

  /* text */
  --text-bright: #f4f4f5;
  --text-main:   #d6d6da;
  --text-muted:  #8c8c95;

  /* crimson accent */
  --accent:       #d72638;
  --accent-mid:   #ee3b4e;
  --accent-light: #ff8591;
  --accent-tint:  rgba(215, 38, 56, 0.15);
  --accent-glow:  rgba(215, 38, 56, 0.35);

  --danger:      #ff5c6a;
  --danger-tint: rgba(255, 92, 106, 0.12);
  --success:     #3ddc84;

  /* radii: small controls, cards, big panels */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --font-body:    "Barlow", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  --font-mono:    ui-monospace, "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* legacy names, kept so older markup keeps working */
  --bg: var(--bg-base);
  --bg-secondary: var(--bg-side);
  --embed-bg: var(--bg-surface);
  --embed-border: var(--accent);
  --text: var(--text-main);
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--border-hi) transparent; }

::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 99px; border: 2px solid var(--bg-base); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* the one signature detail: a crimson strip across the top of every page */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
  z-index: 100;
}

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

h1, h2, h3, h4 { color: var(--text-bright); line-height: 1.15; }

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent-light);
  padding: 1px 6px;
  border-radius: 4px;
}

:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }

/* ==========================================================================
   Sidebar layout
   ========================================================================== */

body:has(.sidebar) { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 26px 14px 18px;
  background: var(--bg-side);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.sidebar h2 {
  margin: 0 8px 20px;
  padding-bottom: 16px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--border);
}

.nav-item {
  display: block;
  padding: 10px 12px;
  border-left: 3px solid transparent;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.nav-item:hover { background: var(--bg-overlay); color: var(--text-bright); text-decoration: none; }
.nav-item.active {
  background: var(--accent-tint);
  border-left-color: var(--accent);
  color: var(--text-bright);
  font-weight: 600;
}

/* "Back to Servers" is a way out, not a section, so it sits apart and quieter */
.sidebar > .nav-item:first-of-type {
  margin-bottom: 14px;
  font-size: 13px;
}

.nav-item.logout {
  margin-top: auto;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  padding-top: 14px;
}
.nav-item.logout:hover { color: var(--danger); background: var(--danger-tint); }

body .t-content { scroll-behavior: smooth; }
body .t-content > * { max-width: 1240px; }

/* Type upgrades for the per-page inline styles (higher specificity on purpose) */
body .page-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.05;
}
body .page-sub { font-size: 14px; max-width: 70ch; }
body .t-section { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset; }
body .t-section-head h2,
body .m-box h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
body .m-overlay { background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(3px); }
body .m-box { border-color: var(--border-hi); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7); }

/* ==========================================================================
   Topbar layout
   ========================================================================== */

.topbar {
  position: sticky;
  top: 3px;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: var(--bg-side);
  border-bottom: 1px solid var(--border);
}
.topbar a {
  color: var(--text-bright);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.topbar a:last-child:not(:first-child) {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}
.topbar a:last-child:not(:first-child):hover { color: var(--danger); }

.container { max-width: 1040px; margin: 36px auto 64px; padding: 0 20px; }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 26px;
  box-shadow: inset 0 -1px 0 var(--border);
  overflow-x: auto;
}
.tabs a {
  flex-shrink: 0;
  padding: 11px 18px;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.12s, border-color 0.12s;
}
.tabs a:hover { color: var(--text-bright); }
.tabs a.active { color: var(--text-bright); border-bottom-color: var(--accent); font-weight: 600; }

/* ==========================================================================
   Cards ("embeds")
   ========================================================================== */

.embed {
  margin-bottom: 20px;
  padding: 22px 26px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  overflow-x: auto;
}
.embed h2, .embed h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 24px; font-weight: 700; }
.embed p { margin: 0 0 12px; color: var(--text-muted); max-width: 75ch; }
.embed.success { border-left-color: var(--success); }
.embed.danger  { border-left-color: var(--danger); }

/* ==========================================================================
   Forms
   ========================================================================== */

label {
  display: block;
  margin: 14px 0 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

select,
input[type=text],
input[type=number],
input[type=password],
textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-bright);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { min-height: 90px; resize: vertical; }
::placeholder { color: #55555d; }

select:hover, input[type=text]:hover, textarea:hover { border-color: var(--border-hi); }
select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

select:not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238c8c95' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}
select[multiple] { min-height: 110px; padding: 6px; }
select[multiple] option { padding: 5px 8px; border-radius: 4px; background: transparent; }
select[multiple] option:checked { background: var(--accent) linear-gradient(0deg, var(--accent), var(--accent)); color: #fff; }
option { background: var(--bg-surface); color: var(--text-main); }

/* choice labels (radios, checkboxes) read as sentences, not field captions */
.cat-mode-row label, label.toggle, label:has(> input[type=radio]), label:has(> input[type=checkbox]) {
  margin: 0;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
input[type=color] { cursor: pointer; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

/* ==========================================================================
   Buttons  (:where keeps specificity at zero so page-level .btn-xs-* always win)
   ========================================================================== */

:where(button, .btn) {
  display: inline-block;
  margin-top: 14px;
  padding: 9px 18px;
  background: var(--accent);
  border: none;
  border-radius: var(--r-sm);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, transform 0.06s, box-shadow 0.12s;
}
:where(button, .btn):hover { background: var(--accent-mid); text-decoration: none; }
:where(button, .btn):active { transform: translateY(1px); }
:where(button, .btn):disabled { opacity: 0.45; cursor: not-allowed; }
.btn:hover { text-decoration: none; }

/* ==========================================================================
   Tables
   ========================================================================== */

table { width: 100%; margin-top: 10px; border-collapse: collapse; }
th, td { padding: 12px; text-align: left; vertical-align: top; border-bottom: 1px solid #1d1d21; font-size: 14px; }
th {
  padding-top: 8px;
  padding-bottom: 10px;
  border-bottom-color: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
tbody tr:hover td, tr:hover > td { background: rgba(255, 255, 255, 0.02); }
td code { white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.badge.on  { background: rgba(61, 220, 132, 0.14); color: var(--success); }
.badge.off { background: var(--accent-tint); color: var(--accent-light); }

/* ==========================================================================
   Server picker
   ========================================================================== */

.guild-list { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.guild-list a {
  display: block;
  padding: 14px 18px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-hi);
  border-radius: var(--r-md);
  color: var(--text-bright);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.12s, background 0.12s;
}
.guild-list a:hover { background: var(--bg-muted); border-left-color: var(--accent); text-decoration: none; }

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 820px) {
  body:has(.sidebar) { flex-direction: column; height: auto; overflow: visible; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    padding: 18px 14px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar h2 { width: 100%; margin-bottom: 8px; padding-bottom: 12px; font-size: 26px; }
  .sidebar > .nav-item:first-of-type { margin-bottom: 0; }
  .nav-item { border-left: none; border-bottom: 2px solid transparent; border-radius: var(--r-sm); padding: 8px 10px; font-size: 13px; }
  .nav-item.active { border-bottom-color: var(--accent); }
  .nav-item.logout { margin-top: 0; border-top: none; padding-top: 8px; border-radius: var(--r-sm); }
  body .t-content { padding: 22px 16px; overflow: visible; }
  body .page-title { font-size: 28px; }
  .container { margin-top: 22px; }
  .embed { padding: 18px; }
  .topbar { padding: 12px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
