/* ============================================================
   DEMOS.CSS — Painéis interativos premium
   CRM, Métricas e Chat ao vivo
   ============================================================ */


/* ─── Base do painel ─────────────────────────────────────── */
.demo-panel {
  background: rgba(10, 9, 8, .97);
  border: 1px solid rgba(145, 70, 255, .28);
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(145, 70, 255, .07),
    0 32px 80px rgba(0, 0, 0, .65),
    inset 0 1px 0 rgba(255, 255, 255, .06);
  position: relative;
}

/* Gradient border top */
.demo-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, rgba(145,70,255,.6) 0%, rgba(145,70,255,.12) 40%, transparent 70%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ─── Chrome (barra de título) ───────────────────────────── */
.demo-chrome {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1rem;
  background: rgba(255, 255, 255, .03);
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  position: relative;
  z-index: 1;
}

.chrome-dots {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.chrome-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.chrome-dot:nth-child(1) { background: #FF5F57; }
.chrome-dot:nth-child(2) { background: #FFBD2E; }
.chrome-dot:nth-child(3) { background: #27C93F; }

.demo-chrome__title {
  flex: 1;
  font-family: var(--font-display);
  font-size: .7rem;
  font-weight: 500;
  color: rgba(255, 255, 255, .38);
  text-align: center;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-chrome__live {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .65rem;
  font-weight: 700;
  color: #7BF07F;
  letter-spacing: .06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(123,240,127,.4); }
  50%       { opacity: .7; box-shadow: 0 0 0 4px rgba(123,240,127,0); }
}

.live-dot {
  width: 7px;
  height: 7px;
  background: #7BF07F;
  border-radius: 50%;
  animation: live-pulse 2.2s ease-in-out infinite;
}

.demo-caveat {
  font-size: .64rem;
  color: rgba(255, 255, 255, .18);
  text-align: center;
  padding: .55rem 1rem .65rem;
  border-top: 1px solid rgba(255, 255, 255, .04);
  position: relative;
  z-index: 1;
}


/* ─── CRM Pipeline ───────────────────────────────────────── */
.crm-body {
  padding: .85rem 1rem;
  position: relative;
  z-index: 1;
}

.crm-cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-bottom: .85rem;
}

.crm-col__head {
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .28);
  margin-bottom: .45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .25rem;
}

.crm-count {
  background: rgba(145, 70, 255, .22);
  color: var(--pervinca);
  border-radius: 999px;
  padding: .05rem .3rem;
  font-size: .58rem;
  font-weight: 700;
  flex-shrink: 0;
}

.crm-card {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 6px;
  padding: .38rem .45rem;
  margin-bottom: .3rem;
  font-size: .65rem;
  color: rgba(255, 255, 255, .65);
  line-height: 1.3;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .35s ease, transform .35s ease;
}

.crm-card.is-visible {
  opacity: 1;
  transform: none;
}

.crm-card__label {
  font-size: .56rem;
  color: var(--pervinca);
  margin-bottom: .1rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  opacity: .8;
}

/* Agenda */
.crm-agenda {
  border-top: 1px solid rgba(255, 255, 255, .05);
  padding-top: .7rem;
}

.crm-agenda__title {
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .25);
  margin-bottom: .45rem;
}

.agenda-slot {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .28rem .4rem;
  border-radius: 5px;
  margin-bottom: .18rem;
  font-size: .65rem;
  color: rgba(255, 255, 255, .55);
  border: 1px solid transparent;
  transition: background .5s ease, border-color .5s ease;
}

.agenda-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background .5s ease;
}

.agenda-time {
  font-weight: 600;
  color: rgba(255, 255, 255, .28);
  font-size: .62rem;
  min-width: 3rem;
  flex-shrink: 0;
}

.agenda-label {
  transition: color .5s ease;
}

/* Taken slot */
.agenda-slot--taken { background: rgba(145, 70, 255, .06); }
.agenda-slot--taken .agenda-dot { background: rgba(145, 70, 255, .7); }

/* Free slot */
.agenda-slot--free {
  background: rgba(123, 240, 127, .05);
  border-color: rgba(123, 240, 127, .15);
}

.agenda-slot--free .agenda-dot { background: #7BF07F; }
.agenda-slot--free .agenda-label { color: #7BF07F; }

/* Booked state (after animation) */
.agenda-slot--free.is-booked {
  background: rgba(145, 70, 255, .1);
  border-color: rgba(145, 70, 255, .3);
}

.agenda-slot--free.is-booked .agenda-dot { background: var(--roxo); }
.agenda-slot--free.is-booked .agenda-label { color: var(--pervinca); }


/* ─── Metrics Dashboard ──────────────────────────────────── */
.metrics-body {
  padding: .85rem 1rem;
  position: relative;
  z-index: 1;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .45rem;
  margin-bottom: 1.1rem;
}

.kpi {
  padding: .55rem .5rem;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 7px;
}

.kpi__label {
  font-size: .56rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: rgba(255, 255, 255, .28);
  margin-bottom: .2rem;
  font-weight: 700;
}

.kpi__value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--w);
  line-height: 1;
  margin-bottom: .18rem;
  white-space: nowrap;
}

.kpi__delta {
  font-size: .58rem;
  font-weight: 600;
  white-space: nowrap;
}

