/* ============================================================
   WORKMONITOR — TOUR INTERATIVO (casco compartilhado)
   Experiência em viewport única: topo + painel mockado + barra
   de navegação. Identidade 100% WorkMonitor.
   ============================================================ */

:root {
  --bg-deep: #031614;
  --bg-dark: #052921;
  --green-deep: #003c30;
  --green: #04d48a;
  --orange: #ff9700;
  --line-dark: rgba(255, 255, 255, 0.08);
  --txt: #e8f5f0;
  --txt-soft: rgba(232, 245, 240, 0.6);
  --txt-mute: rgba(232, 245, 240, 0.4);
}

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

html, body { height: 100%; }
body {
  font-family: 'Barlow', sans-serif;
  background: var(--bg-deep);
  color: var(--txt);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden; /* tour vive em UMA tela, sem scroll */
  -webkit-font-smoothing: antialiased;
}

/* ============ CASCO EM 3 CAMADAS ============ */
.tour {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* --- Barra superior --- */
.tour-top {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 22px;
  background: linear-gradient(90deg, #042c24 0%, var(--green-deep) 60%, #052921 100%);
  border-bottom: 1px solid var(--line-dark);
}
.tour-top .brand {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 16px; color: white;
  white-space: nowrap;
}
.tour-top .brand img { height: 22px; width: auto; display: block; }
.tour-top .brand span { font-weight: 400; color: var(--txt-soft); }
.tour-step-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 1px;
  color: var(--green);
  background: rgba(4, 212, 138, 0.1);
  border: 1px solid rgba(4, 212, 138, 0.35);
  border-radius: 999px;
  padding: 5px 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tour-close {
  margin-left: auto;
  width: 36px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--txt-soft);
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  text-decoration: none;
  font-size: 18px; line-height: 1;
  transition: all 0.2s;
}
.tour-close:hover { color: white; border-color: var(--green); }

/* --- Palco (painel mockado) --- */
.tour-stage {
  min-height: 0; /* permite o grid encolher sem estourar */
  padding: clamp(10px, 1.6vh, 22px);
  display: grid;
}
.panel {
  min-height: 0;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  background: linear-gradient(135deg, #042621 0%, #04231e 100%);
  border: 1px solid rgba(4, 212, 138, 0.15);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Sidebar do painel */
.panel-side {
  border-right: 1px solid var(--line-dark);
  background: rgba(0, 0, 0, 0.22);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 0;
}
.panel-side .logo {
  display: flex; align-items: center;
  padding: 4px 10px 14px;
  border-bottom: 1px solid var(--line-dark);
  margin-bottom: 10px;
}
.panel-side .logo img { height: 20px; width: auto; display: block; }
.side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--txt-soft);
  font-size: 13.5px; font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.side-item svg { flex-shrink: 0; opacity: 0.85; }
.side-item.active {
  background: linear-gradient(90deg, rgba(4, 212, 138, 0.18), rgba(4, 212, 138, 0.06));
  border: 1px solid rgba(4, 212, 138, 0.35);
  color: white;
}
.side-item.active::after {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  margin-left: auto;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Área principal do painel */
.panel-main {
  min-height: 0; min-width: 0;
  padding: clamp(12px, 2vh, 22px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: clamp(10px, 1.6vh, 18px);
}
.panel-head { display: flex; align-items: center; gap: 14px; }
.panel-head h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(17px, 2.2vh, 22px);
  font-weight: 600; color: white; letter-spacing: -0.01em;
}
.panel-head .sub { font-size: 12px; color: var(--txt-mute); margin-top: 1px; }
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 59, 48, 0.12); color: #ff4d44;
  padding: 4px 10px; border-radius: 999px;
  font-size: 10px; font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}
.live-badge i { width: 7px; height: 7px; background: #ff4d44; border-radius: 50%; animation: pulse 1.4s infinite; }
.panel-user {
  margin-left: auto;
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--txt-soft);
}
.panel-user .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green-deep), var(--green));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 12px;
}

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(8px, 1.2vw, 14px); }
.kpi {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line-dark);
  border-radius: 12px;
  padding: clamp(10px, 1.6vh, 16px);
  min-width: 0;
  position: relative;
}
.kpi .l {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--txt-mute);
}
.kpi .n {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: clamp(20px, 3.4vh, 30px);
  color: white; line-height: 1.1; margin-top: 4px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.kpi .n small { font-size: 0.55em; color: var(--txt-mute); font-weight: 400; }
.kpi .d { font-size: 11px; margin-top: 3px; color: var(--green); white-space: nowrap; }
.kpi .d.neg { color: var(--txt-mute); }
.kpi .d.warn { color: var(--orange); }

/* ============ BALÕES EXPLICATIVOS ============ */
.balloon {
  position: absolute;
  z-index: 5;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600;
  color: var(--bg-deep);
  padding: 7px 13px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  animation: balloon-in 0.5s ease both;
  white-space: nowrap;
}
.balloon::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: rgba(3, 22, 20, 0.55); }
.balloon::after {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  background: inherit;
  transform: rotate(45deg);
}
.balloon.green { background: var(--green); }
.balloon.orange { background: var(--orange); }
.balloon.tip-bottom::after { bottom: -4px; left: 22px; }
.balloon.tip-top::after { top: -4px; left: 22px; }
.balloon.tip-right::after { right: -4px; top: calc(50% - 5px); }
@keyframes balloon-in {
  from { opacity: 0; transform: translateY(8px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.balloon:nth-of-type(2) { animation-delay: 0.9s; }
.balloon:nth-of-type(3) { animation-delay: 1.8s; }

/* ============ BARRA DE NAVEGAÇÃO (rodapé do tour) ============ */
.tour-nav {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 12px 22px 14px;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid var(--line-dark);
}
.tour-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-family: 'Barlow', sans-serif;
  font-weight: 600; font-size: 14px;
  text-decoration: none;
  border: none; cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.tour-btn.prev {
  justify-self: start;
  background: transparent;
  color: var(--txt-soft);
  border: 1px solid var(--line-dark);
}
.tour-btn.prev:hover { color: white; border-color: var(--green); }
.tour-btn.prev.disabled { opacity: 0.3; pointer-events: none; }
.tour-btn.next {
  justify-self: end;
  background: var(--orange);
  color: var(--bg-deep);
}
.tour-btn.next:hover { background: white; transform: translateY(-1px); }
.tour-btn.next.finish { background: var(--green); }

/* Dots nomeados */
.tour-dots { display: flex; gap: clamp(10px, 2vw, 26px); justify-content: center; }
.tour-dot {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: 11px; color: var(--txt-mute);
  text-decoration: none;
  transition: color 0.2s;
}
.tour-dot i {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: all 0.2s;
}
.tour-dot:hover { color: var(--txt-soft); }
.tour-dot.done i { background: var(--green); opacity: 0.55; }
.tour-dot.done { color: var(--txt-soft); }
.tour-dot.active { color: var(--green); font-weight: 600; }
.tour-dot.active i {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(4, 212, 138, 0.2);
}

/* Barra de progresso do autoplay */
.tour-progress {
  position: absolute;
  top: -1px; left: 0;
  height: 2px; width: 0%;
  background: var(--green);
  transition: width 0.2s linear;
}

/* ============ ACESSIBILIDADE / MOBILE ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .balloon { opacity: 1; }
}

@media (max-width: 860px) {
  .panel { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .panel-side {
    flex-direction: row; align-items: center;
    overflow-x: auto; overflow-y: hidden;
    border-right: none; border-bottom: 1px solid var(--line-dark);
    padding: 10px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .panel-side::-webkit-scrollbar { display: none; }
  .panel-side .logo { border-bottom: none; margin: 0 6px 0 0; padding: 0 8px 0 0; border-right: 1px solid var(--line-dark); }
  .side-item { padding: 7px 12px; font-size: 12.5px; }
  .side-item.active::after { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .panel-user .name { display: none; }
  .tour-top { padding: 10px 14px; gap: 10px; }
  .tour-top .brand span { display: none; }
  .tour-nav { grid-template-columns: auto 1fr auto; padding: 10px 14px 12px; }
  .tour-dot span { display: none; }         /* mobile: só as bolinhas */
  .tour-dots { gap: 9px; }
  .tour-btn { padding: 10px 16px; font-size: 13px; }
  .balloon { font-size: 11px; padding: 6px 10px; }
}

@media (max-height: 640px) {
  .kpi .n { font-size: 19px; }
  .panel-main { gap: 8px; }
  .tour-nav { padding: 8px 16px 10px; }
}

/* ===== Celular deitado (tela baixa): barras mínimas, palco máximo ===== */
@media (max-height: 520px) {
  .tour-top { padding: 5px 12px; gap: 10px; }
  .tour-top .brand img { height: 16px; }
  .tour-top .brand span { display: none; }
  .tour-step-pill { font-size: 9px; padding: 3px 10px; letter-spacing: 0.6px; }
  .tour-close { width: 26px; height: 26px; font-size: 13px; border-radius: 7px; }
  .tour-nav { padding: 5px 12px 7px; gap: 10px; }
  .tour-btn { padding: 6px 13px; font-size: 12px; }
  .tour-dots { gap: 8px; }
  .tour-dot span { display: none; }
  .tour-dot i { width: 8px; height: 8px; }
}
