/* =========================================================
   InnoX DevOps Platform — theme
   Palette & typography taken from innox.la
   ========================================================= */

:root {
  /* InnoX gold */
  --gold-50: #fdfbf7;
  --gold-100: #faf4e4;
  --gold-200: #f2e3bc;
  --gold-300: #e5c783;
  --gold-400: #d6a649;
  --gold-500: #c5a880;
  --gold-600: #aa7c11;
  --gold-700: #8a620d;
  --gold-800: #694b0a;
  --gold-accent: #d4af37;
  --gold-bright: #fdf0cd;
  --gold-logo: #e2a42a;

  /* InnoX obsidian */
  --dark-100: #ececed;
  --dark-200: #d1d1d5;
  --dark-300: #a6a7ad;
  --dark-400: #7a7b84;
  --dark-500: #5f6069;
  --dark-600: #404149;
  --dark-700: #2d2e33;
  --dark-800: #1d1e22;
  --dark-900: #0f1013;
  --dark-950: #08080b;

  --success: #34d399;
  --danger: #f87171;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Outfit", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Dark (default) ---------- */
[data-theme="dark"] {
  --bg: var(--dark-950);
  --text: var(--dark-100);
  --text-strong: #ffffff;
  --muted: var(--dark-400);
  --panel: rgba(29, 30, 34, 0.45);
  --panel-hover: rgba(29, 30, 34, 0.7);
  --border: rgba(212, 175, 55, 0.1);
  --border-hover: rgba(212, 175, 55, 0.35);
  --header-bg: rgba(8, 8, 11, 0.7);
  --input-bg: rgba(15, 16, 19, 0.7);
  --accent: var(--gold-accent);
  --icon-tile: linear-gradient(145deg, #1d1e22 0%, #0f1013 100%);
  --aura: rgba(212, 175, 55, 0.14);
  --grid-line: rgba(212, 175, 55, 0.035);
  color-scheme: dark;
}

/* ---------- Light ---------- */
[data-theme="light"] {
  --bg: var(--gold-50);
  --text: var(--dark-700);
  --text-strong: var(--dark-900);
  --muted: var(--dark-500);
  --panel: rgba(255, 255, 255, 0.7);
  --panel-hover: #ffffff;
  --border: rgba(170, 124, 17, 0.16);
  --border-hover: rgba(170, 124, 17, 0.45);
  --header-bg: rgba(253, 251, 247, 0.8);
  --input-bg: rgba(255, 255, 255, 0.9);
  --accent: var(--gold-700);
  --icon-tile: linear-gradient(145deg, #1d1e22 0%, #08080b 100%);
  --aura: rgba(212, 175, 55, 0.18);
  --grid-line: rgba(170, 124, 17, 0.05);
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

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

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--gold-600);
  border-radius: 999px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-accent);
}

[hidden] {
  display: none !important;
}

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

svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

main.container {
  flex: 1;
  position: relative;
  z-index: 1;
}

.mono {
  font-family: var(--font-mono);
}

.muted {
  color: var(--muted);
}

.text-gold-gradient {
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold-accent) 50%, var(--gold-600) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .text-gold-gradient {
  background-image: linear-gradient(135deg, var(--gold-400) 0%, var(--gold-600) 55%, var(--gold-800) 100%);
}

.glass {
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------- Ambient background ---------- */
.aura {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, var(--aura) 0%, transparent 70%);
  filter: blur(80px);
  animation: pulse-slow 8s ease-in-out infinite;
}
.aura-1 { top: -10%; left: -15%; width: 50vw; height: 50vw; }
.aura-2 { top: 35%; right: -20%; width: 55vw; height: 55vw; animation-delay: -3s; }
.aura-3 { bottom: -20%; left: 25%; width: 45vw; height: 45vw; animation-delay: -5s; }

.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at top, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at top, #000 20%, transparent 75%);
}

