/* Hausler Chatbot Stylesheet - Glassmorphism & Tijolinho */

/* Botão Flutuante Redondo */
.hausler-btn-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hausler-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(18, 18, 20, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 15px rgba(232, 114, 71, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  outline: none;
  padding: 0;
}

.hausler-btn:hover {
  transform: scale(1.1) translateY(-4px) rotate(3deg);
  background: rgba(28, 28, 30, 0.95);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 25px rgba(232, 114, 71, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: rgba(232, 114, 71, 0.3);
}

.hausler-btn:active {
  transform: scale(0.95) translateY(0) rotate(0deg);
}

/* SVG Mascote Tijolinho */
.hausler-svg {
  width: 44px;
  height: 44px;
  display: block;
}

/* Olhos piscando animadamente */
@keyframes hausler-blink {
  0%, 90%, 100% {
    transform: scaleY(1);
  }
  93%, 97% {
    transform: scaleY(0.1);
  }
}

.hausler-eye {
  animation: hausler-blink 4s infinite;
  transform-origin: 27px 22px; /* Centro do olho esquerdo */
}
.hausler-eye-right {
  animation: hausler-blink 4s infinite;
  transform-origin: 37px 22px; /* Centro do olho direito */
}

/* Caixa de Chat Retrátil (Glassmorphism) */
.hausler-chat {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  height: 540px;
  max-height: calc(100vh - 140px);
  z-index: 9998;
  background: rgba(18, 18, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.85) translateY(30px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.hausler-chat.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

/* Cabeçalho do Chat */
.hausler-header {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hausler-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hausler-avatar-mini {
  width: 32px;
  height: 32px;
  background: rgba(18, 18, 20, 0.8);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hausler-avatar-mini svg {
  width: 24px;
  height: 24px;
}

.hausler-info {
  display: flex;
  flex-direction: column;
}

.hausler-name {
  font-family: var(--font-h);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--white);
  line-height: 1.2;
}

.hausler-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
}

@keyframes pulse-green {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.hausler-status-dot {
  width: 6px;
  height: 6px;
  background-color: var(--green);
  border-radius: 50%;
  animation: pulse-green 1.5s infinite;
  box-shadow: 0 0 6px var(--green);
}

.hausler-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  box-shadow: none;
  width: auto;
  height: auto;
}

.hausler-close-btn:hover {
  color: var(--white);
}

/* Área de Mensagens */
.hausler-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
}

/* Balões de Mensagem */
.hausler-msg {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hausler-msg.bot {
  align-self: flex-start;
}

.hausler-msg.user {
  align-self: flex-end;
}

.hausler-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.45;
  font-family: var(--font-b);
}

.hausler-msg.bot .hausler-bubble {
  background: var(--black2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--white);
  border-top-left-radius: 4px;
}

.hausler-msg.user .hausler-bubble {
  background: linear-gradient(135deg, rgba(232, 114, 71, 0.15), rgba(178, 58, 25, 0.15));
  border: 1px solid rgba(232, 114, 71, 0.25);
  color: var(--white);
  border-top-right-radius: 4px;
}

.hausler-time {
  font-size: 10px;
  color: var(--muted);
  align-self: flex-end;
  padding: 0 4px;
}

.hausler-msg.bot .hausler-time {
  align-self: flex-start;
}

/* Configurações de API Key (Aparece no corpo do chat se necessário) */
.hausler-setup-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.hausler-setup-title {
  font-family: var(--font-h);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--white);
}

.hausler-setup-text {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.hausler-setup-input {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  outline: none;
  font-family: monospace;
  width: 100%;
}

.hausler-setup-input:focus {
  border-color: rgba(232, 114, 71, 0.5);
}

.hausler-setup-btn {
  background: linear-gradient(135deg, #e87247, #b23a19);
  color: var(--white);
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  transition: opacity 0.2s;
  box-shadow: none;
}

.hausler-setup-btn:hover {
  opacity: 0.9;
}

/* Indicador de Digitação (Typing Loader) */
.hausler-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--black2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  border-top-left-radius: 4px;
  align-self: flex-start;
}

.hausler-dot {
  width: 6px;
  height: 6px;
  background-color: var(--muted);
  border-radius: 50%;
  animation: hausler-wave 1.3s linear infinite;
}

.hausler-dot:nth-child(2) { animation-delay: -1.1s; }
.hausler-dot:nth-child(3) { animation-delay: -0.9s; }

@keyframes hausler-wave {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Rodapé do Chat (Input) */
.hausler-footer {
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
}

.hausler-input-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.hausler-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--white);
  padding: 12px 16px;
  border-radius: 12px;
  font-family: var(--font-b);
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
}

.hausler-input:focus {
  border-color: rgba(232, 114, 71, 0.4);
  background: rgba(255, 255, 255, 0.05);
}

.hausler-send-btn {
  background: linear-gradient(135deg, #e87247, #b23a19);
  color: var(--white);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: none;
}

.hausler-send-btn:hover {
  transform: scale(1.05);
  opacity: 0.95;
}

.hausler-send-btn:active {
  transform: scale(0.95);
}

.hausler-send-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Sugestões Rápidas de Perguntas */
.hausler-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.hausler-suggest-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 11.5px;
  color: var(--muted2);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-b);
  box-shadow: none;
  width: auto;
  height: auto;
}

.hausler-suggest-chip:hover {
  background: rgba(232, 114, 71, 0.1);
  border-color: rgba(232, 114, 71, 0.3);
  color: var(--white);
}

/* Markdown Básico Renderizado */
.hausler-bubble p {
  margin-bottom: 8px;
}
.hausler-bubble p:last-child {
  margin-bottom: 0;
}
.hausler-bubble ul, .hausler-bubble ol {
  margin-left: 18px;
  margin-bottom: 8px;
}
.hausler-bubble li {
  margin-bottom: 4px;
}
.hausler-bubble strong {
  color: #fff;
  font-weight: 600;
}
.hausler-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
}
.hausler-bubble th, .hausler-bubble td {
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 8px;
  text-align: left;
}
.hausler-bubble th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
}

/* Responsividade */
@media (max-width: 450px) {
  .hausler-chat {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }
  .hausler-chat.open {
    transform: scale(1) translateY(0);
  }
}

/* Oculta botão e chat do Hausler quando o login-screen estiver ativo/visível */
#login-screen:not([style*="display: none"]) ~ .hausler-btn-container,
#login-screen:not([style*="display: none"]) ~ .hausler-chat {
  display: none !important;
}

