/* ═══════════════════════════════════════════════════════════════════
   SERVIO POC — DESIGN SYSTEM
   ═══════════════════════════════════════════════════════════════════ */

/* ── Tokens ────────────────────────────────────────────────────── */
:root {
  --primary: #0A192F;
  --primary-h: 213;
  --primary-s: 63%;
  --primary-l: 8%;

  --surface-0: #ffffff;
  --surface-1: #f8fafc;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;

  --text-0: #0f172a;
  --text-1: #334155;
  --text-2: #64748b;
  --text-3: #94a3b8;

  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 0.5s var(--ease-out);
}

html.dark {
  --surface-0: #030712;
  --surface-1: #0b1120;
  --surface-2: #111827;
  --surface-3: #1e293b;

  --text-0: #f8fafc;
  --text-1: #cbd5e1;
  --text-2: #94a3b8;
  --text-3: #475569;

  --glass-bg: rgba(11, 17, 32, 0.6);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--surface-1);
  color: var(--text-0);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

.hidden { display: none !important; }

/* ── Layered Background ───────────────────────────────────────── */
.bg-layer {
  position: fixed; inset: 0;
  z-index: 0; pointer-events: none;
  overflow: hidden;
}

.bg-pattern {
  position: absolute; inset: 0;
  background: url('assets/pattern.svg') repeat;
  background-size: 440px;
  opacity: 0.028;
  transition: opacity var(--transition), transform 0.8s var(--ease-out);
}

html.dark .bg-pattern { opacity: 0.015; filter: invert(1); }

.bg-noise {
  position: absolute; inset: 0;
  opacity: 0.3;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.08;
  transition: opacity var(--transition);
}

html.dark .bg-orb { opacity: 0.04; }

.bg-orb--1 {
  width: 600px; height: 600px;
  top: -15%; left: -8%;
  background: var(--primary);
}

.bg-orb--2 {
  width: 450px; height: 450px;
  bottom: -10%; right: 5%;
  background: hsl(var(--primary-h), 50%, 45%);
}

.bg-orb--3 {
  width: 280px; height: 280px;
  top: 35%; left: 55%;
  background: hsl(calc(var(--primary-h) + 40), 60%, 55%);
  opacity: 0.05;
}

/* ═══════════════════════════════════════════════════════════════════
   ONBOARDING — Full page centered, no card
   ═══════════════════════════════════════════════════════════════════ */
.onboarding {
  position: fixed; inset: 0;
  z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 24px;
  transition: opacity 0.6s var(--ease-out), visibility 0.6s;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

.onboarding.is-hidden {
  opacity: 0; pointer-events: none; visibility: hidden;
}

.onboarding__content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 440px;
  background: var(--surface-0);
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.15);
  border: 1px solid var(--glass-border);
  animation: fadeUp 0.7s var(--ease-out) both;
}

.onboarding__close {
  position: absolute;
  top: 20px; right: 20px;
  background: none; border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 8px; border-radius: 50%;
  transition: all 0.2s;
  display: flex;
}
.onboarding__close:hover {
  background: var(--surface-2);
  color: var(--text-0);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.onboarding__logo {
  height: 32px; object-fit: contain;
  margin-bottom: 32px;
  opacity: 0.85;
}

html.dark .onboarding__logo {
  filter: brightness(0) invert(1);
}

.onboarding__heading {
  font-size: 32px; font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 8px;
  text-align: center;
}

.onboarding__desc {
  font-size: 14px; color: var(--text-2);
  line-height: 1.6; text-align: center;
  margin-bottom: 36px;
  max-width: 360px;
}

/* ── Setup Form ────────────────────────────────────────────────── */
.setup-form {
  width: 100%;
  display: flex; flex-direction: column;
}

.field {
  margin-bottom: 20px;
}

.field__label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600;
  color: var(--text-2); text-transform: uppercase;
  letter-spacing: 0.7px; margin-bottom: 8px;
}

.field__label svg { opacity: 0.45; flex-shrink: 0; }

.field__hint {
  font-size: 10px; font-weight: 400;
  text-transform: none; letter-spacing: 0;
  color: var(--text-3); margin-left: auto;
}

.field__input {
  width: 100%;
  background: var(--surface-0);
  border: 1.5px solid var(--surface-3);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px; font-family: inherit;
  color: var(--text-0);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

html.dark .field__input { background: var(--surface-2); }

.field__input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.08);
}

/* Theme Toggle */
.theme-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}

.theme-toggle__btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px;
  border: 1.5px solid var(--surface-3);
  border-radius: var(--radius-sm);
  background: var(--surface-0);
  font-family: inherit; font-size: 13px;
  font-weight: 600; color: var(--text-2);
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
}

html.dark .theme-toggle__btn { background: var(--surface-2); }

.theme-toggle__btn:hover { border-color: var(--text-3); }

.theme-toggle__btn--active {
  border-color: var(--primary);
  color: var(--primary);
  background: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.04);
}

/* Logo Upload */
.logo-upload {
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--surface-3);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  min-height: 64px;
}