@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.brand-logo {
  display: grid;
  place-items: center;
  height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  background: linear-gradient(145deg, #1d1e22, #08080b);
  border: 1px solid rgba(212, 175, 55, 0.25);
  box-shadow: 0 8px 24px -10px rgba(212, 175, 55, 0.35);
}

.brand-logo img {
  height: 30px;
  width: auto;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

.brand-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
}

/* Search */
.search {
  position: relative;
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  display: flex;
  font-size: 16px;
}

.search input {
  width: 100%;
  height: 42px;
  padding: 0 44px 0 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text-strong);
  font: 500 14px var(--font-sans);
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.search input:focus {
  outline: none;
  border-color: rgba(212, 175, 55, 0.55);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search kbd {
  position: absolute;
  right: 10px;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.clock {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: ping 2s infinite;
}

@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* Theme toggle */
.theme-toggle {
  width: 58px;
  height: 30px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  cursor: pointer;
  position: relative;
}

.theme-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  color: var(--dark-950);
  font-size: 13px;
  transition: transform 0.35s var(--ease);
  box-shadow: 0 4px 12px -2px rgba(212, 175, 55, 0.5);
}

.theme-knob > span {
  display: flex;
}

[data-theme="light"] .theme-knob {
  transform: translateX(28px);
}

[data-theme="dark"] .icon-sun,
[data-theme="light"] .icon-moon {
  display: none;
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 40px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  transition: border-color 0.3s, transform 0.3s var(--ease);
}

.stat:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: var(--gold-accent);
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.2);
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.1;
  color: var(--text-strong);
}

.stat-total {
  font-size: 16px;
  color: var(--muted);
  font-weight: 500;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.stat.is-alert .stat-icon {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.25);
}

.stat.is-alert .stat-value {
  color: var(--danger);
}

/* Toolbar */
.toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  font-size: 12px;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
  font: 600 12px var(--font-sans);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-ghost:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: var(--border-hover);
}

.btn-ghost.spinning svg {
  animation: spin 0.9s linear infinite;
}

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

/* ---------- Sections ---------- */
.section {
  margin-top: 56px;
}

.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.section-eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.45), transparent);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  margin: 14px 0 28px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* ---------- Tool card ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px;
  min-height: 232px;
  overflow: hidden;
  transition: background 0.3s, border-color 0.3s, transform 0.35s var(--ease), box-shadow 0.35s;
  animation: fade-up 0.6s var(--ease) both;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 0%), rgba(212, 175, 55, 0.09), transparent 40%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.card:hover {
  background: var(--panel-hover);
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -18px rgba(212, 175, 55, 0.28);
}

.card:hover::before {
  opacity: 1;
}

.card:focus-visible {
  outline: 2px solid var(--gold-accent);
  outline-offset: 3px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 30px;
  color: var(--gold-accent);
  background: var(--icon-tile);
  border: 1px solid rgba(212, 175, 55, 0.28);
  box-shadow: inset 0 1px 0 rgba(253, 240, 205, 0.08), 0 10px 24px -12px rgba(212, 175, 55, 0.4);
  transition: all 0.35s var(--ease);
}

.card:hover .card-icon {
  color: var(--dark-950);
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold-accent) 45%, var(--gold-600) 100%);
  border-color: transparent;
  transform: rotate(-4deg) scale(1.04);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: 6px;
  color: var(--muted);
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dark-500);
}

.status.online {
  color: var(--success);
}
.status.online::before {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}

.status.offline {
  color: var(--danger);
}
.status.offline::before {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.18);
}

.status.checking::before {
  background: var(--gold-accent);
  animation: pulse-slow 1s ease-in-out infinite;
}

.card-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: var(--text-strong);
  margin: 28px 0 6px;
}

.card-desc {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.card-foot {
  margin-top: auto;
  padding-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.launch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
}

.launch svg {
  transition: transform 0.3s var(--ease);
}

.card:hover .launch svg {
  transform: translateX(4px);
}

.card-host {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.3s var(--ease);
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card:hover .card-host {
  opacity: 1;
  transform: none;
}

.card.is-disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.card.is-disabled:hover {
  transform: none;
  box-shadow: none;
}

.card.is-disabled .launch {
  color: var(--muted);
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Empty state */
.empty {
  margin-top: 56px;
  padding: 48px;
  text-align: center;
  color: var(--muted);
}

.empty svg {
  font-size: 28px;
  color: var(--gold-accent);
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  padding-bottom: 24px;
  font-size: 13px;
  color: var(--muted);
}

.footer .text-gold-gradient {
  font-weight: 700;
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .topbar-inner {
    height: auto;
    padding-top: 14px;
    padding-bottom: 14px;
    flex-wrap: wrap;
  }
  .search {
    order: 3;
    max-width: none;
    flex-basis: 100%;
  }
  .brand-title { font-size: 20px; }
  .brand-logo { height: 42px; padding: 0 10px; }
  .brand-logo img { height: 24px; }
  .clock { display: none; }
  .cards { grid-template-columns: 1fr; }
  .stats { gap: 12px; margin-top: 24px; }
  .stat { padding: 16px; gap: 12px; }
  .stat-icon { width: 38px; height: 38px; font-size: 17px; }
  .stat-value { font-size: 22px; }
  .section-title { font-size: 26px; }
  .footer-inner { flex-direction: column; gap: 6px; }
}

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