/* ═══════════════════════════════════════════════════════════
   AI ASSISTANT CHAT BUBBLE — Cinematic Gold
═══════════════════════════════════════════════════════════ */
.ai-bubble-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-primary, linear-gradient(135deg, #34D399, #6EE7B7));
  color: #1E2235;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(52, 211, 153, 0.35);
  z-index: 900;
  transition: transform 0.2s, box-shadow 0.2s;
  user-select: none;
}
.ai-bubble-btn:hover { transform: scale(1.08); box-shadow: 0 6px 32px rgba(52, 211, 153, 0.45); }
.ai-bubble-bounce {
  animation: bubble-bounce 1s ease infinite;
  animation-iteration-count: 4;
}
@keyframes bubble-bounce {
  0%, 100% { transform: translateY(0); }
  20%       { transform: translateY(-12px); }
  40%       { transform: translateY(-6px); }
  60%       { transform: translateY(-10px); }
  80%       { transform: translateY(-3px); }
}
.ai-bubble-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 12px; height: 12px;
  background: #34D399;
  border-radius: 50%;
  border: 2px solid #1E2235;
  animation: bubble-pulse 1.8s infinite;
}
@keyframes bubble-pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}
.ai-chat-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 360px;
  max-height: 500px;
  background: var(--night-card, #2A3050);
  border: 1px solid rgba(52, 211, 153, 0.1);
  border-radius: var(--r-lg, 20px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  z-index: 901;
  overflow: hidden;
  transition: opacity 0.2s, transform 0.25s;
  transform-origin: bottom right;
}
.ai-chat-panel.hidden { display: none; }
.ai-chat-header {
  background: var(--gradient-primary, linear-gradient(135deg, #34D399, #6EE7B7));
  color: #1E2235;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ai-chat-header-info { display: flex; align-items: center; gap: 10px; }
.ai-chat-avatar {
  width: 36px; height: 36px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.ai-chat-name { font-weight: 700; font-size: 14px; }
.ai-chat-status { font-size: 11px; opacity: 0.7; margin-top: 1px; }
.ai-chat-close {
  background: none; border: none; color: #1E2235;
  font-size: 16px; cursor: pointer; padding: 4px; opacity: 0.6;
  transition: opacity 0.15s;
}
.ai-chat-close:hover { opacity: 1; }
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  background: var(--night, #1E2235);
}
.ai-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  animation: ai-msg-in 0.2s ease;
}
@keyframes ai-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-msg-bot {
  background: var(--night-elevated, #353D60);
  color: var(--cream, #FAFAF6);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.ai-msg-bot a {
  font-weight: 700;
  color: var(--gold, #C6A44E);
  text-decoration: underline;
  word-break: break-all;
  overflow-wrap: anywhere;
  display: inline;
}
.ai-msg-user {
  background: var(--gradient-primary, linear-gradient(135deg, #34D399, #6EE7B7));
  color: #1E2235;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  font-weight: 500;
}
.ai-msg-typing {
  display: flex; gap: 5px; align-items: center;
  padding: 10px 14px;
  background: var(--night-elevated, #353D60);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: 52px;
}
.ai-msg-typing span {
  width: 7px; height: 7px;
  background: var(--cream-muted, #8A8478);
  border-radius: 50%;
  animation: typing-dot 1.2s infinite;
}
.ai-msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-msg-typing span:nth-child(3) { animation-delay: 0.4s; }

.ai-typing {
  width: 52px !important;
  display: flex !important; gap: 5px; align-items: center;
}
.ai-typing span {
  width: 7px; height: 7px;
  background: var(--cream-muted, #8A8478); border-radius: 50%;
  animation: typing-dot 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot {
  0%,60%,100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}
.ai-chat-input-wrap {
  padding: 10px 12px;
  border-top: 1px solid rgba(245, 240, 232, 0.06);
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--night-card, #2A3050);
}
.ai-chat-input {
  flex: 1;
  border: 1.5px solid rgba(245, 240, 232, 0.1);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
  color: var(--cream, #FAFAF6);
  background: rgba(245, 240, 232, 0.04);
  transition: border-color 0.15s;
}
.ai-chat-input::placeholder { color: var(--cream-muted, #8A8478); }
.ai-chat-input:focus { border-color: rgba(52, 211, 153, 0.4); }
.ai-chat-send {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary, linear-gradient(135deg, #34D399, #6EE7B7));
  color: #1E2235;
  border: none;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.ai-chat-send:hover { opacity: 0.85; }
.ai-chat-send:disabled { opacity: 0.35; cursor: default; }
@media (max-width: 480px) {
  .ai-bubble-btn {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: 52px;
    height: 52px;
    font-size: 20px;
  }
  .ai-chat-panel {
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: auto;
    width: auto;
    height: 46vh;
    max-height: 46vh;
    border-radius: 14px;
    transform-origin: top right;
  }
  .ai-chat-messages { padding: 10px 8px; gap: 8px; }
  .ai-msg { font-size: 14px; max-width: 88%; padding: 9px 12px; }
  .ai-chat-input { font-size: 16px; padding: 9px 12px; }
  .ai-chat-send { width: 40px; height: 40px; }
  .ai-msg-video { width: 100% !important; max-width: 100% !important; }
}

/* ── Chat options & rec cards ── */
.ai-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: flex-start;
  max-width: 95%;
  animation: ai-msg-in 0.2s ease;
}
.ai-option-btn {
  background: var(--night-elevated, #353D60);
  border: 1.5px solid rgba(245, 240, 232, 0.1);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--cream, #FAFAF6);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.ai-option-btn:hover {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.3);
}
.ai-rec-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: var(--night-elevated, #353D60);
  border: 1.5px solid rgba(245, 240, 232, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  gap: 10px;
  animation: ai-msg-in 0.2s ease;
  align-self: flex-start;
  width: 90%;
}
.ai-rec-info { flex: 1; min-width: 0; }
.ai-rec-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--cream, #FAFAF6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-rec-label {
  font-size: 11.5px;
  color: var(--cream-dim, #D0C9BC);
  margin-top: 2px;
}
.ai-rec-btn {
  background: var(--gradient-primary, linear-gradient(135deg, #34D399, #6EE7B7));
  color: #1E2235;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  transition: opacity 0.15s;
}
.ai-rec-btn:hover { opacity: 0.85; }
.ai-rec-card .ai-rec-btn {
  margin-top: 2px;
  flex-shrink: 0;
}

/* ── Category button & PDF icon ── */
.ai-cat-btn-wrap { align-self: flex-start; width: 90%; }
.ai-cat-btn {
  width: 100%;
  background: var(--gradient-primary, linear-gradient(135deg, #34D399, #6EE7B7));
  color: #1E2235;
  border: none;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: opacity 0.15s;
  animation: ai-msg-in 0.2s ease;
}
.ai-cat-btn:hover { opacity: 0.88; }
.ai-rec-icon { font-size: 18px; flex-shrink: 0; }
.ai-rec-card a.ai-rec-btn {
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Trainer description excerpt ── */
.ai-rec-desc {
  font-size: 11.5px;
  color: var(--cream-muted, #8A8478);
  margin-top: 4px;
  line-height: 1.4;
}
