/* ==========================================================================
   CORUJA ACADEMY VIRTUAL ASSISTANT CHATBOT STYLES
   ========================================================================== */

:root {
  --chat-primary: #00897B;
  --chat-primary-dark: #00695C;
  --chat-bg-area: #F0FAF9;
  --chat-text-dark: #1A2E2C;
  --chat-text-light: #ffffff;
  --chat-status-green: #80CBC4;
  --chat-border-color: #00897B;
  --chat-footer-text: #4A6360;
  --chat-shadow-window: 0 8px 40px rgba(0,0,0,0.18);
  --chat-shadow-btn: 0 4px 20px rgba(0,0,0,0.25);
}

/* --- Floating Launcher --- */
#chat-toggle, .chat-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #00897B;
  border: none;
  cursor: pointer;
  z-index: 9999;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  overflow: hidden;

  /* Animação pulse para chamar atenção */
  animation: chatPulse 3s ease-in-out infinite;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

#chat-toggle:hover, .chat-toggle-btn:hover {
  transform: scale(1.05);
  background-color: var(--chat-primary-dark);
}

/* A imagem da coruja ocupa o botão inteiro */
.chat-toggle-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  /* Garante que não há outro elemento sobreposto */
  position: relative;
  z-index: 1;
}

/* Badge de notificação */
.chat-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: #E53935;
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  border: 2px solid white;
}

@keyframes chatPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(0,0,0,0.25); }
  50%       { box-shadow: 0 4px 28px rgba(0,137,123,0.55), 0 0 0 8px rgba(0,137,123,0.12); }
}

/* Launcher Tooltip */
.coruja-chat-tooltip {
  position: fixed;
  right: 100px;
  bottom: 35px;
  background-color: #ffffff;
  color: var(--chat-text-dark);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 9998;
  border: 1px solid rgba(0, 137, 123, 0.1);
  transform: scale(0.9);
}

.coruja-chat-tooltip::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -6px;
  transform: translateY(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background-color: #ffffff;
  border-right: 1px solid rgba(0, 137, 123, 0.1);
  border-top: 1px solid rgba(0, 137, 123, 0.1);
}

.coruja-chat-tooltip.visible {
  opacity: 1;
  transform: scale(1);
}


/* --- Chat Window --- */
.coruja-chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 340px;
  height: 480px;
  background-color: #ffffff;
  border-radius: 20px;
  box-shadow: var(--chat-shadow-window);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0);
  transform-origin: bottom right;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: inherit;
}

.coruja-chat-window.open {
  transform: scale(1);
}


/* --- Header --- */
.coruja-chat-header {
  background: linear-gradient(135deg, var(--chat-primary-dark) 0%, var(--chat-primary) 100%);
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: var(--chat-text-light);
  flex-shrink: 0;
}

.coruja-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coruja-chat-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: #ffffff;
  padding: 2px;
  object-fit: contain;
}

.coruja-chat-header-info {
  display: flex;
  flex-direction: column;
}

.coruja-chat-header-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}

.coruja-chat-header-status {
  font-size: 11px;
  color: var(--chat-status-green);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.coruja-chat-header-close {
  background: none;
  border: none;
  color: var(--chat-text-light);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  transition: opacity 0.2s ease;
  line-height: 1;
}

.coruja-chat-header-close:hover {
  opacity: 0.8;
}


/* --- Messages Area --- */
.coruja-chat-messages {
  flex: 1;
  background-color: var(--chat-bg-area);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

/* Hide scrollbars but keep scrolling */
.coruja-chat-messages::-webkit-scrollbar {
  width: 6px;
}
.coruja-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.coruja-chat-messages::-webkit-scrollbar-thumb {
  background-color: rgba(0, 137, 123, 0.2);
  border-radius: 10px;
}


/* --- Message Bubbles --- */
.coruja-chat-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 85%;
  animation: coruja-fade-in-up 0.3s ease forwards;
}

.coruja-chat-msg-row.coruja-owl {
  align-self: flex-start;
}

.coruja-chat-msg-row.coruja-user {
  align-self: flex-end;
  flex-direction: row-reverse;
  max-width: 80%;
}

.coruja-chat-msg-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #ffffff;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 1px;
}

.coruja-chat-msg-bubble {
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.coruja-chat-msg-row.coruja-owl .coruja-chat-msg-bubble {
  background-color: #ffffff;
  color: var(--chat-text-dark);
  border-radius: 18px 18px 18px 4px;
  white-space: pre-line;
}

.coruja-chat-msg-row.coruja-user .coruja-chat-msg-bubble {
  background-color: var(--chat-primary);
  color: var(--chat-text-light);
  border-radius: 18px 18px 4px 18px;
}

@keyframes coruja-fade-in-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* --- Typing Indicator --- */
.coruja-chat-typing-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  height: 16px;
}

.coruja-chat-typing-dots span {
  width: 6px;
  height: 6px;
  background-color: var(--chat-primary);
  border-radius: 50%;
  display: inline-block;
  opacity: 0.3;
  animation: coruja-typing 1.4s infinite ease-in-out both;
}

.coruja-chat-typing-dots span:nth-child(1) {
  animation-delay: 0s;
}
.coruja-chat-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.coruja-chat-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes coruja-typing {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}


/* --- Options Buttons --- */
.coruja-chat-options-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 32px; /* aligns under the bubble, leaving avatar space */
  margin-top: 4px;
  animation: coruja-fade-in-up 0.3s ease forwards;
}

.coruja-chat-option-btn {
  background-color: #ffffff;
  border: 1.5px solid var(--chat-border-color);
  color: var(--chat-primary);
  border-radius: 50px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  width: fit-content;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.coruja-chat-option-btn:hover {
  background-color: var(--chat-primary);
  color: var(--chat-text-light);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 137, 123, 0.2);
}

.coruja-chat-option-btn:active {
  transform: translateY(0);
}


/* --- Footer --- */
.coruja-chat-footer {
  background-color: #ffffff;
  padding: 8px;
  text-align: center;
  font-size: 11px;
  color: var(--chat-footer-text);
  border-top: 1px solid rgba(0, 137, 123, 0.08);
  flex-shrink: 0;
  font-weight: 500;
}


/* --- Responsive Mobile Layout --- */
@media (max-width: 768px) {
  .chat-toggle-btn {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
  
  .coruja-chat-tooltip {
    display: none !important; /* Hide tooltip on mobile to avoid layout crowding */
  }

  .coruja-chat-window {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 60vh;
    border-radius: 20px 20px 0 0;
    transform-origin: bottom center;
  }
}
