/* ============================================================================
   WATTOOSH DESIGN SYSTEM
   Direction: instrument-panel / power-station control room. The product is
   named after "watt" — this leans into that instead of borrowing Odoo's own
   soft corporate purple. Dark canvas by default, amber "live indicator"
   accent, monospace for anything numeric/technical (ids, hashes, hosts,
   status codes) — the vocabulary of a control room, not a SaaS marketing site.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* Canvas */
  --bg: #0b0d10;
  --panel: #14171b;
  --panel-2: #1a1e23;
  --panel-3: #21262c;
  --border: #262b31;
  --border-soft: #1d2126;

  /* Text */
  --text: #e7eaed;
  --text-dim: #8b9299;
  --text-faint: #565d64;

  /* Brand: amber "live" indicator + cool cyan status trace */
  --accent: #e8951f;
  --accent-strong: #ffab3d;
  --accent-soft: rgba(232, 149, 31, 0.14);
  --accent-2: #4fb0c9;
  --accent-2-soft: rgba(79, 176, 201, 0.14);

  /* Semantic */
  --good: #3fb87f;
  --good-soft: rgba(63, 184, 127, 0.14);
  --warn: #e8951f;
  --warn-soft: rgba(232, 149, 31, 0.14);
  --danger: #e0524a;
  --danger-soft: rgba(224, 82, 74, 0.14);

  /* Type */
  --font-display: 'Chakra Petch', 'IBM Plex Sans', sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow-panel: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] {
  --bg: #eef0f2;
  --panel: #ffffff;
  --panel-2: #f5f6f8;
  --panel-3: #ebedf0;
  --border: #dde1e5;
  --border-soft: #e6e9ec;
  --text: #14171b;
  --text-dim: #5b6570;
  --text-faint: #8b939c;
  --accent: #b5650f;
  --accent-strong: #94500c;
  --accent-soft: rgba(181, 101, 15, 0.1);
  --accent-2: #1f7a91;
  --accent-2-soft: rgba(31, 122, 145, 0.1);
  --good: #1e8f5f;
  --good-soft: rgba(30, 143, 95, 0.1);
  --warn: #b5650f;
  --warn-soft: rgba(181, 101, 15, 0.1);
  --danger: #c73d35;
  --danger-soft: rgba(199, 61, 53, 0.1);
  --shadow-panel: 0 1px 2px rgba(20, 23, 27, 0.04), 0 8px 20px rgba(20, 23, 27, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d10;
    --panel: #14171b;
    --panel-2: #1a1e23;
    --panel-3: #21262c;
    --border: #262b31;
    --border-soft: #1d2126;
    --text: #e7eaed;
    --text-dim: #8b9299;
    --text-faint: #565d64;
    --accent: #e8951f;
    --accent-strong: #ffab3d;
    --accent-soft: rgba(232, 149, 31, 0.14);
    --accent-2: #4fb0c9;
    --accent-2-soft: rgba(79, 176, 201, 0.14);
    --good: #3fb87f;
    --good-soft: rgba(63, 184, 127, 0.14);
    --warn: #e8951f;
    --warn-soft: rgba(232, 149, 31, 0.14);
    --danger: #e0524a;
    --danger-soft: rgba(224, 82, 74, 0.14);
    --shadow-panel: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.35);
  }
}

/* ---------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------ */
* { box-sizing: border-box; }

body.wt {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  /* Faint grid — the instrument-panel texture, kept subtle. */
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 32px 32px;
  background-attachment: fixed;
}

.wt h1, .wt h2, .wt h3, .wt h4 {
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
}

