/* =========================================================
   INNUBIX Brand Guidelines v2.0 — Web CSS (Tokens + Components)
   - Dark/Light via prefers-color-scheme
   - Orange = Action
   - Surface over borders
   - Minimal, controlled shadows
   ========================================================= */

/* -----------------------------
   1) DESIGN TOKENS
-------------------------------- */

:root {
  /* Brand */
  --brand-primary: #C84E08;
  --brand-primary-hover: #A53E06;
  --brand-primary-light: #F27A2C;

  /* Status */
  --status-success: #2D9D78;
  --status-warning: #D9822B;
  --status-error: #C3312F;
  --status-info: #3A7BD5;

  /* Typography */
  --font-sans: Inter, system-ui, -apple-system, "SF Pro Text", "SF Pro Display",
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;

  /* Type scale */
  --text-h1: 48px;
  --lh-h1: 56px;

  --text-h2: 32px;
  --lh-h2: 40px;

  --text-h3: 24px;
  --lh-h3: 32px;

  --text-body-lg: 18px;
  --lh-body-lg: 28px;

  --text-body-md: 16px;
  --lh-body-md: 24px;

  --text-body-sm: 14px;
  --lh-body-sm: 20px;

  --text-label: 14px;
  --lh-label: 16px;

  --text-button: 16px;
  --lh-button: 16px;

  /* Spacing (8pt grid) */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 64px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-round: 999px;

  /* Motion */
  --dur-fast: 120ms;
  --dur-standard: 180ms;
  --dur-slow: 240ms;
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --container-max: 1280px;
  --container-pad: 32px;

  /* Default to Light, overridden by prefers-color-scheme */
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --elevated: #FFFFFF;

  --text-primary: #1E1E1F;
  --text-secondary: #6E6E73;
  --text-tertiary: #A1A1A6;

  --border-subtle: rgba(0, 0, 0, 0.06);

  /* Shadows (subtle) */
  --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.05);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.20);

  color-scheme: light dark;
}

/* Dark mode tokens */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1E1E1F;
    --surface: #2A2A2D;
    --elevated: #323236;

    --text-primary: #F5F5F7;
    --text-secondary: #A1A1A6;
    --text-tertiary: #6E6E73;

    --border-subtle: rgba(255, 255, 255, 0.06);

    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.25);
    --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.40);
  }
}

/* Optional: manual theme override via data-theme */
html[data-theme="light"] {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --elevated: #FFFFFF;

  --text-primary: #1E1E1F;
  --text-secondary: #6E6E73;
  --text-tertiary: #A1A1A6;

  --border-subtle: rgba(0, 0, 0, 0.06);

  --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.05);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.20);

  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #1E1E1F;
  --surface: #2A2A2D;
  --elevated: #323236;

  --text-primary: #F5F5F7;
  --text-secondary: #A1A1A6;
  --text-tertiary: #6E6E73;

  --border-subtle: rgba(255, 255, 255, 0.06);

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.40);

  color-scheme: dark;
}

/* -----------------------------
   2) BASE / RESET
-------------------------------- */

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body-md);
  line-height: var(--lh-body-md);
  font-weight: var(--font-weight-regular);
  background: var(--bg);
  color: var(--text-primary);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* -----------------------------
   3) TYPOGRAPHY CLASSES
-------------------------------- */

.h1 {
  font-size: var(--text-h1);
  line-height: var(--lh-h1);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
}

.h2 {
  font-size: var(--text-h2);
  line-height: var(--lh-h2);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
}

.h3 {
  font-size: var(--text-h3);
  line-height: var(--lh-h3);
  font-weight: var(--font-weight-semibold);
}

.body-lg {
  font-size: var(--text-body-lg);
  line-height: var(--lh-body-lg);
}

.body-md {
  font-size: var(--text-body-md);
  line-height: var(--lh-body-md);
}

.body-sm {
  font-size: var(--text-body-sm);
  line-height: var(--lh-body-sm);
}

.label {
  font-size: var(--text-label);
  line-height: var(--lh-label);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
}

/* -----------------------------
   4) LAYOUT UTILITIES
-------------------------------- */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.spacer {
  flex: 1;
}

/* -----------------------------
   5) NAVIGATION
-------------------------------- */

.navbar {
  height: 72px;
  display: flex;
  align-items: center;
  background: transparent;
}

.navbar__inner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-secondary);
}

.navbar__link {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--dur-standard) var(--ease-standard),
              background var(--dur-standard) var(--ease-standard);
}

.navbar__link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.navbar__link[aria-current="page"] {
  color: var(--text-primary);
  position: relative;
}

.navbar__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -10px;
  height: 2px;
  background: var(--brand-primary);
  border-radius: var(--radius-round);
}

/* -----------------------------
   6) BUTTONS
-------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 0;
  cursor: pointer;

  font-size: var(--text-button);
  line-height: var(--lh-button);
  font-weight: var(--font-weight-medium);

  transition: transform var(--dur-fast) var(--ease-standard),
              background var(--dur-standard) var(--ease-standard),
              color var(--dur-standard) var(--ease-standard),
              border-color var(--dur-standard) var(--ease-standard),
              opacity var(--dur-standard) var(--ease-standard);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Primary */
.btn--primary {
  background: var(--brand-primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--brand-primary-hover);
}

/* Secondary */
.btn--secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

/* Ghost */
.btn--ghost {
  background: transparent;
  color: var(--brand-primary);
  border: 1px solid var(--brand-primary);
}

/* Destructive (for web tools, admin actions) */
.btn--danger {
  background: transparent;
  color: var(--status-error);
  border: 1px solid color-mix(in srgb, var(--status-error) 70%, transparent);
}

/* -----------------------------
   7) CARDS
-------------------------------- */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-card);
}

.card--elevated {
  background: var(--elevated);
}

.card__title {
  font-weight: var(--font-weight-semibold);
}

.card__meta {
  color: var(--text-secondary);
}

/* -----------------------------
   8) INPUTS
-------------------------------- */

.input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  color: var(--text-primary);

  transition: border-color var(--dur-standard) var(--ease-standard),
              box-shadow var(--dur-standard) var(--ease-standard);
}

.input::placeholder {
  color: var(--text-tertiary);
}

.input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 20%, transparent);
}

/* Input states */
.input--error {
  border-color: var(--status-error);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-error) 18%, transparent);
}

.help {
  margin-top: 8px;
  font-size: var(--text-body-sm);
  line-height: var(--lh-body-sm);
  color: var(--text-secondary);
}

.help--error {
  color: var(--status-error);
}

/* -----------------------------
   9) STATUS CHIPS / DOTS
-------------------------------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: var(--text-body-sm);
  line-height: var(--lh-body-sm);
}

.status__dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-round);
  background: var(--text-tertiary);
}

.status--online .status__dot { background: var(--status-success); }
.status--offline .status__dot { background: var(--status-error); }
.status--connecting .status__dot { background: var(--status-warning); }

/* -----------------------------
   10) MODAL (optional)
-------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: grid;
  place-items: center;
  padding: var(--space-4);
}

.modal {
  width: min(640px, 100%);
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  padding: var(--space-4);
}

/* -----------------------------
   11) HERO (optional)
-------------------------------- */

.hero {
  padding: clamp(56px, 8vw, 120px) 0;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}

@media (max-width: 960px) {
  .hero__grid {
    grid-template-columns: 1fr;
  }
}

.hero__sub {
  color: var(--text-secondary);
  max-width: 56ch;
}

.hero__cta {
  margin-top: var(--space-3);
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
