/* =========================================================
   SY — WIDGET OFICIAL DA SYNETRA TECNOLOGIA
   ========================================================= */

#sy-widget-root,
#sy-widget-root * {
  box-sizing: border-box;
}

#sy-widget-root {
  --sy-noite: #050b18;
  --sy-navy: #081527;
  --sy-painel: #101a33;
  --sy-ciano: #22d3ee;
  --sy-azul: #1da7ff;
  --sy-roxo: #6d4cff;
  --sy-branco: #f8fafc;
  --sy-cinza: #a8b3c7;
  --sy-borda: rgba(216, 226, 240, 0.14);
  --sy-borda-forte: rgba(216, 226, 240, 0.22);
  --sy-gradiente: linear-gradient(
    135deg,
    #22d3ee 0%,
    #1da7ff 48%,
    #6d4cff 100%
  );

  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;

  color: var(--sy-branco);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* =========================================================
   BOTÃO FLUTUANTE
   ========================================================= */

.syw-launcher {
  position: relative;

  display: flex;
  align-items: center;
  gap: 11px;

  min-height: 60px;
  padding: 6px 18px 6px 7px;

  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;

  color: #ffffff;
  background:
    linear-gradient(
      135deg,
      rgba(34, 211, 238, 0.96),
      rgba(29, 167, 255, 0.96),
      rgba(109, 76, 255, 0.96)
    );

  box-shadow:
    0 18px 46px rgba(5, 11, 24, 0.42),
    0 10px 28px rgba(29, 167, 255, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;

  cursor: pointer;
  overflow: hidden;

  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
}

.syw-launcher::before {
  content: "";

  position: absolute;
  inset: 0;

  background: linear-gradient(
    115deg,
    transparent 25%,
    rgba(255, 255, 255, 0.22) 46%,
    transparent 66%
  );

  transform: translateX(-120%);
  transition: transform 600ms ease;
}

.syw-launcher:hover {
  transform: translateY(-3px);
  filter: saturate(1.06);

  box-shadow:
    0 24px 60px rgba(5, 11, 24, 0.48),
    0 14px 34px rgba(29, 167, 255, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.syw-launcher:hover::before {
  transform: translateX(120%);
}

.syw-launcher:focus-visible,
.syw-icon-button:focus-visible,
.syw-send:focus-visible,
.syw-quick-action:focus-visible,
.syw-input:focus-visible {
  outline: 3px solid rgba(34, 211, 238, 0.34);
  outline-offset: 3px;
}

.syw-launcher-avatar-wrap {
  position: relative;
  flex: 0 0 auto;

  width: 48px;
  height: 48px;
}

.syw-launcher-avatar {
  display: block;

  width: 48px;
  height: 48px;

  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;

  object-fit: cover;
  object-position: center;

  box-shadow:
    0 8px 18px rgba(5, 11, 24, 0.32),
    0 0 0 4px rgba(255, 255, 255, 0.1);
}

.syw-online-dot {
  position: absolute;
  right: 0;
  bottom: 1px;

  width: 13px;
  height: 13px;

  border: 3px solid #1da7ff;
  border-radius: 50%;

  background: #45f2b2;
  box-shadow: 0 0 12px rgba(69, 242, 178, 0.72);
}

.syw-launcher-copy {
  position: relative;
  z-index: 1;

  display: flex;
  flex-direction: column;
  align-items: flex-start;

  line-height: 1.1;
}

.syw-launcher-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.syw-launcher-subtitle {
  margin-top: 4px;

  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-weight: 600;
}

/* =========================================================
   PEQUENO CONVITE
   ========================================================= */

.syw-nudge {
  position: absolute;
  right: 0;
  bottom: 76px;

  width: max-content;
  max-width: 270px;
  padding: 12px 14px;

  border: 1px solid var(--sy-borda);
  border-radius: 15px 15px 4px 15px;

  color: var(--sy-branco);
  background:
    linear-gradient(
      145deg,
      rgba(16, 26, 51, 0.98),
      rgba(8, 21, 39, 0.98)
    );

  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);

  font-size: 13px;
  line-height: 1.42;

  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);

  cursor: pointer;

  transition:
    opacity 180ms ease,
    transform 180ms ease,
    visibility 180ms ease;
}

.syw-nudge.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* =========================================================
   JANELA DO CHAT
   ========================================================= */

.syw-panel {
  position: absolute;
  right: 0;
  bottom: 0;

  display: flex;
  flex-direction: column;

  width: min(410px, calc(100vw - 28px));
  height: min(660px, calc(100vh - 38px));
  height: min(660px, calc(100dvh - 38px));

  border: 1px solid var(--sy-borda);
  border-radius: 27px;

  overflow: hidden;

  color: var(--sy-branco);
  background:
    radial-gradient(
      circle at 14% 4%,
      rgba(34, 211, 238, 0.14),
      transparent 31%
    ),
    radial-gradient(
      circle at 88% 0%,
      rgba(109, 76, 255, 0.17),
      transparent 34%
    ),
    linear-gradient(
      180deg,
      rgba(8, 21, 39, 0.99),
      rgba(5, 11, 24, 0.995)
    );

  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.5),
    0 12px 35px rgba(5, 11, 24, 0.42);

  backdrop-filter: blur(22px);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform: translateY(16px) scale(0.97);
  transform-origin: right bottom;

  transition:
    opacity 220ms ease,
    transform 220ms ease,
    visibility 220ms ease;
}

