/* UMS Auto Selector PRO v3 — Base UI, Shimmer Buttons, Spotlight Cards & Shared Controls */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  scrollbar-color: var(--color-rule-2) var(--color-paper);
  caret-color: var(--color-cool);
}

body {
  position: relative;
  background-color: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.62;
  overflow-x: clip;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Interactive Pixel Grid Canvas (React Bits Style) */
.bg-pixel-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Atmospheric Aura Orbs (GPU Composited) */
.aura-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.aura-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  will-change: transform, opacity;
}

.aura-orb--1 {
  width: 560px;
  height: 560px;
  top: -160px;
  left: -100px;
  background: var(--orb-1);
  animation: orbFloat 16s ease-in-out infinite alternate;
}

.aura-orb--2 {
  width: 480px;
  height: 480px;
  top: 60px;
  right: -120px;
  background: var(--orb-2);
  animation: orbFloat 20s ease-in-out infinite alternate-reverse;
}

.aura-orb--3 {
  width: 380px;
  height: 380px;
  bottom: 8%;
  left: 34%;
  background: var(--orb-3);
  animation: orbFloat 24s ease-in-out infinite alternate;
}

@keyframes orbFloat {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(28px, -22px, 0) scale(1.06); }
}

header,
main,
footer {
  position: relative;
  z-index: 1;
}

::selection {
  background-color: var(--color-accent-soft);
  color: var(--color-ink);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--tracking-display);
  line-height: 1.08;
  color: var(--color-ink);
  text-wrap: balance;
  overflow-wrap: break-word;
  min-width: 0;
}

h1 { font-size: var(--text-display); }
h2 { font-size: var(--text-section); }
h3 { font-size: var(--text-title); line-height: 1.28; font-weight: 600; }

p {
  color: var(--color-muted);
  text-wrap: pretty;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.container {
  max-width: var(--container);
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.measured {
  font-family: var(--font-outlier);
  font-variant-numeric: tabular-nums slashed-zero;
}

/* Sticky Floating Glass Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background-color: var(--color-surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: var(--rule-hair) solid var(--color-rule);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  min-height: 70px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.025em;
  color: var(--color-ink);
  white-space: nowrap;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: var(--rule-hair) solid var(--color-rule-2);
  background: #ffffff;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  padding: 4px;
  background-color: color-mix(in srgb, var(--color-paper-2) 70%, transparent);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: 999px;
}

.nav-link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-muted);
  padding: 6px 14px;
  border-radius: 999px;
  transition: color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-ink);
  background-color: var(--color-paper-hover);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Shimmer & Tactile Buttons (Magic UI / Aceternity Style) */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 44px;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-pill);
  border: var(--rule-hair) solid var(--color-rule-2);
  background-color: var(--color-paper-2);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out), box-shadow var(--dur-micro) var(--ease-out);
}

.btn:hover {
  background-color: var(--color-paper-hover);
  border-color: var(--color-accent-hover);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background: linear-gradient(135deg, var(--color-accent) 0%, #4f46e5 55%, var(--color-accent-2) 120%);
  border-color: rgba(129, 140, 248, 0.55);
  color: var(--color-accent-ink);
  box-shadow: var(--shadow-glow);
}

.btn--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 60%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: translateX(-160%) skewX(-20deg);
  animation: shimmerSweep 3.2s infinite;
  pointer-events: none;
}

@keyframes shimmerSweep {
  0% { transform: translateX(-160%) skewX(-20deg); }
  45%, 100% { transform: translateX(260%) skewX(-20deg); }
}

.btn--primary:hover {
  filter: brightness(1.08);
  border-color: var(--color-cool);
  box-shadow: 0 12px 34px rgba(99, 102, 241, 0.45);
}

.btn--lg {
  min-height: 50px;
  padding: 12px 24px;
  font-size: var(--text-md);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
}

/* Spotlight Elevated Card */
.card {
  position: relative;
  overflow: hidden;
  background-color: var(--color-surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  min-width: 0;
  transition: border-color var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out);
}

.spotlight-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(480px circle at var(--mx, 50%) var(--my, 50%), var(--spotlight-color), transparent 45%);
  opacity: var(--spotlight-opacity, 0);
  transition: opacity 280ms ease;
  pointer-events: none;
  z-index: 0;
}

.spotlight-card > * {
  position: relative;
  z-index: 1;
}

/* State Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-chip);
  border: var(--rule-hair) solid var(--color-rule-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-ink-2);
  background-color: color-mix(in srgb, var(--color-paper-3) 85%, transparent);
}

.chip--accent {
  background-color: var(--color-accent-soft);
  border-color: rgba(129, 140, 248, 0.45);
  color: var(--color-accent-hover);
}

.chip--cool {
  background-color: var(--color-cool-soft);
  border-color: rgba(34, 211, 238, 0.45);
  color: var(--color-cool);
}

.chip--ok {
  background-color: var(--color-ok-soft);
  border-color: rgba(16, 185, 129, 0.45);
  color: var(--color-ok);
}

.chip--bad {
  background-color: var(--color-bad-soft);
  border-color: rgba(244, 63, 94, 0.45);
  color: var(--color-bad);
}

.chip--warn {
  background-color: var(--color-warn-soft);
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--color-warn);
}

/* Icon Badge */
.icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: var(--rule-hair) solid var(--color-rule-2);
  background-color: var(--color-paper-3);
  flex-shrink: 0;
}

