/* ── aisQui microAgent Widget ─────────────────────────── */

/* ── Badge (collapsed state) ── */
.mia-badge {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1050;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: miaFloat 3s ease-in-out infinite, miaPulse 4s ease-in-out 6s infinite;
}
.mia-badge:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(14, 165, 233, 0.25);
  animation: none;
}
.mia-badge.hidden { display: none; }

.mia-face {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  user-select: none;
  line-height: 0.9;
  white-space: pre;
  text-align: center;
}

/* ── Greeting bubble ── */
.mia-greeting {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 1050;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px 10px 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary-light);
  max-width: 280px;
  white-space: pre;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.mia-greeting.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.mia-greeting.hidden { display: none; }

/* Badge nudges up when greeting is visible */
.mia-badge.greeting-up {
  transform: translateY(-12px);
  transition: transform 0.4s ease;
}
.mia-socials.greeting-up {
  transform: translateY(-12px);
  transition: transform 0.4s ease;
}

/* ── Panel (expanded state) ── */
.mia-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1050;
  width: 340px;
  height: 440px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
  animation: panelOpen 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.mia-panel.closing {
  animation: panelClose 0.25s ease forwards;
}
.mia-panel.hidden { display: none; }

/* ── Header ── */
.mia-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.mia-header-face {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 0.9;
  white-space: pre;
  text-align: center;
}
.mia-header-name {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}
.mia-header-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(14, 165, 233, 0.12);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}
.mia-header-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}
.mia-header-close:hover { color: #fff; }

/* ── Messages area ── */
.mia-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mia-messages::-webkit-scrollbar { width: 4px; }
.mia-messages::-webkit-scrollbar-track { background: transparent; }
.mia-messages::-webkit-scrollbar-thumb { background: rgba(14, 165, 233, 0.2); border-radius: 2px; }

.mia-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  animation: msgFadeIn 0.3s ease forwards;
}
.mia-msg-assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-light);
}
.mia-msg-user {
  align-self: flex-end;
  background: var(--primary);
  color: var(--secondary);
  font-weight: 500;
}

/* ── Quick chips ── */
.mia-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}
.mia-chips.hidden { display: none; }

.mia-chip {
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 20px;
  padding: 6px 14px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--primary-light);
  cursor: pointer;
  transition: all 0.2s;
}
.mia-chip:hover {
  background: rgba(14, 165, 233, 0.2);
  border-color: var(--primary);
}

/* ── Typing indicator ── */
.mia-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
}
.mia-typing.hidden { display: none; }
.mia-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.4;
  animation: typingDot 1.4s ease-in-out infinite;
}
.mia-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.mia-typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ── Input area ── */
.mia-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.mia-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-light);
  outline: none;
  transition: border-color 0.2s;
}
.mia-input::placeholder { color: var(--text-muted); }
.mia-input:focus { border-color: var(--primary); }

.mia-send {
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--secondary);
  font-size: 1rem;
  transition: background 0.2s;
  flex-shrink: 0;
}
.mia-send:hover { background: var(--primary-light); }
.mia-send:disabled { opacity: 0.4; cursor: default; }

/* ── Social orbit icons ── */
.mia-socials {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 68px;
  height: 68px;
  z-index: 1049;
  pointer-events: none;
  animation: miaOrbit 30s linear infinite;
}
.mia-socials.hidden { display: none; }

.mia-social {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  font-size: 0.8rem;
  color: var(--primary-light);
  text-decoration: none;
  transition: color 0.2s, box-shadow 0.2s, border-color 0.2s;
  animation: miaCounterOrbit 30s linear infinite;
}
.mia-social:hover {
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.4);
}
.mia-social-hidden { display: none; }

/* Position each icon evenly around badge (radius ~50px, 120° apart) */
.mia-social-yt { margin: -64px 0 0 -14px; }   /* top */
.mia-social-ig { margin: 11px 0 0 29px; }     /* lower-right */
.mia-social-fb { margin: 11px 0 0 -57px; }    /* lower-left */
.mia-social-x  { margin: -64px 0 0 29px; }    /* (hidden) */

/* Platform hover colors */
.mia-social-yt:hover { color: #FF0000; border-color: rgba(255, 0, 0, 0.3); }
.mia-social-ig:hover { color: #E4405F; border-color: rgba(228, 64, 95, 0.3); }
.mia-social-fb:hover { color: #1877F2; border-color: rgba(24, 119, 242, 0.3); }
.mia-social-x:hover  { color: #fff;    border-color: rgba(255, 255, 255, 0.3); }

/* ── Keyframes ── */
@keyframes miaFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes miaPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); }
  50%      { box-shadow: 0 4px 24px rgba(14, 165, 233, 0.4), 0 0 12px rgba(14, 165, 233, 0.2); }
}
@keyframes panelOpen {
  from { opacity: 0; transform: scale(0.8) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes panelClose {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to   { opacity: 0; transform: scale(0.8) translateY(20px); }
}
@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}
@keyframes miaOrbit {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes miaCounterOrbit {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-360deg); }
}

/* ── Reduce motion ── */
@media (prefers-reduced-motion: reduce) {
  .mia-badge { animation: none; }
  .mia-socials,
  .mia-social { animation: none; }
  .mia-greeting,
  .mia-badge.greeting-up,
  .mia-socials.greeting-up { transition: none; }
}

/* ── Responsive (mobile) ── */
@media (max-width: 576px) {
  .mia-panel {
    width: calc(100vw - 16px);
    height: 70vh;
    bottom: 8px;
    right: 8px;
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .mia-greeting { display: none; }
  .mia-badge {
    bottom: 16px;
    right: 16px;
  }
  .mia-socials {
    bottom: 16px;
    right: 16px;
  }
}