.syw-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;

  transform: translateY(0) scale(1);
}

/* =========================================================
   CABEÇALHO
   ========================================================= */

.syw-header {
  position: relative;

  display: flex;
  align-items: center;
  gap: 12px;

  min-height: 84px;
  padding: 14px 14px 14px 16px;

  border-bottom: 1px solid var(--sy-borda);

  background:
    linear-gradient(
      135deg,
      rgba(5, 11, 24, 0.76),
      rgba(8, 21, 39, 0.64),
      rgba(37, 16, 102, 0.42)
    );
}

.syw-header::after {
  content: "";

  position: absolute;
  right: 20px;
  bottom: -1px;
  left: 20px;

  height: 1px;

  background: linear-gradient(
    90deg,
    transparent,
    rgba(34, 211, 238, 0.6),
    rgba(109, 76, 255, 0.5),
    transparent
  );
}

.syw-header-avatar-wrap {
  position: relative;
  flex: 0 0 auto;

  width: 52px;
  height: 52px;
}

.syw-header-avatar {
  display: block;

  width: 52px;
  height: 52px;

  border: 2px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;

  object-fit: cover;
  object-position: center;

  box-shadow:
    0 8px 20px rgba(5, 11, 24, 0.4),
    0 0 0 4px rgba(34, 211, 238, 0.08);
}

.syw-header-avatar-wrap .syw-online-dot {
  right: 0;
  bottom: 0;

  border-color: var(--sy-navy);
}

.syw-header-copy {
  min-width: 0;
  flex: 1;
}

.syw-header-title {
  margin: 0;

  color: var(--sy-branco);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.syw-header-subtitle {
  display: flex;
  align-items: center;
  gap: 6px;

  margin-top: 5px;

  color: var(--sy-cinza);
  font-size: 11.5px;
  font-weight: 600;
}

.syw-status-mini-dot {
  width: 7px;
  height: 7px;

  border-radius: 50%;

  background: #45f2b2;
  box-shadow: 0 0 9px rgba(69, 242, 178, 0.64);
}

.syw-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.syw-icon-button {
  display: grid;
  place-items: center;

  width: 36px;
  height: 36px;
  padding: 0;

  border: 1px solid var(--sy-borda);
  border-radius: 50%;

  color: var(--sy-cinza);
  background: rgba(255, 255, 255, 0.045);

  cursor: pointer;

  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.syw-icon-button:hover {
  color: var(--sy-branco);
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--sy-borda-forte);
  transform: translateY(-1px);
}

.syw-icon-button svg {
  width: 17px;
  height: 17px;
}

/* =========================================================
   MENSAGENS
   ========================================================= */

.syw-messages {
  flex: 1;

  display: flex;
  flex-direction: column;
  gap: 13px;

  min-height: 0;
  padding: 20px 16px 16px;

  overflow-x: hidden;
  overflow-y: auto;

  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.syw-messages::-webkit-scrollbar {
  width: 7px;
}

.syw-messages::-webkit-scrollbar-track {
  background: transparent;
}

.syw-messages::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;

  background: rgba(168, 179, 199, 0.25);
  background-clip: padding-box;
}

.syw-message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;

  width: 100%;
}

.syw-message-row.is-user {
  justify-content: flex-end;
}

.syw-message-mini-avatar {
  flex: 0 0 auto;

  width: 29px;
  height: 29px;

  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;

  object-fit: cover;
  object-position: center;

  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24);
}

.syw-message {
  width: fit-content;
  max-width: 84%;
  padding: 11px 13px;

  border-radius: 18px;

  font-size: 13.5px;
  line-height: 1.52;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.syw-message.is-assistant {
  border: 1px solid var(--sy-borda);
  border-bottom-left-radius: 5px;

  color: var(--sy-branco);
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.075),
      rgba(255, 255, 255, 0.042)
    );

  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
}

