/* Chat Button (Launcher) */
#ai-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #007bff;
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  cursor: pointer;
  z-index: 9999;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s;
}
#ai-launcher:hover { transform: scale(1.1); }

/* Chat Window - Desktop */
#ai-window {
  display: none;
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px; /* Slightly wider */
  height: 600px; /* Taller */
  background: white;
  border-radius: 15px;
  box-shadow: 0 5px 25px rgba(0,0,0,0.2);
  z-index: 99999; /* Very high to sit on top of everything */
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --- MOBILE FULL SCREEN MODE --- */
@media (max-width: 480px) {
  #ai-window {
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0;
  }
}

/* Header */
.ai-header {
  background: #007bff;
  color: white;
  padding: 15px;
  font-size: 18px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ai-close { cursor: pointer; font-size: 24px; padding: 5px; }

/* Messages Area */
#ai-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Bubbles */
.msg { padding: 12px 16px; border-radius: 12px; max-width: 85%; font-size: 15px; line-height: 1.5; word-wrap: break-word; }
.user-msg { background: #007bff; color: white; align-self: flex-end; border-bottom-right-radius: 2px; }
.bot-msg { background: #e9ecef; color: #333; align-self: flex-start; border-bottom-left-radius: 2px; }
.bot-msg a { color: #007bff; font-weight: bold; text-decoration: none; }

/* Input Area */
.ai-input-area {
  padding: 10px;
  border-top: 1px solid #ddd;
  display: flex;
  gap: 10px;
  background: white;
  align-items: flex-end; /* Align button to bottom */
}

/* TEXTAREA STYLE (Multi-line) */
#ai-input {
  flex: 1;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  outline: none;
  font-family: inherit;
  font-size: 16px; /* Prevents zoom on iPhone */
  resize: none; /* User cannot resize manually */
  height: 50px; /* Start height */
  max-height: 120px; /* Max height before scroll */
  overflow-y: auto;
}

#ai-send {
  background: #007bff;
  color: white;
  border: none;
  padding: 0 20px;
  height: 50px; /* Match input height */
  border-radius: 25px;
  cursor: pointer;
  font-weight: bold;
}