/* ============================================================
   MIKA Academy - Hudhud AI Chat Styles
   ============================================================ */

/* ---- Floating Button ---- */
.hudhud-ai-fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: linear-gradient(135deg, #1a3a5c, #2d6a9f);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(26,58,92,0.4);
  z-index: 1000;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.3s;
  animation: fabPulse 3s ease-in-out infinite;
}
.hudhud-ai-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(26,58,92,0.5);
}
.hudhud-ai-fab-label { white-space: nowrap; }

@keyframes fabPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(26,58,92,0.4); }
  50% { box-shadow: 0 4px 28px rgba(45,106,159,0.7); }
}

/* ---- Modal Overlay ---- */
.ai-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 600px) {
  .ai-modal-overlay {
    align-items: center;
    padding: 16px;
  }
}

/* ---- Modal ---- */
.ai-modal {
  background: white;
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 520px;
  height: 85vh;
  max-height: 700px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.2);
  font-family: 'Cairo', sans-serif;
}

@media (min-width: 600px) {
  .ai-modal {
    border-radius: 24px;
    height: 80vh;
  }
}

/* ---- Header ---- */
.ai-modal-header {
  background: linear-gradient(135deg, #1a3a5c, #2d6a9f);
  color: white;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.ai-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-header-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  padding: 4px;
  animation: floatAnim 3s ease-in-out infinite;
}
.ai-header-title { font-size: 16px; font-weight: 900; }
.ai-header-sub { font-size: 11px; opacity: 0.8; }
.ai-header-actions { display: flex; gap: 8px; }
.ai-btn-icon {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.ai-btn-icon:hover { background: rgba(255,255,255,0.25); }

/* ---- API Key Banner ---- */
.ai-apikey-banner {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border-bottom: 2px solid #FF8C42;
  padding: 12px 16px;
  flex-shrink: 0;
}
.ai-apikey-icon { font-size: 24px; text-align: center; margin-bottom: 4px; }
.ai-apikey-text { text-align: center; margin-bottom: 8px; }
.ai-apikey-text strong { font-size: 14px; color: #e65100; }
.ai-apikey-text p { font-size: 12px; color: #666; margin: 2px 0; }
.ai-apikey-text a { color: #1565C0; font-weight: 700; }
.ai-apikey-input-row { display: flex; gap: 8px; }
.ai-apikey-input {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid #FF8C42;
  border-radius: 8px;
  font-size: 13px;
  font-family: monospace;
  direction: ltr;
}
.ai-apikey-save-btn {
  background: #FF8C42;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
}

/* ---- Messages Area ---- */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8f9fa;
}

/* ---- Message Bubbles ---- */
.ai-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 90%;
}
.ai-msg-bot { align-self: flex-start; }
.ai-msg-user { align-self: flex-end; flex-direction: row-reverse; }

.ai-msg-avatar {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 50%;
  background: #e3f2fd;
  padding: 2px;
  flex-shrink: 0;
}
.ai-msg-avatar-user {
  font-size: 24px;
  flex-shrink: 0;
}

.ai-msg-bubble {
  background: white;
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.6;
  color: #1a1a2e;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  max-width: 100%;
  word-wrap: break-word;
}
.ai-msg-bubble-user {
  background: linear-gradient(135deg, #1a3a5c, #2d6a9f);
  color: white;
  border-radius: 16px 16px 4px 16px;
}

/* ---- Typing Indicator ---- */
.ai-typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}
.ai-typing span {
  width: 8px;
  height: 8px;
  background: #2d6a9f;
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-6px); opacity: 1; }
}

/* ---- Quick Questions ---- */
.ai-quick-questions {
  padding: 8px 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: white;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.ai-quick-btn {
  background: #e3f2fd;
  color: #1565C0;
  border: 1px solid #bbdefb;
  border-radius: 16px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  transition: all 0.2s;
  white-space: nowrap;
}
.ai-quick-btn:hover {
  background: #1565C0;
  color: white;
}

/* ---- Input Area ---- */
.ai-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: white;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
  align-items: flex-end;
}
.ai-input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 16px;
  font-size: 14px;
  font-family: 'Cairo', sans-serif;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.5;
}
.ai-input:focus { border-color: #2d6a9f; }
.ai-send-btn {
  background: linear-gradient(135deg, #1a3a5c, #2d6a9f);
  color: white;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.ai-send-btn span:first-child { display: none; }
.ai-send-btn:hover { transform: scale(1.1); }
.ai-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Powered By ---- */
.ai-powered-by {
  text-align: center;
  font-size: 11px;
  color: #999;
  padding: 6px;
  background: white;
  flex-shrink: 0;
}
.ai-powered-by a { color: #1565C0; }

@keyframes floatAnim {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* v58: Hide API key input elements — key is embedded */
.ai-apikey-banner,
#ai-apikey-banner,
.ai-apikey-input-row,
.ai-apikey-save-btn,
[id*="apikey"],
[class*="apikey"] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
}


/* MIKA v88 - Large resizable Hudhud AI window */
.ai-modal-overlay{background:rgba(0,0,0,.18)!important;align-items:center!important;justify-content:flex-end!important;padding:18px 24px!important;pointer-events:none!important}.ai-modal{pointer-events:auto!important;width:50vw!important;min-width:420px!important;max-width:760px!important;height:78vh!important;min-height:460px!important;max-height:92vh!important;resize:both!important;overflow:hidden!important;border-radius:22px!important;box-shadow:0 18px 60px rgba(0,0,0,.28)!important}html[dir="rtl"] .ai-modal-overlay{justify-content:flex-start!important}@media(max-width:768px){.ai-modal-overlay{align-items:flex-end!important;justify-content:center!important;padding:0!important}.ai-modal{width:100vw!important;min-width:0!important;max-width:100vw!important;height:88vh!important;min-height:0!important;max-height:88vh!important;resize:none!important;border-radius:22px 22px 0 0!important}}.ai-modal.ai-expanded{width:72vw!important;height:88vh!important;max-width:980px!important}.ai-apikey-banner{display:none!important}#hh-corner-root{position:fixed!important;left:24px!important;bottom:24px!important;z-index:100000!important}body.hudhud-ai-open #hh-corner-root{bottom:34px!important;transform:scale(.95)}html[dir="rtl"] body.hudhud-ai-open #hh-corner-root{left:auto!important;right:24px!important}#hh-corner-char.hh-mood-happy{animation:hhCornerBounce .9s ease-in-out 1!important}#hh-corner-char.hh-mood-thinking{animation:hhCornerWiggle 1.2s ease-in-out infinite!important;filter:drop-shadow(0 6px 18px rgba(45,106,159,.55))!important}#hh-corner-char.hh-mood-excited{animation:hhCornerCelebrate 1s ease-in-out 2!important}#hh-corner-char.hh-mood-sad{animation:hhCornerShake .55s ease-in-out 2!important;filter:grayscale(.25) drop-shadow(0 6px 18px rgba(120,120,120,.4))!important}