.logo-upload:hover {
  border-color: var(--primary);
  background: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.02);
}

.logo-upload__empty {
  display: flex; align-items: center; gap: 10px;
}

.logo-upload__icon { color: var(--text-3); flex-shrink: 0; }

.logo-upload__text {
  font-size: 13px; color: var(--text-2);
}

.logo-upload__text strong {
  color: var(--primary); font-weight: 700;
}

.logo-upload__preview {
  display: flex; align-items: center; gap: 12px;
  position: relative;
}

.logo-upload__preview img {
  max-height: 44px; max-width: 160px;
  object-fit: contain; border-radius: 4px;
}

.logo-upload__remove {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--text-3); color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s var(--ease-spring);
  flex-shrink: 0;
}

.logo-upload__remove:hover {
  background: #ef4444; transform: scale(1.1);
}

/* Color Selector */
.color-selector {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
}

.color-selector__swatches {
  display: flex; gap: 8px;
}

.swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  background: var(--swatch-color);
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), border-color 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  position: relative;
}

.swatch:hover { transform: scale(1.15); }

.swatch--active {
  border-color: var(--text-0);
  transform: scale(1.15);
}

/* Custom color picker — visible native picker wrapped in label */
.color-selector__custom {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  position: relative;
}

.color-selector__native {
  position: absolute;
  width: 28px; height: 28px;
  opacity: 0;
  cursor: pointer;
  top: 0; left: 0;
  z-index: 2;
}

.color-selector__custom-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  border: 2.5px solid transparent;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  transition: transform 0.2s var(--ease-spring), border-color 0.2s;
  position: relative;
  /* gradient overlay to show it's a "picker" */
  overflow: hidden;
}

.color-selector__custom-swatch::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    hsl(0, 70%, 60%),
    hsl(60, 70%, 60%),
    hsl(120, 70%, 60%),
    hsl(180, 70%, 60%),
    hsl(240, 70%, 60%),
    hsl(300, 70%, 60%),
    hsl(360, 70%, 60%)
  );
  opacity: 0.3;
  transition: opacity 0.2s;
}

.color-selector__custom:hover .color-selector__custom-swatch::after {
  opacity: 0.5;
}

.color-selector__custom-label {
  font-size: 12px; font-weight: 600; color: var(--text-3);
}

/* Launch Button */
.btn-launch {
  width: 100%; margin-top: 12px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px;
  background: var(--primary);
  color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  box-shadow: 0 4px 16px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.2);
  position: relative;
  overflow: hidden;
}

.btn-launch::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 50%);
}

.btn-launch:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.3);
}

.btn-launch:hover svg {
  transform: translateX(3px);
}

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

/* ═══════════════════════════════════════════════════════════════════
   WORKSPACE
   ═══════════════════════════════════════════════════════════════════ */
.workspace {
  display: flex; flex-direction: column;
  height: 100vh;
  position: relative; z-index: 10;
  opacity: 0; pointer-events: none;
  transition: opacity 0.7s var(--ease-out);
}

.workspace.is-visible {
  opacity: 1; pointer-events: auto;
}

/* ── Top Bar ───────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--glass-border);
  z-index: 50; flex-shrink: 0;
  border-radius: 100px;
  width: max-content;
  max-width: 90%;
  gap: 32px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.05);
  position: absolute;
  top: 20px; left: 50%;
  transform: translateX(-50%);
}

.topbar__left {
  display: flex; align-items: center; gap: 14px;
}

.topbar__logo {
  height: 20px; object-fit: contain;
}

html.dark .topbar__logo { filter: brightness(0) invert(1); }

.topbar__divider {
  width: 1px; height: 18px;
  background: var(--surface-3);
}

.topbar__tenant {
  font-size: 13px; font-weight: 700;
  color: var(--text-1); letter-spacing: -0.2px;
}

.topbar__center {
  position: absolute; left: 50%; transform: translateX(-50%);
}

.view-switcher {
  display: flex;
  background: var(--surface-2);
  border-radius: 6px;
  padding: 3px;
  border: 1px solid var(--glass-border);
}

.view-switcher__btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border: none; border-radius: 4px;
  background: transparent;
  font-family: inherit; font-size: 12px;
  font-weight: 600; color: var(--text-3);
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  white-space: nowrap;
}

.view-switcher__btn:hover { color: var(--text-1); }

.view-switcher__btn--active {
  background: var(--surface-0);
  color: var(--text-0);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

html.dark .view-switcher__btn--active { background: var(--surface-3); }

.topbar__right {
  display: flex; align-items: center; gap: 8px;
}

.topbar__status {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 7px;
  border-radius: 100px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.12);
  font-size: 11px; font-weight: 600;
  color: #059669; white-space: nowrap;
}

html.dark .topbar__status { color: #34d399; }

.status-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #10b981;
  animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  50% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0); }
}

.topbar__btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  background: var(--surface-1);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.topbar__btn:hover {
  background: var(--surface-2);
  color: var(--text-0);
  transform: translateY(-1px);
}

/* ── Arena ─────────────────────────────────────────────────────── */
.arena {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 28px;
  perspective: 1800px;
  position: relative; z-index: 10;
  overflow: hidden;
}

