/*
 * EAGLE AI / CYBER RELAY
 *
 * This is an independent presentation layer for Sub2API.  It intentionally
 * uses stable semantic classes (card, btn, input, modal, table, aside, ...)
 * instead of changing application code, so the upstream image can be updated
 * without replacing this file.
 */

:root {
  color-scheme: dark;
  --eagle-bg-0: #040711;
  --eagle-bg-1: #070d1b;
  --eagle-bg-2: #0b1425;
  --eagle-panel: rgba(10, 18, 34, .82);
  --eagle-panel-solid: #0d1729;
  --eagle-panel-raised: rgba(16, 27, 48, .92);
  --eagle-line: rgba(86, 220, 255, .18);
  --eagle-line-strong: rgba(86, 220, 255, .42);
  --eagle-text: #e9f8ff;
  --eagle-text-2: #b7c9d8;
  --eagle-text-3: #7891a8;
  --eagle-cyan: #5cecff;
  --eagle-blue: #6ca8ff;
  --eagle-violet: #ad8bff;
  --eagle-pink: #ff58d1;
  --eagle-lime: #b9ff70;
  --eagle-orange: #ffb86b;
  --eagle-danger: #ff6d8d;
  --eagle-radius: 14px;
  --eagle-shadow: 0 14px 42px rgba(0, 0, 0, .30), 0 0 0 1px rgba(86, 220, 255, .025);
  --eagle-shadow-hover: 0 16px 48px rgba(0, 0, 0, .38), 0 0 20px rgba(92, 236, 255, .09);
}

:root[data-eagle-theme="light"] {
  color-scheme: light;
  --eagle-bg-0: #eef6fb;
  --eagle-bg-1: #f7fbff;
  --eagle-bg-2: #ffffff;
  --eagle-panel: rgba(255, 255, 255, .88);
  --eagle-panel-solid: #ffffff;
  --eagle-panel-raised: rgba(246, 251, 255, .98);
  --eagle-line: rgba(19, 111, 157, .22);
  --eagle-line-strong: rgba(19, 111, 157, .48);
  --eagle-text: #102538;
  --eagle-text-2: #38556c;
  --eagle-text-3: #6c8497;
  --eagle-cyan: #067f9d;
  --eagle-blue: #2868cc;
  --eagle-violet: #6947bf;
  --eagle-pink: #c52b98;
  --eagle-lime: #3f8d16;
  --eagle-orange: #b65d09;
  --eagle-danger: #c52d55;
  --eagle-shadow: 0 14px 38px rgba(39, 86, 117, .13), 0 0 0 1px rgba(19, 111, 157, .035);
  --eagle-shadow-hover: 0 16px 44px rgba(39, 86, 117, .17), 0 0 20px rgba(6, 127, 157, .09);
}

html,
body {
  min-height: 100%;
}

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

html {
  background: var(--eagle-bg-0) !important;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  background:
    radial-gradient(900px 520px at 78% -10%, rgba(91, 104, 255, .16), transparent 65%),
    radial-gradient(780px 520px at -8% 24%, rgba(0, 225, 255, .10), transparent 65%),
    var(--eagle-bg-0) !important;
  color: var(--eagle-text) !important;
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif !important;
  letter-spacing: .008em;
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
}

body::before {
  opacity: .20;
  background-image:
    linear-gradient(rgba(92, 236, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 236, 255, .055) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .95), transparent 88%);
  animation: eagle-grid-drift 24s linear infinite;
}

body::after {
  opacity: .08;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(255, 255, 255, .045) 4px,
    transparent 5px
  );
  mix-blend-mode: screen;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* Typography inspired by editorial dashboards: compact labels, strong display. */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--eagle-text) !important;
  font-family: "Space Grotesk", Inter, "Noto Sans SC", "PingFang SC", sans-serif !important;
  letter-spacing: -.025em;
  text-wrap: balance;
}

code,
pre,
kbd,
samp,
.font-mono {
  font-family: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace !important;
  letter-spacing: .015em;
}

a {
  transition: color .2s ease, text-shadow .2s ease;
}

a:hover {
  color: var(--eagle-cyan) !important;
  text-shadow: 0 0 18px rgba(92, 236, 255, .28);
}