.icon-badge--cool {
  color: var(--color-cool);
  background-color: var(--color-cool-soft);
  border-color: rgba(34, 211, 238, 0.38);
}

.icon-badge--accent {
  color: var(--color-accent-hover);
  background-color: var(--color-accent-soft);
  border-color: rgba(129, 140, 248, 0.38);
}

.icon-badge--ok {
  color: var(--color-ok);
  background-color: var(--color-ok-soft);
  border-color: rgba(16, 185, 129, 0.38);
}

/* Inputs */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-ink-2);
}

.field-input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 14px;
  background-color: var(--color-paper-3);
  border: var(--rule-hair) solid var(--color-rule-2);
  border-radius: var(--radius-pill);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-md);
  transition: border-color var(--dur-micro) var(--ease-out), box-shadow var(--dur-micro) var(--ease-out);
}

.field-input:focus {
  outline: none;
  border-color: var(--color-accent-hover);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.field-input--mono {
  font-family: var(--font-outlier);
  font-variant-numeric: tabular-nums slashed-zero;
}

.field-input::placeholder {
  color: var(--color-muted);
}

/* Tables */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.console-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.console-table th {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  padding: 14px 18px;
  background-color: color-mix(in srgb, var(--color-paper-3) 90%, transparent);
  border-bottom: var(--rule-hair) solid var(--color-rule-2);
  white-space: nowrap;
}

.console-table td {
  padding: 16px 18px;
  border-bottom: var(--rule-hair) solid var(--color-rule);
  color: var(--color-ink-2);
  font-size: var(--text-sm);
  vertical-align: middle;
}

.console-table tbody tr:last-child td {
  border-bottom: none;
}

.console-table tbody tr:hover td {
  background-color: var(--color-paper-hover);
}

/* Mobile Nav */
.mobile-menu-btn { display: none; }

.mobile-drawer {
  display: none;
  border-top: var(--rule-hair) solid var(--color-rule);
  background-color: var(--color-paper-2);
  padding: var(--space-md) var(--gutter);
  flex-direction: column;
  gap: var(--space-xs);
}

.mobile-drawer.open { display: flex; }

.mobile-drawer a {
  padding: var(--space-sm);
  border-radius: var(--radius-pill);
  color: var(--color-ink-2);
  font-weight: 600;
}

.mobile-drawer a:hover { background-color: var(--color-paper-3); }

/* Footer */
.site-footer {
  margin-top: auto;
  border-top: var(--rule-hair) solid var(--color-rule);
  background-color: color-mix(in srgb, var(--color-paper-3) 80%, transparent);
  backdrop-filter: blur(12px);
  padding-block: var(--space-xl);
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding-bottom: var(--space-lg);
  border-bottom: var(--rule-hair) solid var(--color-rule);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  list-style: none;
}

.footer-links a,
.footer-links button {
  background: none;
  border: none;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-muted);
  cursor: pointer;
}

.footer-links a:hover,
.footer-links button:hover {
  color: var(--color-cool);
}

.footer-note {
  padding-top: var(--space-md);
  font-size: var(--text-xs);
  color: var(--color-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* Legal Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 400;
  background-color: var(--color-backdrop);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.modal-backdrop.open { display: flex; }

.modal-card {
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  background-color: var(--color-paper-2);
  border: var(--rule-hair) solid var(--color-rule-2);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: var(--rule-hair) solid var(--color-rule);
}

.modal-tabs {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-lg);
  background-color: var(--color-paper-3);
  border-bottom: var(--rule-hair) solid var(--color-rule);
  overflow-x: auto;
}

.modal-tab {
  background: none;
  border: var(--rule-hair) solid transparent;
  border-radius: var(--radius-pill);
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  white-space: nowrap;
}

.modal-tab.active {
  background-color: var(--color-paper-2);
  border-color: var(--color-rule-2);
  color: var(--color-cool);
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.modal-body h4 {
  font-size: var(--text-md);
  color: var(--color-ink);
  margin: var(--space-md) 0 var(--space-xs);
}

.modal-body h4:first-child { margin-top: 0; }

/* Scroll Reveal */
.reveal-up {
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  transition: opacity 550ms var(--ease-out), transform 550ms var(--ease-out);
}

.reveal-up.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

@media (max-width: 860px) {
  :root { --gutter: 20px; }
  .nav-links { display: none; }
  .mobile-menu-btn { display: inline-flex; }
}

@media (max-width: 560px) {
  :root {
    --gutter: 16px;
    --space-3xl: 56px;
    --space-2xl: 44px;
    --space-xl: 28px;
  }
  .nav-bar {
    gap: var(--space-xs);
    min-height: 62px;
  }
  .brand-link {
    font-size: 0.96rem;
    gap: 8px;
  }
  .brand-link .chip {
    display: none;
  }
  .nav-actions .btn--primary {
    display: none;
  }
  .console-table th,
  .console-table td {
    padding: 12px;
  }
  .footer-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .footer-links {
    gap: 12px 18px;
  }
}

@media (max-width: 420px) {
  .nav-bar {
    flex-wrap: wrap;
    padding-block: 8px;
  }
  .btn,
  .btn--lg {
    white-space: normal;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal-up {
    opacity: 1;
    transform: none;
  }
}