.syw-message.is-user {
  border-bottom-right-radius: 5px;

  color: #ffffff;
  background: var(--sy-gradiente);

  box-shadow: 0 10px 24px rgba(29, 167, 255, 0.17);
}

.syw-message.is-error {
  border: 1px solid rgba(248, 113, 113, 0.25);

  color: #fecaca;
  background: rgba(127, 29, 29, 0.18);
}

.syw-message a {
  color: var(--sy-ciano);
  font-weight: 700;
  text-decoration: none;
}

.syw-message a:hover {
  text-decoration: underline;
}

/* =========================================================
   INDICADOR DE DIGITAÇÃO
   ========================================================= */

.syw-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  min-width: 54px;
  padding: 14px 15px;
}

.syw-typing span {
  width: 6px;
  height: 6px;

  border-radius: 50%;

  background: var(--sy-cinza);

  animation: sywTyping 1.2s infinite ease-in-out;
}

.syw-typing span:nth-child(2) {
  animation-delay: 150ms;
}

.syw-typing span:nth-child(3) {
  animation-delay: 300ms;
}

@keyframes sywTyping {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

/* =========================================================
   ATALHOS
   ========================================================= */

.syw-quick-actions {
  display: flex;
  gap: 8px;

  padding: 0 16px 12px;

  overflow-x: auto;

  scrollbar-width: none;
}

.syw-quick-actions::-webkit-scrollbar {
  display: none;
}

.syw-quick-action {
  flex: 0 0 auto;

  min-height: 34px;
  padding: 8px 11px;

  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: 999px;

  color: #dffaff;
  background: rgba(34, 211, 238, 0.065);

  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;

  cursor: pointer;

  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.syw-quick-action:hover {
  border-color: rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.13);
  transform: translateY(-1px);
}

/* =========================================================
   COMPOSITOR
   ========================================================= */

.syw-composer-area {
  padding: 12px 12px 10px;

  border-top: 1px solid var(--sy-borda);

  background: rgba(5, 11, 24, 0.82);
  backdrop-filter: blur(16px);
}

.syw-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;

  padding: 6px;

  border: 1px solid var(--sy-borda);
  border-radius: 18px;

  background: rgba(255, 255, 255, 0.052);

  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.syw-composer:focus-within {
  border-color: rgba(34, 211, 238, 0.38);
  background: rgba(255, 255, 255, 0.068);

  box-shadow:
    0 0 0 3px rgba(34, 211, 238, 0.07),
    0 10px 24px rgba(0, 0, 0, 0.12);
}

.syw-input {
  flex: 1;

  min-width: 0;
  min-height: 42px;
  max-height: 116px;
  padding: 10px 8px 8px;

  border: 0;
  outline: 0;

  resize: none;
  overflow-y: auto;

  color: var(--sy-branco);
  background: transparent;

  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.42;
}

.syw-input::placeholder {
  color: rgba(168, 179, 199, 0.72);
}

.syw-input:disabled {
  cursor: wait;
  opacity: 0.68;
}

.syw-send {
  flex: 0 0 auto;

  display: grid;
  place-items: center;

  width: 42px;
  height: 42px;
  padding: 0;

  border: 0;
  border-radius: 14px;

  color: #ffffff;
  background: var(--sy-gradiente);

  box-shadow: 0 9px 22px rgba(29, 167, 255, 0.2);

  cursor: pointer;

  transition:
    transform 160ms ease,
    filter 160ms ease,
    opacity 160ms ease;
}

.syw-send:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.07);
}

.syw-send:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.syw-send svg {
  width: 18px;
  height: 18px;
}

.syw-privacy-note {
  margin: 8px 5px 0;

  color: rgba(168, 179, 199, 0.64);
  font-size: 10px;
  line-height: 1.35;
  text-align: center;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 560px) {
  #sy-widget-root {
    right: 12px;
    bottom: 12px;
  }

  .syw-launcher {
    min-width: 58px;
    min-height: 58px;
    padding: 5px;
  }

  .syw-launcher-copy {
    display: none;
  }

  .syw-launcher-avatar,
  .syw-launcher-avatar-wrap {
    width: 48px;
    height: 48px;
  }

  .syw-nudge {
    right: 0;
    bottom: 70px;

    max-width: min(260px, calc(100vw - 40px));
  }

  .syw-panel {
    position: fixed;
    inset: 10px;

    width: auto;
    height: auto;

    border-radius: 23px;

    transform-origin: center bottom;
  }

  .syw-header {
    min-height: 78px;
  }

  .syw-messages {
    padding-top: 17px;
  }

  .syw-message {
    max-width: 88%;
  }
}

/* =========================================================
   MOVIMENTO REDUZIDO
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  #sy-widget-root *,
  #sy-widget-root *::before,
  #sy-widget-root *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   SOLICITAÇÃO COMERCIAL — FASE 2
   ========================================================= */

