/* ═══════════════════════════════════════════════════
   GIGGLEZEN — CHATBOT WIDGET STYLES
   Glass-morphism floating chat — God Mode Design System
   ═══════════════════════════════════════════════════ */

/* ─── FLOATING TRIGGER BUTTON ─── */
.gz-chatbot-trigger {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  z-index: var(--z-toast, 500);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gz-grad-hero);
  color: #fff;
  box-shadow: var(--gz-shadow-md), var(--gz-shadow-glow);
  transition: transform 0.3s var(--ease-out-expo), box-shadow 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.gz-chatbot-trigger:hover {
  transform: scale(1.1);
  box-shadow: var(--gz-shadow-lg), 0 0 60px rgba(0, 240, 255, 0.35);
}
.gz-chatbot-trigger:active {
  transform: scale(0.95);
}

/* Pulse ring animation */
.gz-chatbot-trigger::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--gz-grad-hero);
  opacity: 0;
  z-index: -1;
  animation: gz-chatbot-pulse 2.5s ease-out infinite;
}
@keyframes gz-chatbot-pulse {
  0%   { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Icon swap */
.gz-chatbot-trigger .gz-chatbot-icon-close {
  display: none;
}
.gz-chatbot-trigger.is-open .gz-chatbot-icon-chat {
  display: none;
}
.gz-chatbot-trigger.is-open .gz-chatbot-icon-close {
  display: block;
}
.gz-chatbot-trigger.is-open::before {
  animation: none;
  opacity: 0;
}

/* Notification badge */
.gz-chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gz-magenta);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-body);
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(255, 45, 170, 0.5);
}

/* ─── NOTIFICATION BUBBLE ─── */
.gz-chatbot-notification {
  position: fixed;
  bottom: 90px;
  left: 24px;
  max-width: 280px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--gz-glass-bg);
  backdrop-filter: var(--gz-glass-blur);
  -webkit-backdrop-filter: var(--gz-glass-blur);
  border: 1px solid var(--gz-glass-border);
  box-shadow: var(--gz-shadow-md);
  color: var(--gz-text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  z-index: var(--z-toast, 500);
  display: none;
  animation: gz-chatbot-slideIn 0.4s var(--ease-out-expo) forwards;
}
.gz-chatbot-notification p {
  margin: 0;
  line-height: 1.5;
}
.gz-chatbot-notification .gz-chatbot-notif-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: var(--gz-text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
}
.gz-chatbot-notification .gz-chatbot-notif-close:hover {
  color: var(--gz-text-primary);
  background: rgba(255, 255, 255, 0.06);
}

@keyframes gz-chatbot-slideIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── CHAT WINDOW ─── */
.gz-chatbot-window {
  position: fixed;
  bottom: 90px;
  left: 24px;
  width: 400px;
  height: 520px;
  max-height: calc(100vh - 120px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: none;
  flex-direction: column;
  z-index: var(--z-toast, 500);
  background: var(--gz-glass-bg);
  backdrop-filter: var(--gz-glass-blur);
  -webkit-backdrop-filter: var(--gz-glass-blur);
  border: 1px solid var(--gz-glass-border);
  box-shadow: var(--gz-shadow-lg), var(--gz-shadow-glow);
  font-family: var(--font-body);
  transform-origin: bottom left;
  /* open/close handled by JS */
}
.gz-chatbot-window.is-visible {
  display: flex;
  animation: gz-chatbot-windowIn 0.35s var(--ease-out-expo) forwards;
}
.gz-chatbot-window.is-closing {
  animation: gz-chatbot-windowOut 0.25s ease-in forwards;
}
@keyframes gz-chatbot-windowIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes gz-chatbot-windowOut {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to   { opacity: 0; transform: scale(0.9) translateY(20px); }
}

/* ─── HEADER ─── */
.gz-chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--gz-obsidian);
  border-bottom: 1px solid var(--gz-glass-border);
  flex-shrink: 0;
}
.gz-chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gz-chatbot-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gz-grad-hero);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.gz-chatbot-avatar-pulse {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #00e676;
  border: 2px solid var(--gz-obsidian);
  box-shadow: 0 0 6px rgba(0, 230, 118, 0.6);
}
.gz-chatbot-header-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--gz-text-primary);
  margin: 0;
  line-height: 1.2;
}
.gz-chatbot-header-status {
  font-size: 11px;
  color: var(--gz-text-secondary);
  margin: 0;
  line-height: 1.3;
}
.gz-chatbot-header-actions {
  display: flex;
  gap: 4px;
}
.gz-chatbot-header-actions button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--gz-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  font-size: 16px;
}
.gz-chatbot-header-actions button:hover {
  color: var(--gz-text-primary);
  background: rgba(255, 255, 255, 0.06);
}

