/* chatbot/styles.css - Estilos do módulo Keeper */

:root {
  --bg-start: #071028;
  --bg-mid: #041425;
  --bg-end: #001217;
  --surface: rgba(10,16,32,.95);
  --surface-soft: rgba(30,48,86,.28);
  --border: rgba(95,166,37,.35);
  --border-strong: rgba(95,166,37,.55);
  --text: #f2f4fa;
  --text-muted: #9aa2ba;
  --text-soft: #c4cae0;
  --green: #5FA625;
  --green-soft: #9fdc6e;
  --green-glow: rgba(95,166,37,.35);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 0 22px -6px rgba(95,166,37,.55);
}

/* Página do Keeper (modal/standalone) */
.keeper-page { position: relative; min-height: 100vh; min-height: 100dvh; color: #f2f4fa; display: flex; flex-direction: column; background: radial-gradient(circle at 100% 100%, rgba(95,166,37,.30), transparent 55%), linear-gradient(135deg, #050b16 0%, #0a1420 45%, #0d2818 75%, #123a1f 100%); }
.keeper-bg-spot { pointer-events: none; position: absolute; left: 50%; top: -10%; width: 700px; height: 700px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle, rgba(95,166,37,.20), transparent 70%); filter: blur(40px); }
.keeper-main { position: relative; z-index: 2; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 24px 24px; max-width: 720px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.keeper-orb-wrapper { --keeper-size: 130px; flex-shrink: 0; margin-bottom: 16px; }
.keeper-messages { width: 100%; max-width: 640px; margin: 20px auto 0; max-height: 220px; min-height: 60px; overflow-y: auto; overflow-x: hidden; padding: 0 20px; display: flex; flex-direction: column; gap: 10px; box-sizing: border-box; }
.keeper-panel { width: 100%; max-width: 640px; margin: 10px auto 0; border-radius: 16px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04); display: flex; gap: 10px; align-items: center; padding: 10px 10px 10px 18px; box-sizing: border-box; flex-shrink: 0; }
.keeper-chat-input { position: relative; width: 100%; box-sizing: border-box; background: none; border: none; outline: none; color: #f2f4fa; font-size: 14.5px; font-family: inherit; }
.keeper-chip-row { width: 100%; max-width: 640px; margin: 14px auto 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0 18px; box-sizing: border-box; }
.keeper-chip { flex-shrink: 0; white-space: nowrap; padding: 6px 11px; min-height: 28px; border-radius: 999px; border: 1px solid rgba(95,166,37,.4); background: rgba(95,166,37,.1); color: #dfe3f0; font-size: 10px; cursor: pointer; font-family: inherit; }
.keeper-chip:hover, .keeper-chip:focus-visible { border-color: var(--green); background: rgba(95,166,37,.2); }

/* Chat messages and buttons
   !important nas propriedades-chave torna estes botões resistentes a CSS
   genérico de "button" que o site hospedeiro possa ter (ex.: um framework
   que estiliza todo <button> como pill verde) — mantém o módulo portátil
   sem depender de ajustes no CSS externo do projeto host. */
.kp-msg { animation: kp-in .35s ease both; }
.kp-send-btn { display: flex; align-items: center; justify-content: center; width: 38px !important; height: 38px !important; padding: 0 !important; border-radius: 10px !important; border: none !important; cursor: pointer; background: linear-gradient(135deg,#3f7a17,#5FA625) !important; color: #fff; flex-shrink: 0; }
.kp-icon-btn { display: flex; align-items: center; justify-content: center; width: 44px !important; height: 44px !important; padding: 0 !important; border: none !important; background: none !important; cursor: pointer; }
.keeper-close-btn { display: flex; align-items: center; justify-content: center; width: 26px !important; height: 26px !important; padding: 0 !important; border: 1px solid transparent !important; border-radius: 50% !important; background: none !important; cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease, color .18s ease; }
.keeper-close-btn:hover, .keeper-close-btn:focus-visible { border-color: rgba(95,166,37,.55) !important; box-shadow: 0 0 10px 1px rgba(95,166,37,.55); color: #f2f4fa; }

/* Keeper Orb — componente visual compartilhado (esfera animada com "olhos") */
.keeper-stage { width: 100%; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.keeper-orb { position: relative; width: var(--keeper-size, 440px); max-width: 90vw; aspect-ratio: 1 / 1; animation: keeper-float 6s ease-in-out infinite; }
.keeper-halo { position: absolute; width: calc(var(--keeper-size) * 1.090909); height: calc(var(--keeper-size) * 0.818182); left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 24px; background: radial-gradient(ellipse at center, rgba(95,166,37,.30), transparent 68%); filter: blur(calc(var(--keeper-size) * 0.036364)); z-index: 0; }
.keeper-halo-warm { position: absolute; right: -4%; top: 10%; width: 38%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(159,220,110,.22), transparent 70%); filter: blur(calc(var(--keeper-size) * 0.022727)); z-index: 0; }
.keeper-bloom { position: absolute; left: 50%; top: 50%; width: 96%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(95,166,37,.35), rgba(15,35,15,.12) 55%, transparent 72%); filter: blur(calc(var(--keeper-size) * 0.063636)); z-index: 1; opacity: .55; }
.keeper-orb.is-speaking .keeper-bloom { animation: keeper-fog-speaker .5s ease-in-out infinite, keeper-fog-drift 1.8s ease-in-out infinite; }
.keeper-ring-wrap { position: absolute; left: 50%; top: 50%; width: 104%; aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; z-index: 5; }
.keeper-ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0deg, rgba(95,166,37,.9) 55deg, transparent 130deg, rgba(159,220,110,.75) 190deg, transparent 250deg, rgba(63,122,23,.7) 310deg, transparent 360deg); -webkit-mask: radial-gradient(circle, transparent 56%, #000 59%, #000 67%, transparent 70%); mask: radial-gradient(circle, transparent 56%, #000 59%, #000 67%, transparent 70%); filter: blur(calc(var(--keeper-size) * 0.004545)); mix-blend-mode: screen; opacity: .9; animation: keeper-ring-spin 7s linear infinite; }
.keeper-sphere { position: absolute; left: 50%; top: 50%; width: 60%; aspect-ratio: 1; transform: translate(-50%, -50%); z-index: 3; border-radius: 50%; background: radial-gradient(circle at 38% 32%, rgba(70,120,60,.55), rgba(10,16,30,.9) 60%, #05070d 100%); box-shadow: inset 0 0 calc(var(--keeper-size) * 0.090909) rgba(159,220,110,.35), inset calc(var(--keeper-size) * 0.013636) calc(var(--keeper-size) * 0.018182) calc(var(--keeper-size) * 0.068182) rgba(0,0,0,.6), 0 0 calc(var(--keeper-size) * 0.136364) rgba(95,166,37,.25); animation: keeper-core-breathe 5s ease-in-out infinite; }
.keeper-orb.is-speaking .keeper-sphere { animation: keeper-core-speak 1.1s ease-in-out infinite; }
.keeper-orb.is-thinking .keeper-sphere { animation: keeper-core-breathe 2.2s ease-in-out infinite; }
.keeper-orb.is-surprised .keeper-sphere { animation: keeper-core-surprise .5s ease-out both; }
.keeper-highlight { position: absolute; left: 50%; top: 38%; width: 26%; height: 14%; transform: translate(-50%, -50%); z-index: 4; border-radius: 50%; background: radial-gradient(ellipse, rgba(255,255,255,.5), transparent 70%); filter: blur(calc(var(--keeper-size) * 0.006818)); }
.keeper-eyes { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); z-index: 6; display: flex; gap: 18%; width: 30%; justify-content: center; align-items: center; transition: transform .05s ease-out; }
.keeper-eye { display: block; width: 22%; padding-bottom: 30%; background: radial-gradient(circle at 40% 35%, #ffffff, #dcecff 70%); border-radius: 50% / 45%; animation: keeper-blink 5.5s ease-in-out infinite, keeper-eye-glow 3.2s ease-in-out infinite; }
.keeper-eye + .keeper-eye { animation-delay: .1s; }
.keeper-orb.is-speaking .keeper-eye { animation: keeper-blink 2.4s ease-in-out infinite, keeper-eye-glow 1s ease-in-out infinite; }
.keeper-orb.is-speaking .keeper-eye + .keeper-eye { animation: keeper-blink 2.4s ease-in-out infinite, keeper-eye-glow 1s ease-in-out infinite .1s; }
.keeper-orb.is-thinking .keeper-eye { animation: keeper-think-eye 1.5s ease-in-out infinite; }
.keeper-orb.is-thinking .keeper-eye + .keeper-eye { animation-delay: .12s; }
.keeper-orb.is-surprised .keeper-eye { animation: keeper-surprise-eye .5s ease-out both; }
.keeper-orb.is-surprised .keeper-eye + .keeper-eye { animation-delay: .05s; }

/* Keyframes */
@keyframes kp-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes kp-cursor { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
@keyframes keeper-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(calc(var(--keeper-size) * -0.027273)); } }
@keyframes keeper-ring-spin { to { transform: rotate(360deg); } }
@keyframes keeper-core-breathe { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.06); } }
@keyframes keeper-core-speak { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 25% { transform: translate(-50%, -50%) scale(1.07); } 50% { transform: translate(-50%, -50%) scale(.97); } 75% { transform: translate(-50%, -50%) scale(1.09); } }
@keyframes keeper-core-surprise { 0% { transform: translate(-50%, -50%) scale(1); } 40% { transform: translate(-50%, -50%) scale(1.1); } 100% { transform: translate(-50%, -50%) scale(1.03); } }
@keyframes keeper-blink { 0%, 10%, 90%, 100% { transform: scaleY(1); } 5%, 95% { transform: scaleY(.14); } }
@keyframes keeper-eye-glow { 0%, 100% { opacity: .9; box-shadow: 0 0 calc(var(--keeper-size) * 0.027273) calc(var(--keeper-size) * 0.006818) rgba(190,230,170,.8); } 50% { opacity: 1; box-shadow: 0 0 calc(var(--keeper-size) * 0.045455) calc(var(--keeper-size) * 0.013636) rgba(210,240,190,.95); } }
@keyframes keeper-think-eye { 0%, 100% { transform: scaleY(.55) translateX(0); } 50% { transform: scaleY(.55) translateX(calc(var(--keeper-size) * 0.006818)); } }
@keyframes keeper-surprise-eye { 0% { transform: scale(.7); } 55% { transform: scale(1.4); } 100% { transform: scale(1.15); } }
@keyframes keeper-fog-speaker { 0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: .55; } 50% { transform: translate(-50%, -50%) scale(1.22); opacity: 1; } }
@keyframes keeper-fog-drift { 0%, 100% { rotate: 0deg; } 30% { rotate: 4deg; } 60% { rotate: -3deg; } }

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  .keeper-orb { animation: none !important; }
  .keeper-ring { animation: none !important; }
  .keeper-sphere, .keeper-orb.is-speaking .keeper-sphere, .keeper-orb.is-thinking .keeper-sphere { animation: none !important; }
  .keeper-orb.is-speaking .keeper-bloom { animation: none !important; }
}

/* Responsivo */
@media (max-width: 900px) {
  .keeper-orb-wrapper { --keeper-size: 104px; }
  .keeper-main { padding: 6px 22px 22px; }
  .keeper-messages { max-height: 180px; }
}

@media (max-width: 600px) {
  .keeper-orb-wrapper { --keeper-size: 92px; }
  .keeper-main { padding: 4px 16px 18px; overflow-y: auto; }
  .keeper-messages { max-height: 150px; }
}

/* Keeper Widget — ícone flutuante + modal */
.keeper-floating-btn {
  position: fixed;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3f7a17, #5FA625);
  box-shadow: 0 4px 16px rgba(95,166,37,.4);
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .3s ease;
}

.keeper-floating-btn[data-position="bottom-right"] { bottom: 24px; right: 24px; }
.keeper-floating-btn[data-position="bottom-left"] { bottom: 24px; left: 24px; }
.keeper-floating-btn:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(95,166,37,.5); }
.keeper-floating-btn.is-hidden { opacity: 0; pointer-events: none; }

.keeper-orb-mini {
  position: relative;
  width: 36px;
  height: 36px;
  animation: keeper-float 3s ease-in-out infinite;
}

.keeper-sphere-mini {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, rgba(70,120,60,.7), rgba(10,16,30,.95) 60%, #05070d 100%);
  box-shadow: inset 0 0 8px rgba(159,220,110,.5), 0 0 10px rgba(95,166,37,.3);
}

.keeper-eyes-mini {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 12%;
  align-items: center;
  justify-content: center;
}

.keeper-eye-mini {
  width: 6px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  animation: keeper-blink 3s ease-in-out infinite;
}

.keeper-modal {
  position: fixed;
  width: 360px;
  height: 520px;
  border-radius: 20px;
  background: linear-gradient(135deg, #050b16 0%, #0a1420 45%, #0d2818 75%);
  border: 1px solid rgba(95,166,37,.3);
  box-shadow: 0 20px 60px rgba(0,0,0,.8);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px) scale(.95);
  pointer-events: none;
  transition: all .3s ease;
}

.keeper-modal[data-position="bottom-right"] { bottom: 100px; right: 24px; }
.keeper-modal[data-position="bottom-left"] { bottom: 100px; left: 24px; }
.keeper-modal.is-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }

