/* GraceBot Floating Widget CSS */

#gracebot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: 'Inter', system-ui, sans-serif;
}

#gracebot-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--primary-color, #702f8a); /* doulalogic purple */
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  border: 2px solid white;
}

#gracebot-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

#gracebot-toggle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#gracebot-window {
  display: none; /* hidden by default */
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 360px;
  height: 500px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.05);
}

#gracebot-window.open {
  display: flex;
}

.gracebot-header {
  background: var(--primary-color, #702f8a);
  color: white;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.gracebot-header .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  overflow: hidden;
  flex-shrink: 0;
}

.gracebot-header .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gracebot-header .title {
  flex-grow: 1;
}

.gracebot-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.gracebot-header p {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.8;
}

.gracebot-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 5px;
  opacity: 0.8;
}

.gracebot-close:hover {
  opacity: 1;
}

.gracebot-messages {
  flex-grow: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fcfcfc;
}

.gracebot-msg {
  display: flex;
  gap: 8px;
  max-width: 90%;
}

.gracebot-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

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

.gracebot-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.gracebot-msg.bot .gracebot-bubble {
  background: white;
  border: 1px solid #eee;
  color: #333;
  border-top-left-radius: 2px;
}

.gracebot-msg.user .gracebot-bubble {
  background: var(--primary-color, #702f8a);
  color: white;
  border-top-right-radius: 2px;
}

.gracebot-bubble p {
  margin: 0 0 8px 0;
}
.gracebot-bubble p:last-child {
  margin: 0;
}
.gracebot-bubble a {
  color: inherit;
  text-decoration: underline;
}

.gracebot-input-area {
  padding: 12px;
  background: white;
  border-top: 1px solid #eee;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.gracebot-input-area textarea {
  flex-grow: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  height: 40px;
  max-height: 100px;
  outline: none;
  background: #f9f9f9;
}

.gracebot-input-area textarea:focus {
  border-color: var(--primary-color, #702f8a);
  background: white;
}

.gracebot-send-btn {
  background: var(--primary-color, #702f8a);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.gracebot-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Typing indicator */
.gracebot-typing .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #ccc;
  border-radius: 50%;
  margin: 0 2px;
  animation: gracebotBounce 1.4s infinite ease-in-out both;
}
.gracebot-typing .dot:nth-child(1) { animation-delay: -0.32s; }
.gracebot-typing .dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes gracebotBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

@media (max-width: 480px) {
  #gracebot-window {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}