.kpi__delta--up   { color: #7BF07F; }
.kpi__delta--down { color: rgba(255, 120, 100, .9); }

/* Bar chart */
.chart-area { margin-bottom: .85rem; }

.chart-label {
  font-size: .58rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: rgba(255, 255, 255, .22);
  margin-bottom: .45rem;
  font-weight: 700;
}

.week-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 56px;
}

.week-bar {
  flex: 1;
  background: linear-gradient(to top, var(--roxo), rgba(145, 70, 255, .35));
  border-radius: 3px 3px 0 0;
  height: 0;
  transition: height 1s cubic-bezier(.22, 1, .36, 1);
  min-width: 0;
}

/* Channel breakdown */
.channel-rows {
  display: flex;
  flex-direction: column;
  gap: .38rem;
  border-top: 1px solid rgba(255, 255, 255, .05);
  padding-top: .7rem;
}

.channel-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  align-items: center;
  gap: .5rem;
}

.channel-name {
  font-size: .62rem;
  color: rgba(255, 255, 255, .38);
  font-weight: 600;
  white-space: nowrap;
}

.channel-track {
  background: rgba(255, 255, 255, .05);
  border-radius: 2px;
  height: 4px;
  overflow: hidden;
}

.channel-fill {
  height: 100%;
  border-radius: 2px;
  width: 0;
  transition: width 1.2s cubic-bezier(.22, 1, .36, 1) .2s;
}

.channel-fill--google  { background: linear-gradient(90deg, #4285F4, rgba(66,133,244,.5)); }
.channel-fill--meta    { background: linear-gradient(90deg, #1877F2, rgba(24,119,242,.4)); }
.channel-fill--organic { background: linear-gradient(90deg, #7BF07F, rgba(123,240,127,.4)); }

.channel-pct {
  font-size: .6rem;
  color: rgba(255, 255, 255, .28);
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}


/* ─── Chat Demo (interativo) ─────────────────────────────── */
.demo-chat {
  display: flex;
  flex-direction: column;
}

.demo-chat__feed {
  flex: 1;
  overflow-y: auto;
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  min-height: 220px;
  max-height: 340px;
  scroll-behavior: smooth;
  position: relative;
  z-index: 1;
}

/* Scrollbar fina */
.demo-chat__feed::-webkit-scrollbar { width: 3px; }
.demo-chat__feed::-webkit-scrollbar-track { background: transparent; }
.demo-chat__feed::-webkit-scrollbar-thumb { background: rgba(145,70,255,.35); border-radius: 2px; }

.demo-chat__msg {
  display: flex;
  flex-direction: column;
}

.demo-chat__msg--user { align-items: flex-end; }
.demo-chat__msg--ai   { align-items: flex-start; }

.demo-chat__bubble {
  max-width: 84%;
  padding: .5rem .7rem;
  border-radius: 12px;
  font-size: .76rem;
  line-height: 1.5;
  word-break: break-word;
}

.demo-chat__msg--user .demo-chat__bubble {
  background: var(--roxo);
  color: var(--w);
  border-bottom-right-radius: 3px;
}

.demo-chat__msg--ai .demo-chat__bubble {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .85);
  border-bottom-left-radius: 3px;
}

/* Typing indicator */
.demo-chat__typing {
  display: none;
  align-items: center;
  gap: 4px;
  padding: .5rem .7rem;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  border-bottom-left-radius: 3px;
  width: 48px;
  flex-shrink: 0;
}

.demo-chat__typing.is-typing { display: flex; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .35; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, .55);
  border-radius: 50%;
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: .18s; }
.typing-dot:nth-child(3) { animation-delay: .36s; }

/* Composer */
.demo-chat__composer {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .75rem;
  border-top: 1px solid rgba(255, 255, 255, .06);
  background: rgba(255, 255, 255, .02);
  position: relative;
  z-index: 1;
}

.demo-chat__input {
  flex: 1;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  padding: .42rem .65rem;
  font-size: .76rem;
  color: var(--w);
  font-family: var(--font-body);
  outline: none;
  transition: border-color .2s ease;
  min-width: 0;
}

.demo-chat__input::placeholder { color: rgba(255, 255, 255, .22); }
.demo-chat__input:focus { border-color: rgba(145, 70, 255, .65); }

.demo-chat__send {
  width: 32px;
  height: 32px;
  background: var(--roxo);
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .15s ease, transform .15s ease;
}

.demo-chat__send:hover  { opacity: .85; transform: scale(1.06); }
.demo-chat__send:active { transform: scale(.93); }

.demo-chat__hint {
  font-size: .62rem;
  color: rgba(255, 255, 255, .18);
  text-align: center;
  padding: .3rem .75rem .55rem;
  position: relative;
  z-index: 1;
}


/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .kpi__value { font-size: 1rem; }
  .kpi-row    { gap: .35rem; }
}

@media (max-width: 768px) {
  .kpi-row  { grid-template-columns: repeat(2, 1fr); }
  .crm-cols { grid-template-columns: repeat(2, 1fr); }

  .demo-chat__feed { max-height: 240px; min-height: 160px; }

  .week-bars { height: 44px; }
}

@media (max-width: 480px) {
  .crm-cols { grid-template-columns: 1fr 1fr; gap: .35rem; }
  .kpi-row  { grid-template-columns: 1fr 1fr; }
  .kpi__value { font-size: .9rem; }
}