.arena__stage {
  display: flex; align-items: stretch;
  gap: 60px;
  width: 100%; max-width: 1800px;
  transform-style: preserve-3d;
  transition: transform 0.8s var(--ease-out);
}

.arena__stage--perspective {
  transform: none;
}

/* Sync Bridge */
.sync-bridge {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0; padding: 0 6px;
  flex-shrink: 0; width: 52px;
  align-self: center;
}

.sync-bridge__line {
  width: 1px; height: 36px;
  background: linear-gradient(to bottom, transparent, var(--text-3), transparent);
  opacity: 0.2;
}

.sync-bridge__icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  animation: syncSpin 5s linear infinite;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}

@keyframes syncSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Device Column */
.device-column {
  flex: 1;
  display: flex; flex-direction: column; gap: 10px;
  transition: all 0.6s var(--ease-out);
  transform-style: preserve-3d;
}

.device-column__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px;
}

.device-column__label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600;
  color: var(--text-2);
}

.device-column__label svg { opacity: 0.4; }

.device-column__expand {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--glass-border);
  border-radius: 5px;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.device-column__expand:hover {
  color: var(--primary); border-color: var(--primary);
}

/* Device Frame */
.device-frame {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s var(--ease-out);
}

.device-frame:hover {
  /* removed hover translation */
}

.arena__stage--perspective .device-frame:hover {
  /* removed hover translation */
}

.device-frame__bezel {
  background: #16162a;
  border-radius: 24px;
  padding: 12px 12px 6px 12px;
  position: relative;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 16px 48px -12px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: box-shadow 0.5s var(--ease-out);
}

.device-frame:hover .device-frame__bezel {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 28px 64px -8px rgba(0, 0, 0, 0.4),
    0 0 32px -8px hsla(var(--primary-h), 50%, 40%, 0.12);
}

.device-frame__camera {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #1e293b;
  margin: 0 auto 6px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04);
}

.device-frame__screen {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 10px rgba(0,0,0,0.4) inset;
}

.device-frame__screen iframe {
  width: 180%; height: 180%;
  transform: scale(0.5555555);
  transform-origin: top left;
  border: none; background: #fff;
}

.device-frame__chin {
  display: flex; justify-content: center;
  padding: 5px 0 1px;
}

.device-frame__home-bar {
  width: 32px; height: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
}

.device-frame__reflection {
  position: absolute; inset: 12px 12px 24px 12px;
  border-radius: 12px;
  background: linear-gradient(
    150deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0) 35%
  );
  pointer-events: none; z-index: 10;
  transition: opacity 0.3s;
}

.device-frame:hover .device-frame__reflection { opacity: 0.7; }

.device-frame__shadow {
  position: absolute;
  bottom: -16px; left: 12%; right: 12%;
  height: 32px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.15) 0%, transparent 70%);
  filter: blur(10px);
  z-index: -1;
  transition: all 0.5s var(--ease-out);
}

.device-frame:hover .device-frame__shadow {
  bottom: -22px; left: 8%; right: 8%;
}

/* Focus Mode */
.arena__stage.focus-meeting #colService,
.arena__stage.focus-service #colMeeting {
  flex: 0; opacity: 0; pointer-events: none;
  transform: scale(0.85) translateZ(-80px);
  overflow: hidden; max-width: 0;
}

.arena__stage.focus-meeting .sync-bridge,
.arena__stage.focus-service .sync-bridge {
  opacity: 0; width: 0; padding: 0; overflow: hidden;
}

.arena__stage.focus-meeting #colMeeting,
.arena__stage.focus-service #colService {
  max-width: 900px; margin: 0 auto;
}

/* ── Bottom Bar ────────────────────────────────────────────────── */
.bottombar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.5);
  border-top: 1px solid var(--glass-border);
  z-index: 50; flex-shrink: 0;
}

.bottombar__hint {
  font-size: 12px; color: var(--text-3);
}

.bottombar__sync {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  color: var(--primary);
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE BLOCK
   ═══════════════════════════════════════════════════════════════════ */
.mobile-block {
  display: none;
  position: fixed; inset: 0;
  z-index: 9999;
  background: var(--surface-0);
  align-items: center; justify-content: center;
  padding: 32px;
  text-align: center;
}

.mobile-block__content {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  max-width: 400px;
}

.mobile-block__content svg {
  color: var(--primary);
  margin-bottom: 8px;
}

.mobile-block__content h2 {
  font-size: 24px; font-weight: 800;
  color: var(--text-0);
  margin: 0;
}

.mobile-block__content p {
  font-size: 15px; color: var(--text-2);
  line-height: 1.6; margin: 0;
}

.mobile-block__content strong {
  color: var(--text-1);
}

@media (max-width: 1000px) {
  .mobile-block {
    display: flex;
  }
  .workspace, .onboarding, .bg-layer {
    display: none !important;
  }
}