.syw-lead-row {
  align-items: flex-start;
}

.syw-lead-card {
  width: min(100%, 338px);
  padding: 15px;

  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 20px 20px 20px 6px;

  color: var(--sy-branco);
  background:
    radial-gradient(
      circle at 100% 0%,
      rgba(109, 76, 255, 0.16),
      transparent 34%
    ),
    linear-gradient(
      145deg,
      rgba(16, 26, 51, 0.98),
      rgba(8, 21, 39, 0.98)
    );

  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.025) inset;
}

.syw-lead-card h3 {
  margin: 0;

  color: var(--sy-branco);
  font-size: 15px;
  line-height: 1.3;
}

.syw-lead-helper {
  margin: 7px 0 13px;

  color: var(--sy-cinza);
  font-size: 11.5px;
  line-height: 1.45;
}

.syw-lead-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.syw-lead-field {
  display: grid;
  gap: 6px;

  min-width: 0;

  color: var(--sy-cinza);
  font-size: 10.5px;
  font-weight: 700;
}

.syw-lead-field.is-full {
  grid-column: 1 / -1;
}

.syw-lead-input,
.syw-lead-textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 11px;

  border: 1px solid var(--sy-borda);
  border-radius: 12px;
  outline: 0;

  color: var(--sy-branco);
  background: rgba(255, 255, 255, 0.055);

  font-family: inherit;
  font-size: 12px;
  line-height: 1.4;

  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.syw-lead-input:focus,
.syw-lead-textarea:focus {
  border-color: rgba(34, 211, 238, 0.42);
  background: rgba(255, 255, 255, 0.075);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.075);
}

.syw-lead-input::placeholder,
.syw-lead-textarea::placeholder {
  color: rgba(168, 179, 199, 0.58);
}

.syw-lead-input option {
  color: #0f172a;
  background: #f8fafc;
}

.syw-lead-textarea {
  min-height: 92px;

  resize: vertical;
}

.syw-lead-consent {
  grid-column: 1 / -1;

  display: flex;
  align-items: flex-start;
  gap: 8px;

  padding: 10px;

  border: 1px solid var(--sy-borda);
  border-radius: 13px;

  color: var(--sy-cinza);
  background: rgba(255, 255, 255, 0.035);

  font-size: 10.5px;
  line-height: 1.42;
}

.syw-lead-consent input {
  flex: 0 0 auto;

  margin: 2px 0 0;

  accent-color: var(--sy-ciano);
}

.syw-lead-actions {
  grid-column: 1 / -1;

  display: flex;
  justify-content: flex-end;
  gap: 8px;

  margin-top: 2px;
}

.syw-lead-button {
  min-height: 36px;
  padding: 8px 12px;

  border-radius: 12px;

  font-family: inherit;
  font-size: 11.5px;
  font-weight: 800;

  cursor: pointer;

  transition:
    transform 160ms ease,
    filter 160ms ease,
    opacity 160ms ease,
    background 160ms ease;
}

.syw-lead-button.is-primary {
  border: 0;

  color: #ffffff;
  background: var(--sy-gradiente);

  box-shadow: 0 9px 22px rgba(29, 167, 255, 0.17);
}

.syw-lead-button.is-secondary {
  border: 1px solid var(--sy-borda-forte);

  color: var(--sy-branco);
  background: rgba(255, 255, 255, 0.05);
}

.syw-lead-button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.syw-lead-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.syw-lead-summary {
  display: grid;
  gap: 8px;
}

.syw-lead-summary-item {
  display: grid;
  gap: 3px;

  padding: 9px 10px;

  border: 1px solid var(--sy-borda);
  border-radius: 12px;

  background: rgba(255, 255, 255, 0.035);
}

.syw-lead-summary-item span {
  color: rgba(168, 179, 199, 0.72);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.syw-lead-summary-item strong {
  color: var(--sy-branco);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.42;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.syw-lead-error {
  margin: 10px 0 0;
  padding: 10px;

  border: 1px solid rgba(248, 113, 113, 0.24);
  border-radius: 12px;

  color: #fecaca;
  background: rgba(127, 29, 29, 0.18);

  font-size: 11px;
  line-height: 1.45;
}

@media (max-width: 560px) {
  .syw-lead-card {
    width: calc(100vw - 74px);
    max-width: 100%;
  }

  .syw-lead-form {
    grid-template-columns: 1fr;
  }

  .syw-lead-field.is-full,
  .syw-lead-consent,
  .syw-lead-actions {
    grid-column: auto;
  }

  .syw-lead-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .syw-lead-button {
    width: 100%;
  }
}