/* Stable surface vocabulary used across current and older Sub2API views. */
.card,
.card-glass,
.glass,
.modal-content,
.dropdown,
.empty-state {
  position: relative;
  border: 1px solid var(--eagle-line) !important;
  border-radius: var(--eagle-radius) !important;
  background: var(--eagle-panel) !important;
  box-shadow: var(--eagle-shadow) !important;
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.card:hover,
.card-glass:hover,
.glass:hover {
  border-color: var(--eagle-line-strong) !important;
  box-shadow: var(--eagle-shadow-hover) !important;
}

/* Neutral utility surfaces: keep semantic colored badges intact. */
html:not([data-eagle-theme="light"]) .bg-white,
html:not([data-eagle-theme="light"]) .bg-gray-50,
html:not([data-eagle-theme="light"]) .bg-gray-100,
html:not([data-eagle-theme="light"]) .bg-slate-50,
html:not([data-eagle-theme="light"]) .bg-zinc-50,
html:not([data-eagle-theme="light"]) .bg-dark-900,
html:not([data-eagle-theme="light"]) .bg-dark-800,
html:not([data-eagle-theme="light"]) .bg-dark-700,
html:not([data-eagle-theme="light"]) [class*="dark:bg-dark-800"],
html:not([data-eagle-theme="light"]) [class*="dark:bg-dark-900"] {
  background-color: var(--eagle-panel) !important;
}

html[data-eagle-theme="light"] .bg-white,
html[data-eagle-theme="light"] .bg-gray-50,
html[data-eagle-theme="light"] .bg-gray-100,
html[data-eagle-theme="light"] .bg-slate-50,
html[data-eagle-theme="light"] .bg-zinc-50 {
  background-color: var(--eagle-panel) !important;
}

.border-gray-50,
.border-gray-100,
.border-gray-200,
.border-slate-200,
.border-zinc-200,
.border-dark-600,
.border-dark-700,
[class*="dark:border-dark-700"] {
  border-color: var(--eagle-line) !important;
}

html:not([data-eagle-theme="light"]) .text-gray-900,
html:not([data-eagle-theme="light"]) .text-gray-800,
html:not([data-eagle-theme="light"]) .text-gray-700,
html:not([data-eagle-theme="light"]) .text-slate-900,
html:not([data-eagle-theme="light"]) .text-slate-800,
html:not([data-eagle-theme="light"]) .text-slate-700,
html:not([data-eagle-theme="light"]) .text-dark-100,
html:not([data-eagle-theme="light"]) .text-dark-200 {
  color: var(--eagle-text) !important;
}

html:not([data-eagle-theme="light"]) .text-gray-500,
html:not([data-eagle-theme="light"]) .text-gray-600,
html:not([data-eagle-theme="light"]) .text-slate-500,
html:not([data-eagle-theme="light"]) .text-slate-600,
html:not([data-eagle-theme="light"]) .text-dark-300,
html:not([data-eagle-theme="light"]) .text-dark-400 {
  color: var(--eagle-text-2) !important;
}

/* Buttons retain semantic meaning while gaining a neon control-panel finish. */
.btn {
  position: relative;
  border: 1px solid transparent;
  border-radius: 10px !important;
  font-family: Inter, "Noto Sans SC", sans-serif !important;
  font-weight: 650 !important;
  letter-spacing: .015em;
  transition: transform .22s cubic-bezier(.16, 1, .3, 1), box-shadow .22s ease, border-color .22s ease, background .22s ease !important;
}

.btn:hover {
}

.btn-primary,
.btn-success {
  border-color: rgba(92, 236, 255, .5) !important;
  background: linear-gradient(110deg, #087f9e, #2760c7 52%, #744fc3) !important;
  color: #f4fdff !important;
  box-shadow: 0 8px 26px rgba(25, 151, 226, .28), inset 0 1px 0 rgba(255, 255, 255, .2) !important;
}

.btn-primary:hover,
.btn-success:hover {
  border-color: var(--eagle-cyan) !important;
  box-shadow: 0 12px 34px rgba(25, 182, 239, .38), 0 0 22px rgba(92, 236, 255, .18) !important;
}

.btn-secondary,
.btn-ghost,
.btn-icon {
  border-color: var(--eagle-line) !important;
  background: rgba(15, 28, 49, .68) !important;
  color: var(--eagle-text-2) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04) !important;
}

.btn-secondary:hover,
.btn-ghost:hover,
.btn-icon:hover {
  border-color: var(--eagle-line-strong) !important;
  background: rgba(21, 43, 70, .9) !important;
  color: var(--eagle-text) !important;
  box-shadow: 0 0 20px rgba(92, 236, 255, .12) !important;
}

.btn-danger {
  border-color: rgba(255, 109, 141, .45) !important;
  background: linear-gradient(110deg, #a82d57, #713b9e) !important;
  box-shadow: 0 8px 24px rgba(205, 46, 104, .2) !important;
}

.btn-warning {
  border-color: rgba(255, 184, 107, .5) !important;
  background: linear-gradient(110deg, #a9671b, #9e3e75) !important;
}

/* Form controls */
.input,
input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
  border: 1px solid var(--eagle-line) !important;
  border-radius: 10px !important;
  background: rgba(5, 12, 25, .68) !important;
  color: var(--eagle-text) !important;
  box-shadow: inset 0 1px 12px rgba(0, 0, 0, .16) !important;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease !important;
}

input:not([type="checkbox"]):not([type="radio"])::placeholder,
textarea::placeholder {
  color: var(--eagle-text-3) !important;
}

.input:focus,
input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus,
select:focus {
  border-color: var(--eagle-cyan) !important;
  outline: none !important;
  background: rgba(8, 21, 40, .9) !important;
  box-shadow: 0 0 0 3px rgba(92, 236, 255, .11), 0 0 26px rgba(92, 236, 255, .1) !important;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--eagle-cyan);
}

/* Navigation and page chrome */
aside,
.sidebar,
.deck-sidebar,
header,
[role="banner"] {
  border-color: var(--eagle-line) !important;
  background: rgba(6, 13, 27, .82) !important;
  backdrop-filter: blur(20px) saturate(145%);
  -webkit-backdrop-filter: blur(20px) saturate(145%);
}

aside {
  box-shadow: 18px 0 44px rgba(0, 0, 0, .16), inset -1px 0 rgba(92, 236, 255, .06);
}

aside a,
nav a,
[role="navigation"] a {
  border: 1px solid transparent;
  border-radius: 10px !important;
  color: var(--eagle-text-2) !important;
  transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s ease !important;
}

aside a:hover,
nav a:hover,
[role="navigation"] a:hover,
aside a[aria-current="page"],
nav a[aria-current="page"],
[role="navigation"] a[aria-current="page"] {
  border-color: rgba(92, 236, 255, .24) !important;
  background: linear-gradient(90deg, rgba(92, 236, 255, .13), rgba(173, 139, 255, .08)) !important;
  color: var(--eagle-text) !important;
  box-shadow: inset 3px 0 var(--eagle-cyan), 0 0 18px rgba(92, 236, 255, .08);
}

/* Tables, pagination and data-dense panels */
table {
  color: var(--eagle-text-2) !important;
}

thead,
th {
  background: rgba(92, 236, 255, .055) !important;
  color: var(--eagle-text-3) !important;
  font-family: "JetBrains Mono", "Cascadia Code", monospace !important;
  font-size: .72rem !important;
  letter-spacing: .08em;
  text-transform: uppercase;
}

th,
td {
  border-color: var(--eagle-line) !important;
}

tbody tr {
  border-color: var(--eagle-line) !important;
  transition: background .18s ease, box-shadow .18s ease;
}

tbody tr:hover {
  background: rgba(92, 236, 255, .055) !important;
  box-shadow: inset 2px 0 var(--eagle-cyan);
}

.badge,
[class*="badge-"] {
  border: 1px solid currentColor;
  border-radius: 999px !important;
  font-family: "JetBrains Mono", "Cascadia Code", monospace !important;
  font-size: .68rem !important;
  letter-spacing: .045em;
  text-transform: uppercase;
}

/* Dialogs, menus and notifications */
.modal-overlay {
  background: rgba(1, 4, 12, .72) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal-header,
.modal-footer {
  border-color: var(--eagle-line) !important;
  background: transparent !important;
}

.modal-body,
.modal-footer {
  overflow: visible !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.modal-content {
  width: min(760px, calc(100vw - 2rem)) !important;
  max-width: calc(100vw - 2rem) !important;
  max-height: calc(100vh - 2rem) !important;
  overflow: auto !important;
}

/* Layout guardrails. These rules prevent the visual layer from changing the
 * application's flex/grid sizing or clipping its tabs and long API strings. */
main,
[role="main"],
#app,
#app > div,
.container,
.card,
.card-glass,
.glass,
.modal-content,
.dropdown,
.grid,
.flex {
  min-width: 0;
}

main,
[role="main"] {
  max-width: 100%;
}

.card:not([class~="overflow-hidden"]),
.card-glass:not([class~="overflow-hidden"]),
.glass:not([class~="overflow-hidden"]) {
  overflow: visible !important;
}

.card[class~="overflow-hidden"] {
  overflow: hidden;
}

.card > *,
.card-glass > *,
.glass > *,
.modal-content > * {
  min-width: 0;
}

#app .flex > *,
#app .grid > * {
  min-width: 0;
}

/* Tabs and segmented controls: keep labels readable, then scroll only the
 * tab strip instead of allowing it to widen the entire page. */
[role="tablist"],
.tabs,
.tab-list,
.nav-tabs,
[data-tabs],
.segmented-control {
  display: flex;
  align-items: center;
  gap: .5rem;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

[role="tab"],
.tab,
.tab-button,
.tab-btn,
.tabs > button,
.tabs > a,
.tab-list > button,
.tab-list > a,
.nav-tabs > button,
.nav-tabs > a {
  flex: 0 0 auto;
  min-width: 0;
  max-width: min(16rem, 70vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button,
.btn {
  max-width: 100%;
  min-width: 0;
}

.btn > *,
button > * {
  min-width: 0;
  max-width: 100%;
}

pre,
code,
td,
th,
p,
label {
  overflow-wrap: anywhere;
}

pre {
  max-width: 100%;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

img,
video,
canvas {
  max-width: 100%;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Data tables remain usable on narrow screens without pushing the body wider. */
.overflow-x-auto,
.table-responsive,
.table-container,
[class*="table-wrap"],
[class*="table-wrapper"] {
  max-width: 100%;
  overflow-x: auto !important;
  overscroll-behavior-x: contain;
}

table {
  max-width: none;
}

/* The real app uses these stable sidebar names. Do not style every class that
 * happens to contain the word "sidebar" (that also catches overlays/sections). */
.sidebar,
.deck-sidebar,
aside {
  min-width: 0;
  max-width: min(calc(100vw - 1rem), 18rem);
}

.sidebar-nav,
[data-sidebar-nav] {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar-link,
.sidebar-label,
.sidebar-label-flex,
.sidebar-brand,
.sidebar-brand-title {
  min-width: 0;
  max-width: 100%;
}

.sidebar-label,
.sidebar-brand-title,
.sidebar-section-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dropdowns should be allowed to escape their trigger card, while the menu
 * itself is bounded by the viewport. */
.dropdown,
[role="menu"] {
  max-width: calc(100vw - 1rem);
}

.dropdown > [role="menu"],
.dropdown-menu,
[role="menu"] {
  max-height: min(70vh, 30rem);
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-title {
  color: var(--eagle-text) !important;
  font-family: "Space Grotesk", Inter, sans-serif !important;
}

.dropdown-item {
  color: var(--eagle-text-2) !important;
  border-radius: 8px !important;
}

.dropdown-item:hover {
  background: rgba(92, 236, 255, .1) !important;
  color: var(--eagle-text) !important;
}

.toast,
[role="alert"] {
  border: 1px solid var(--eagle-line-strong) !important;
  border-radius: 12px !important;
  background: var(--eagle-panel-raised) !important;
  color: var(--eagle-text) !important;
  box-shadow: var(--eagle-shadow-hover) !important;
  backdrop-filter: blur(18px);
}

hr {
  border-color: var(--eagle-line) !important;
  opacity: 1 !important;
}

/* The small fixed HUD is inserted by theme.js. */
.eagle-theme-toggle,
.eagle-signal {
  position: fixed;
  z-index: 25;
  border: 1px solid var(--eagle-line-strong);
  background: rgba(7, 16, 31, .78);
  color: var(--eagle-text-2);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .35), 0 0 22px rgba(92, 236, 255, .08);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.eagle-theme-toggle {
  right: 16px;
  bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: border-color .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.eagle-theme-toggle:hover {
  border-color: var(--eagle-cyan);
  color: var(--eagle-cyan);
  box-shadow: 0 0 26px rgba(92, 236, 255, .18);
  transform: translateY(-1px);
}

.eagle-theme-toggle .eagle-toggle-dot,
.eagle-signal > span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--eagle-cyan);
  box-shadow: 0 0 12px var(--eagle-cyan);
  animation: eagle-pulse 2.4s ease-in-out infinite;
}

.eagle-signal {
  display: none !important;
}

.eagle-grid-layer,
.eagle-scan-layer,
.eagle-orbit-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.eagle-grid-layer {
  opacity: .12;
  background-image:
    linear-gradient(rgba(92, 236, 255, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 236, 255, .08) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse at 50% 15%, #000 10%, transparent 78%);
  animation: eagle-grid-drift 28s linear infinite;
}

.eagle-scan-layer {
  opacity: .08;
  background: linear-gradient(115deg, transparent 0 38%, rgba(92, 236, 255, .12) 50%, transparent 62%);
  transform: translateX(-100%);
  animation: eagle-scan 13s ease-in-out infinite;
}

.eagle-orbit-layer::before,
.eagle-orbit-layer::after {
  position: absolute;
  top: -160px;
  right: -120px;
  width: 460px;
  height: 460px;
  border: 1px solid rgba(173, 139, 255, .16);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 80px rgba(92, 236, 255, .07), inset 0 0 80px rgba(173, 139, 255, .06);
  transform: rotate(-22deg) skewX(-12deg);
  animation: eagle-orbit 18s linear infinite;
}

.eagle-orbit-layer::after {
  top: -80px;
  right: -40px;
  width: 300px;
  height: 300px;
  border-color: rgba(92, 236, 255, .18);
  animation-duration: 11s;
  animation-direction: reverse;
}

.eagle-reveal {
  animation: eagle-reveal .32s ease-out both;
  animation-delay: var(--eagle-delay, 0ms);
}

/* Respect accessibility and small screens. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}

@media (max-width: 640px) {
  .eagle-theme-toggle {
    right: 10px;
    bottom: 10px;
    min-height: 30px;
    padding: 0 9px;
    font-size: 9px;
  }

  .card,
  .card-glass,
  .glass {
    border-radius: 12px !important;
  }

  .grid[class*="grid-cols-"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .card .flex.items-center.justify-between,
  .card .flex.items-start.justify-between {
    flex-wrap: wrap;
    row-gap: .65rem;
  }

  .card,
  .card-glass,
  .glass {
    max-width: 100%;
  }

  .modal-content {
    width: calc(100vw - 1rem) !important;
    max-width: calc(100vw - 1rem) !important;
    max-height: calc(100vh - 1rem) !important;
  }
}

@media (min-width: 641px) and (max-width: 1023px) {
  .card,
  .card-glass,
  .glass {
    max-width: 100%;
  }
}

@keyframes eagle-grid-drift {
  from { background-position: 0 0; }
  to { background-position: 54px 54px; }
}

@keyframes eagle-scan {
  0%, 18% { transform: translateX(-100%); opacity: 0; }
  35%, 65% { opacity: .8; }
  82%, 100% { transform: translateX(100%); opacity: 0; }
}

@keyframes eagle-orbit {
  from { transform: rotate(-22deg) skewX(-12deg) rotate(0deg); }
  to { transform: rotate(-22deg) skewX(-12deg) rotate(360deg); }
}

@keyframes eagle-pulse {
  0%, 100% { opacity: .65; transform: scale(.86); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes eagle-reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}