.wt .mono, .wt code, .wt pre {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.wt .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.wt .eyebrow::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------------------------------------------------------------------------
   Instrument bar (top nav) — replaces the old flat purple navbar
   ------------------------------------------------------------------------ */
.wt-topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 28px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.wt-topbar .wt-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.wt-topbar .wt-logo .bolt {
  color: var(--accent);
  font-size: 15px;
}
.wt-topbar nav {
  display: flex;
  gap: 4px;
  flex: 1;
}
.wt-topbar nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: color .15s ease, background .15s ease;
}
.wt-topbar nav a:hover { color: var(--text); background: var(--panel-2); }
.wt-topbar nav a.active { color: var(--accent); background: var(--accent-soft); }

/* Mobile nav toggle (hamburger) — hidden on desktop, shown under 760px */
.wt-nav-toggle {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
}
.wt-nav-toggle:hover { background: var(--panel-2); }

@media (max-width: 760px) {
  .wt-topbar {
    gap: 12px;
    padding: 0 14px;
    flex-wrap: wrap;
  }
  .wt-nav-toggle { display: flex; }
  .wt-topbar .wt-logo { font-size: 15px; }
  .wt-topbar .topbar-user { margin-left: auto; }

  /* nav becomes a solid, opaque dropdown OVERLAY hanging below the bar —
     positioned absolute so it covers page content rather than pushing it
     down (and never lets the background bleed through). Closed by default. */
  .wt-topbar nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 2px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-panel);
    max-height: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
    transition: max-height .2s ease;
    z-index: 99;
  }
  .wt-topbar nav.wt-nav-open {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px 0 12px;
  }
  .wt-topbar nav a {
    background: var(--panel);
    padding: 11px 16px;
    border-radius: var(--radius);
  }
}

/* ---------------------------------------------------------------------------
   Buttons — tactile, like panel switches. Primary action is uppercase+tracked.
   ------------------------------------------------------------------------ */
.wt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.wt-btn:active { transform: translateY(1px); }
.wt-btn-primary {
  background: var(--accent);
  color: #191207;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 12.5px;
}
.wt-btn-primary:hover { background: var(--accent-strong); }
.wt-btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.wt-btn-outline:hover { background: var(--panel-2); border-color: var(--text-faint); }
.wt-btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}
.wt-btn-danger:hover { background: var(--danger); color: #fff; }

/* ---------------------------------------------------------------------------
   Panels (cards)
   ------------------------------------------------------------------------ */
.wt-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  position: relative;
}
.wt-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 16px; right: 16px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-soft) 20%, var(--accent-soft) 80%, transparent);
  opacity: 0;
  transition: opacity .2s ease;
}
.wt-panel.wt-panel-live::before { opacity: 1; }

/* ---------------------------------------------------------------------------
   Indicator-lamp status badges
   ------------------------------------------------------------------------ */
.wt-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
}
.wt-status .lamp { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.wt-status.good { background: var(--good-soft); color: var(--good); }
.wt-status.good .lamp { background: var(--good); box-shadow: 0 0 6px var(--good); }
.wt-status.warn { background: var(--warn-soft); color: var(--warn); }
.wt-status.warn .lamp { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.wt-status.bad { background: var(--danger-soft); color: var(--danger); }
.wt-status.bad .lamp { background: var(--danger); }
.wt-status.idle { background: var(--panel-3); color: var(--text-dim); }
.wt-status.idle .lamp { background: var(--text-faint); }

@keyframes wt-pulse {
  0% { box-shadow: 0 0 0 0 var(--good-soft); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.wt-status.good .lamp { animation: wt-pulse 2.2s infinite; }
@media (prefers-reduced-motion: reduce) { .wt-status .lamp { animation: none !important; } }

/* ---------------------------------------------------------------------------
   Inputs
   ------------------------------------------------------------------------ */
.wt-input, .wt-select, .wt-textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 12px;
  transition: border-color .15s ease;
}
.wt-input:focus, .wt-select:focus, .wt-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------------------------------------------------------------------------
   Tables
   ------------------------------------------------------------------------ */
.wt-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.wt-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.wt-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
.wt-table tr:last-child td { border-bottom: none; }

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

.wt-scroll-x { overflow-x: auto; }