.keeper-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(95,166,37,.2);
}

.keeper-modal-title {
  display: flex;
  gap: 12px;
  align-items: center;
  color: #f2f4fa;
  font-weight: 600;
  font-size: 14px;
}

.keeper-orb-small {
  position: relative;
  width: 28px;
  height: 28px;
}

.keeper-sphere-small {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, rgba(70,120,60,.7), rgba(10,16,30,.95) 60%, #05070d 100%);
  box-shadow: inset 0 0 6px rgba(159,220,110,.4), 0 0 8px rgba(95,166,37,.25);
}

.keeper-eyes-small {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 10%;
  align-items: center;
  justify-content: center;
}

.keeper-eye-small {
  width: 4px;
  height: 5px;
  background: #fff;
  border-radius: 50%;
  animation: keeper-blink 3s ease-in-out infinite;
}

.keeper-modal-close {
  background: none;
  border: none;
  color: #9aa2ba;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .2s;
}

.keeper-modal-close:hover { color: #f2f4fa; }

.keeper-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.keeper-modal-body .kp-msg {
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.35;
  word-wrap: break-word;
}

.keeper-modal-footer {
  border-top: 1px solid rgba(95,166,37,.2);
  padding: 12px 12px 8px;
}

.keeper-modal .keeper-panel {
  margin: 0;
  border-radius: 10px;
}

.keeper-modal .keeper-chip {
  font-size: 11px;
  padding: 5px 9px;
  min-height: 26px;
}

@media (max-width: 480px) {
  .keeper-floating-btn { width: 48px; height: 48px; bottom: 16px; right: 16px; }
  .keeper-modal { width: calc(100vw - 32px); height: calc(100vh - 140px); bottom: 80px; right: 16px; left: 16px; }
  .keeper-modal[data-position="bottom-left"] { left: 16px; right: 16px; }
}
