/* ==============================================
   Portakal — Dijital Mağaza Asistanı
   Antalya Likit maskot stilleri
   Animasyonlar: sadece mesaj, hover, buton basımı
   ============================================== */

/* ---- Root container ---- */
.portakal {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
.portakal > * { pointer-events: auto; }

/* ---- Avatar button ---- */
.pk-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #FFB347 0%, #F5922E 60%, #E07818 100%);
  box-shadow:
    0 4px 16px rgba(245,146,46,.3),
    0 2px 6px rgba(0,0,0,.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease;
  will-change: transform;
  position: relative;
  overflow: visible;
}
.pk-avatar img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: block;
}
.pk-avatar:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 8px 24px rgba(245,146,46,.4),
    0 4px 10px rgba(0,0,0,.22);
}
.pk-avatar:active {
  transform: translateY(-1px) scale(.96);
}

/* ---- Wave/greeting on click (only animation on avatar) ---- */
.portakal.is-waving .pk-avatar {
  animation: pkWave .6s ease;
}
@keyframes pkWave {
  0%   { transform: rotate(0); }
  25%  { transform: rotate(-6deg) scale(1.05); }
  50%  { transform: rotate(4deg) scale(1.08); }
  75%  { transform: rotate(-3deg) scale(1.04); }
  100% { transform: rotate(0) scale(1); }
}

/* ---- Speaking indicator (subtle ring, no continuous anim) ---- */
.portakal.is-speaking .pk-avatar {
  box-shadow:
    0 4px 16px rgba(245,146,46,.3),
    0 0 0 3px rgba(245,146,46,.2);
}

/* ---- Speech bubble ---- */
.pk-bubble {
  position: relative;
  max-width: 264px;
  min-width: 190px;
  background: rgba(14,27,46,.95);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px 14px 4px 14px;
  padding: 12px 14px 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.32);
  animation: pkBubbleIn .28s cubic-bezier(.34,1.56,.64,1);
  will-change: transform, opacity;
}
@keyframes pkBubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(.93); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Bubble tail */
.pk-bubble::after {
  content: "";
  position: absolute;
  bottom: -5px;
  right: 20px;
  width: 10px;
  height: 10px;
  background: rgba(14,27,46,.95);
  border-right: 1px solid rgba(255,255,255,.1);
  border-bottom: 1px solid rgba(255,255,255,.1);
  transform: rotate(45deg);
}

/* ---- Bubble text (max 2 lines) ---- */
.pk-bubble-text {
  font-size: 13px;
  line-height: 1.45;
  color: #F4F7FA;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pk-bubble-text::before {
  content: "\1F34A ";
}

/* ---- Close button ---- */
.pk-bubble-close {
  position: absolute;
  top: 5px;
  right: 7px;
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  color: rgba(255,255,255,.35);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
}
.pk-bubble-close:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
}

/* ---- Mute button ---- */
.pk-bubble-mute {
  position: absolute;
  top: 5px;
  right: 28px;
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  color: rgba(255,255,255,.3);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
}
.pk-bubble-mute:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
}

/* ---- Action buttons ---- */
.pk-bubble-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.pk-action-btn {
  padding: 4px 11px;
  border: 1px solid rgba(22,193,199,.35);
  border-radius: 999px;
  background: rgba(22,193,199,.08);
  color: #5FE0E4;
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, transform .12s, border-color .15s;
  white-space: nowrap;
}
.pk-action-btn:hover {
  background: rgba(22,193,199,.18);
  border-color: rgba(22,193,199,.6);
  transform: translateY(-1px);
}
.pk-action-btn:active {
  transform: scale(.94);
}

/* ---- Aroma Finder ---- */
.pk-aroma-finder {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.pk-aroma-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 9px;
  background: rgba(255,255,255,.04);
  color: #F4F7FA;
  font-size: 11.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .12s;
}
.pk-aroma-btn:hover {
  background: rgba(22,193,199,.12);
  border-color: rgba(22,193,199,.4);
  transform: translateY(-1px);
}
.pk-aroma-btn:active { transform: scale(.94); }
.pk-aroma-icon { font-size: 14px; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .portakal {
    bottom: 14px;
    right: 12px;
  }
  .pk-avatar {
    width: 46px;
    height: 46px;
  }
  .pk-avatar img {
    width: 40px;
    height: 40px;
  }
  .pk-bubble {
    max-width: 220px;
    min-width: 160px;
    padding: 10px 12px 8px;
  }
  .pk-bubble-text { font-size: 12px; }
  .pk-action-btn { font-size: 10.5px; padding: 3px 9px; }
  .pk-aroma-finder { grid-template-columns: 1fr 1fr; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .pk-avatar { transition: none; }
  .pk-bubble { animation: none; }
  .portakal.is-waving .pk-avatar { animation: none; }
  .pk-action-btn, .pk-aroma-btn { transition: none; }
}
