/* Farever Companion Web — custom layer on top of Tailwind (Tactical Overlay).
   SHARP corners everywhere (0 radius) — buttons, inputs, toggles, cards. */

:root {
  --primary: #38BDF8;
  --line: #262C38;
}

html, body { scroll-behavior: smooth; }

/* Subtle tactical scanline + corner glow, behind everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background:
    linear-gradient(rgba(0,0,0,0) 50%, rgba(0,0,0,0.35) 50%),
    linear-gradient(90deg, rgba(56,189,248,0.05), rgba(240,200,54,0.02), rgba(56,189,248,0.05));
  background-size: 100% 3px, 4px 100%;
}
body::after {
  content: "";
  position: fixed;
  top: -20%;
  left: 50%;
  width: 80vw;
  height: 60vh;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at center, rgba(56,189,248,0.07), transparent 70%);
}
.app-shell, .auth-shell { position: relative; z-index: 1; }

/* Uppercase mono section label with cyan tick (matches companion). */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8B919F;
}
.section-label::before {
  content: "";
  width: 2px;
  height: 13px;
  background: var(--primary);
}

/* Range sliders — sharp cyan handle, thin track. */
input[type="range"].slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: #262C38;
  outline: none;
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid #0B0D12;
}
input[type="range"].slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid #0B0D12;
}

/* Inputs. Higher specificity (input.field / select.field / textarea.field) so
   they beat the @tailwindcss/forms base styles on [type=password]/[type=url]
   (which otherwise win the cascade and render white). */
.field,
input.field,
select.field,
textarea.field {
  width: 100%;
  background: #0B0D12;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 12px;
  color: #E6E8EE;
  font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field::placeholder { color: #5b626f; }
input.field:focus,
select.field:focus,
textarea.field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.15);
  outline: none;
}
select.field { appearance: none; -webkit-appearance: none; background-image: none; cursor: pointer; }

/* Kill the browser autofill white/yellow background on password & co. */
input.field:-webkit-autofill,
input.field:-webkit-autofill:hover,
input.field:-webkit-autofill:focus,
input.field:-webkit-autofill:active {
  -webkit-text-fill-color: #E6E8EE;
  caret-color: #E6E8EE;
  -webkit-box-shadow: 0 0 0px 1000px #0B0D12 inset;
  box-shadow: 0 0 0px 1000px #0B0D12 inset;
  transition: background-color 9999s ease-in-out 0s;
}

/* Buttons — sharp. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 0;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .05s ease;
  border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #00222F; }
.btn-primary:hover { background: #5cc9fb; }
.btn-ghost { background: transparent; border-color: var(--line); color: #E6E8EE; }
.btn-ghost:hover { background: #222834; }
.btn-danger { background: transparent; border-color: rgba(240,85,107,0.5); color: #F0556B; }
.btn-danger:hover { background: rgba(240,85,107,0.12); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* Chip (friend codes, tags) — sharp. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 0;
  border: 1px solid var(--line);
  background: #1B2029;
  color: #E6E8EE;
}
.chip-ok { border-color: rgba(74,222,128,0.4); color: #4ADE80; background: rgba(74,222,128,0.08); }
.chip-bad { border-color: rgba(240,85,107,0.4); color: #F0556B; background: rgba(240,85,107,0.08); }

/* Tabs — sharp. */
.tab {
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 0;
  color: #8B919F;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
}
.tab:hover { color: #E6E8EE; background: #1B2029; }
.tab-active { color: #38BDF8; background: rgba(56,189,248,0.10); border-color: rgba(56,189,248,0.30); }

/* Rectangular toggle switch (sharp), matches the companion. */
.toggle {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 22px;
  flex: none;
  background: #1B2029;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #8B919F;
  transition: left .15s ease, background-color .15s ease;
}
.toggle[aria-checked="true"],
.toggle.on { background: rgba(56,189,248,0.18); border-color: rgba(56,189,248,0.5); }
.toggle[aria-checked="true"]::after,
.toggle.on::after { left: 20px; background: var(--primary); }

/* CSS-only switch (sharp). The input is also given Tailwind's `sr-only` in
   markup so it is reliably hidden regardless of the forms-plugin reset. */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch-track {
  position: relative; width: 40px; height: 22px; flex: none;
  background: #1B2029; border: 1px solid var(--line);
  transition: background-color .15s, border-color .15s;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: #8B919F; transition: left .15s, background-color .15s;
}
.switch-input:checked + .switch-track { background: rgba(56,189,248,.2); border-color: rgba(56,189,248,.5); }
.switch-input:checked + .switch-track::after { left: 20px; background: #38BDF8; }
.switch-input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(56,189,248,.25); }

/* A label-activated, visually-hidden input (peer sr-only / switch-input) is
   position:absolute, so its containing block was the nearest positioned
   ancestor — the overflow:hidden .app-shell. Clicking the label focused the
   input and the browser scrolled the shell to "reveal" its deep static
   offset, opening a phantom gap below the footer. Pinning the label as the
   containing block keeps the input in place so nothing scrolls. */
label:has(> input.sr-only) { position: relative; }

/* ---- Collapsible sidebar (desktop rail + mobile off-canvas) ---- */
.app-sidebar { width: 230px; flex: none; transition: width .15s ease; }

@media (min-width: 1024px) {
  .app-shell.sidebar-collapsed .app-sidebar { width: 64px; }
  .app-shell.sidebar-collapsed .brand-text,
  .app-shell.sidebar-collapsed .nav-label,
  .app-shell.sidebar-collapsed .sidebar-foot-expanded { display: none; }
  .app-shell.sidebar-collapsed .nav-item,
  .app-shell.sidebar-collapsed .brand-row { justify-content: center; }
  .app-shell.sidebar-collapsed .nav-badge { display: none; }
}

@media (max-width: 1023px) {
  .app-sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 50;
    width: 250px;
  }
  .app-shell.sidebar-open .app-sidebar { transform: translateX(0); }
}
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; }

/* Hide scrollbar where wanted */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Brand mark: tint the moustache logo with the current text color via its alpha
   mask, so it adopts the theme accent (text-primary) and re-tints if that changes. */
.brand-logo {
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
}

/* Custom select with inline icons (native <option> can't render images). Backed
   by a hidden <input> so it submits exactly like the <select> it replaces. */
.cselect { position: relative; }
.cselect-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #0B0D12; border: 1px solid var(--line); color: #E6E8EE;
  padding: 10px 12px; font-size: 14px; cursor: pointer; text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cselect-trigger:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(56,189,248,.15); }
.cselect[data-open] .cselect-trigger { border-color: var(--primary); }
.cselect-current { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cselect-current > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cselect-current img { width: 22px; height: 22px; object-fit: contain; flex: none; }
.cselect-chevron { flex: none; color: #8B919F; transition: transform .15s ease; }
.cselect[data-open] .cselect-chevron { transform: rotate(180deg); }
.cselect-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  background: #14171E; border: 1px solid var(--line); max-height: 280px; overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.cselect-opt {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 12px; font-size: 14px; color: #E6E8EE; cursor: pointer;
  background: transparent; border: 0; text-align: left;
}
.cselect-opt:hover { background: #1B2029; }
.cselect-opt[aria-selected="true"] { background: #1B2029; color: var(--primary); }
.cselect-opt img { width: 22px; height: 22px; object-fit: contain; flex: none; }
.cselect-opt > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cselect-ph { color: #5b626f; }

@media (max-width: 768px) {
  body::before, body::after { display: none; }  /* perf on mobile */
}
