/* components/ai-sidekick/ai-sidekick.css
 * Pix — AI Sidekick
 * BEM naming. CSS variables from base.css where available.
 * Mobile-first. No external dependencies.
 */

/* ── Pix navbar avatar ─────────────────────────────────────────────────────── */
.pix-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-left: 8px;
  -webkit-tap-highlight-color: transparent;
}

.pix-avatar:active {
  opacity: 0.8;
}

.pix-avatar__face {
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.12));
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

.pix-avatar:hover .pix-avatar__face,
.pix-avatar:focus-visible .pix-avatar__face {
  transform: translateY(-2px) scale(1.05);
}

/* Idle ambient glow */
.pix-avatar::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245,197,71,0.18) 0%, transparent 70%);
  pointer-events: none;
}

/* Pulse ring — shown when there's a hint */
.pix-avatar__ring {
  display: none;
}

.pix-avatar--has-hint .pix-avatar__ring {
  display: block;
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid rgba(245,197,71,0.75);
  animation: pix-pulse 2s ease-out infinite;
}

/* Gold notification dot */
.pix-avatar__dot {
  display: none;
}

.pix-avatar--has-hint .pix-avatar__dot {
  display: block;
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: #F5C547;
  border-radius: 50%;
  border: 1.5px solid #fff;
}

@keyframes pix-pulse {
  0%   { transform: scale(1);   opacity: 0.8; }
  60%  { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(1.4); opacity: 0; }
}


/* ── Pix hint card ─────────────────────────────────────────────────────────── */
.pix-card {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: min(320px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-top: 3px solid #F5C547;
  border-radius: 14px;
  padding: 16px 16px 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  z-index: 1200;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
}

.pix-card--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.pix-card--exit {
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.pix-card__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}

.pix-card__close:hover {
  color: #555;
  background: rgba(0,0,0,0.05);
}

/* Three-layer typography — this size contrast is intentional */
.pix-card__whisper {
  margin: 0 0 4px;
  font-size: 10px;
  color: #aaa;
  font-style: italic;
  line-height: 1.4;
}

.pix-card__headline {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.25;
  padding-right: 20px; /* clear close btn */
}

.pix-card__body {
  margin: 0 0 14px;
  font-size: 13px;
  color: #555;
  line-height: 1.5;
}

.pix-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: #F5C547;
  color: #1a1a1a;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.pix-card__cta:hover {
  background: #edb83a;
}

.pix-card__cta:active {
  transform: scale(0.97);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .pix-card {
    background: #1e1e1e;
    border-color: rgba(255,255,255,0.1);
    border-top-color: #F5C547;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  }
  .pix-card__headline { color: #f0f0f0; }
  .pix-card__body     { color: #aaa; }
  .pix-card__close    { color: #666; }
  .pix-card__close:hover { color: #bbb; background: rgba(255,255,255,0.05); }
}


/* ── Chat panel ────────────────────────────────────────────────────────────── */
.pix-chat {
  position: fixed;
  inset: 0;
  z-index: 1300;
  pointer-events: none;
  visibility: hidden;
}

.pix-chat--open {
  pointer-events: all;
  visibility: visible;
}

.pix-chat__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.3s ease;
}

.pix-chat--open .pix-chat__backdrop {
  background: rgba(0,0,0,0.35);
}

.pix-chat__sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  height: 60vh;
  max-height: 520px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32,0.72,0,1);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
}

.pix-chat--open .pix-chat__sheet {
  transform: translateY(0);
}

.pix-chat__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  flex-shrink: 0;
}

.pix-chat__header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #FFF3CC;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pix-chat__header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pix-chat__name {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.2;
}

.pix-chat__status {
  font-size: 11px;
  color: #aaa;
}

.pix-chat__close {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
  flex-shrink: 0;
}

.pix-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

.pix-chat__empty {
  text-align: center;
  margin: auto;
  color: #bbb;
  font-size: 13px;
}

.pix-chat__message {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.pix-chat__message--user {
  background: #F5C547;
  color: #1a1a1a;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.pix-chat__message--assistant {
  background: #f0f0f0;
  color: #1a1a1a;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* Typing indicator */
.pix-chat__typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}

.pix-chat__typing span {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #aaa;
  animation: pix-dot 1.2s ease-in-out infinite;
}

.pix-chat__typing span:nth-child(2) { animation-delay: 0.2s; }
.pix-chat__typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pix-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-4px); opacity: 1; }
}

.pix-chat__input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(0,0,0,0.07);
  flex-shrink: 0;
}

.pix-chat__input {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 9999px;
  outline: none;
  background: #fafafa;
  color: #1a1a1a;
  transition: border-color 0.15s;
}

.pix-chat__input:focus {
  border-color: #F5C547;
  background: #fff;
}

.pix-chat__send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #F5C547;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a1a1a;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.pix-chat__send:active {
  transform: scale(0.93);
}

.pix-chat__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pix-chat__disclaimer {
  text-align: center;
  font-size: 10px;
  color: #ccc;
  padding: 4px 0 8px;
  margin: 0;
  flex-shrink: 0;
}

/* Dark mode — chat */
@media (prefers-color-scheme: dark) {
  .pix-chat__sheet        { background: #1e1e1e; }
  .pix-chat__name         { color: #f0f0f0; }
  .pix-chat__header       { border-bottom-color: rgba(255,255,255,0.08); }
  .pix-chat__message--assistant { background: #2a2a2a; color: #e0e0e0; }
  .pix-chat__message--user { color: #1a1a1a; }
  .pix-chat__input        { background: #2a2a2a; color: #e0e0e0; border-color: rgba(255,255,255,0.12); }
  .pix-chat__input:focus  { border-color: #F5C547; }
  .pix-chat__input-row    { border-top-color: rgba(255,255,255,0.08); }
}