/* ─── MESSAGES AREA ─── */
.gz-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.gz-chatbot-messages::-webkit-scrollbar { width: 4px; }
.gz-chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.gz-chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--gz-graphite);
  border-radius: var(--radius-full);
}

/* ─── MESSAGE BUBBLES ─── */
.gz-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.55;
  color: var(--gz-text-primary);
  animation: gz-chatbot-msgIn 0.3s var(--ease-out-expo) forwards;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
@keyframes gz-chatbot-msgIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.gz-chat-msg p {
  margin: 0 0 6px 0;
}
.gz-chat-msg p:last-child {
  margin-bottom: 0;
}
.gz-chat-msg a {
  color: var(--gz-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.gz-chat-msg a:hover {
  color: #fff;
}
.gz-chat-msg ul, .gz-chat-msg ol {
  margin: 6px 0;
  padding-left: 18px;
}
.gz-chat-msg li {
  margin-bottom: 3px;
}
.gz-chat-msg code {
  background: rgba(0, 240, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.gz-chat-msg strong {
  color: var(--gz-cyan);
  font-weight: 600;
}

/* User messages — right aligned, cyan accent */
.gz-chat-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.18), rgba(123, 47, 255, 0.12));
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-bottom-right-radius: 4px;
}

/* Bot messages — left aligned, dark bg */
.gz-chat-msg--bot {
  align-self: flex-start;
  background: var(--gz-charcoal);
  border: 1px solid var(--gz-glass-border);
  border-bottom-left-radius: 4px;
}

/* ─── QUICK ACTION BUTTONS ─── */
.gz-chatbot-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.gz-chatbot-quick-btn {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 240, 255, 0.25);
  background: rgba(0, 240, 255, 0.06);
  color: var(--gz-cyan);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.gz-chatbot-quick-btn:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--gz-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

/* ─── TYPING INDICATOR ─── */
.gz-chatbot-typing {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
}
.gz-chatbot-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gz-text-secondary);
  animation: gz-chatbot-typingDot 1.4s ease-in-out infinite;
}
.gz-chatbot-typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.gz-chatbot-typing span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes gz-chatbot-typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* ─── INPUT AREA ─── */
.gz-chatbot-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--gz-obsidian);
  border-top: 1px solid var(--gz-glass-border);
  flex-shrink: 0;
}
.gz-chatbot-input {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--gz-glass-border);
  background: var(--gz-charcoal);
  color: var(--gz-text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.gz-chatbot-input::placeholder {
  color: var(--gz-text-muted);
}
.gz-chatbot-input:focus {
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.08);
}
.gz-chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--gz-grad-hero);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
}
.gz-chatbot-send:hover {
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.3);
}
.gz-chatbot-send:active {
  transform: scale(0.95);
}
.gz-chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ─── MOBILE RESPONSIVE ─── */
@media (max-width: 767px) {
  .gz-chatbot-trigger {
    bottom: 16px;
    left: 16px;
    width: 50px;
    height: 50px;
  }
  .gz-chatbot-notification {
    bottom: 78px;
    left: 16px;
    right: 16px;
    max-width: none;
  }
  .gz-chatbot-window {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    transform-origin: bottom center;
  }
  .gz-chatbot-window.is-visible {
    animation-name: gz-chatbot-windowInMobile;
  }
  @keyframes gz-chatbot-windowInMobile {
    from { opacity: 0; transform: translateY(100%); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .gz-chatbot-window.is-closing {
    animation-name: gz-chatbot-windowOutMobile;
  }
  @keyframes gz-chatbot-windowOutMobile {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(100%); }
  }
}

/* ─── REDUCED MOTION ─── */
@media (prefers-reduced-motion: reduce) {
  .gz-chatbot-trigger::before { animation: none; }
  .gz-chatbot-typing span { animation: none; opacity: 0.6; }
  .gz-chatbot-window.is-visible,
  .gz-chatbot-window.is-closing,
  .gz-chat-msg,
  .gz-chatbot-notification {
    animation-duration: 0.01ms !important;
  }
}
