/* ══════════════════════════════════════════════════
   WellnessPickr AI assistant widget (based on Fibo AI v3.5)
   ══════════════════════════════════════════════════ */

:root {
  --wa-green: #0C8CA0;
  --wa-green-dark: #086F80;
  --wa-green-deep: #102F3A;
  --wa-bg: #F0F5F6;
  --wa-sent: #DDF3EA;
  --wa-recv:       #FFFFFF;
  --wa-header: #102F3A;
  --wa-input-bg:   #FFFFFF;
  --wa-text:       #111B21;
  --wa-muted:      #667781;
  --wa-border:     #E9EDEF;
  --wa-shadow:     rgba(0,0,0,0.13);
  --wa-radius:     18px;
}

/* ── Floating trigger (WhatsApp butonu) ── */
#smai-trigger {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 58px !important; height: 58px !important;
  min-width: 58px !important; max-width: 58px !important;
  padding: 0 !important;
  aspect-ratio: 1 / 1 !important;
  background: var(--wa-green) !important;
  background-image: none !important;
  border: none !important; border-radius: 50% !important;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(12,140,160,.5), 0 2px 6px rgba(0,0,0,.2);
  display: flex !important; align-items: center !important; justify-content: center !important;
  z-index: 9990;
  -webkit-appearance: none !important;
  appearance: none !important;
  line-height: 0 !important;
  transition: transform .2s, box-shadow .2s;
  animation: wa-pop .4s cubic-bezier(.34,1.56,.64,1) both;
}
#smai-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 22px rgba(12,140,160,.6), 0 2px 8px rgba(0,0,0,.25);
}
#smai-trigger svg {
  width: 30px !important; height: 30px !important;
  min-width: 30px !important; min-height: 30px !important;
  fill: #fff !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: none;
}
#smai-trigger svg path { fill: #fff !important; }
#smai-trigger.hide { display: none !important; }

/* Bildirim rozeti */
#smai-badge {
  position: absolute; top: -3px; right: -3px;
  width: 20px; height: 20px;
  background: #FF3B30; border-radius: 50%; border: 2px solid #fff;
  font-size: 11px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
}

@keyframes wa-pop {
  0%   { transform: scale(0) rotate(-30deg); opacity: 0; }
  70%  { transform: scale(1.1) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ── Chat penceresi ── */
#smai-chat {
  position: fixed;
  bottom: 88px; right: 20px;
  width: 360px;
  height: 560px;
  background: var(--wa-bg);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.22), 0 2px 10px rgba(0,0,0,.1);
  display: none;
  flex-direction: column;
  z-index: 9991;
  font-family: inherit;
  overflow: hidden;
  transform-origin: bottom right;
  animation: wa-open .2s cubic-bezier(.34,1.2,.64,1) both;
}
#smai-chat.open { display: flex; }

@keyframes wa-open {
  from { transform: scale(.9) translateY(12px); opacity: 0; }
  to   { transform: scale(1)  translateY(0);    opacity: 1; }
}

/* Mobil: alttan %60 yükseklik, üst köşeler yuvarlak */
@media (max-width: 500px) {
  #smai-chat {
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 60vh !important;
    max-height: 60vh !important;
    border-radius: 16px 16px 0 0 !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,.2) !important;
  }
  #smai-trigger { bottom: 16px; right: 16px; }
}

/* ── Header ── */
.smai-header {
  background: var(--wa-header);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
  user-select: none;
}
.smai-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--wa-green);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.smai-avatar svg { width: 22px; height: 22px; fill: #fff; }

.smai-header-info { flex: 1; min-width: 0; }
.smai-header-info strong {
  display: block; font-size: 15px; font-weight: 600;
  color: #fff; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.smai-header-info span {
  font-size: 12px; color: rgba(255,255,255,.75);
  display: flex; align-items: center; gap: 4px; margin-top: 1px;
}
.smai-header-info span::before {
  content: '';
  width: 7px; height: 7px; background: var(--wa-green);
  border-radius: 50%; flex-shrink: 0;
  animation: wa-pulse 2s infinite;
}
@keyframes wa-pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: .4; }
}

.smai-header-actions { display: flex; gap: 6px; align-items: center; }
.smai-header-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: transparent; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.85); transition: background .15s;
}
.smai-header-btn:hover { background: rgba(255,255,255,.12); }
.smai-header-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* Kapat butonu — KIRMIZI dolgu, beyaz × text karakteri (kesin görünür) */
#smai-close {
  width: 36px !important;
  height: 36px !important;
  background: #FF3B30 !important;
  border: 2px solid #ffffff !important;
  border-radius: 50% !important;
  color: #ffffff !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
  font-size: 24px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  padding: 0 !important;
  text-align: center !important;
  text-shadow: 0 1px 2px rgba(0,0,0,.3) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.35), 0 0 0 1px rgba(0,0,0,.15);
  margin-left: 6px;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: transform .15s, background .15s, box-shadow .15s;
}
#smai-close:hover {
  background: #E0241A !important;
  transform: scale(1.1);
  box-shadow: 0 3px 12px rgba(255,59,48,.5), 0 0 0 1px rgba(0,0,0,.2);
}
/* Eğer eski SVG kalırsa gizle (cache önlemi) */
#smai-close svg {
  display: none !important;
}

/* ── Mesaj alanı ── */
.smai-msgs {
  flex: 1; overflow-y: auto;
  padding: 12px 12px 6px;
  display: flex; flex-direction: column; gap: 3px;
  scroll-behavior: smooth;
  background-color: #F0F5F6;
}
.smai-msgs::-webkit-scrollbar { width: 4px; }
.smai-msgs::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 2px; }

/* Tarih ayırıcı */
.smai-date-sep {
  text-align: center; margin: 8px 0;
}
.smai-date-sep span {
  background: rgba(255,255,255,.75); color: var(--wa-muted);
  font-size: 11.5px; padding: 3px 10px; border-radius: 8px;
  backdrop-filter: blur(4px);
}

/* ── Baloncuklar ── */
.smai-row {
  display: flex; margin-bottom: 2px;
  animation: wa-msg .18s ease both;
}
@keyframes wa-msg {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.smai-row.bot  { justify-content: flex-start; }
.smai-row.user { justify-content: flex-end; }

.smai-bub {
  max-width: 78%;
  padding: 7px 10px 6px;
  border-radius: 8px;
  font-size: 14px; line-height: 1.48;
  word-break: break-word;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
/* Kuyruk — gelen */
.smai-row.bot .smai-bub {
  background: var(--wa-recv);
  color: var(--wa-text);
  border-top-left-radius: 2px;
  margin-left: 4px;
}
.smai-row.bot .smai-bub::before {
  content: '';
  position: absolute; top: 0; left: -8px;
  border: 8px solid transparent;
  border-top-color: var(--wa-recv);
  border-right-color: var(--wa-recv);
  border-top-left-radius: 2px;
}
/* Kuyruk — giden */
.smai-row.user .smai-bub {
  background: var(--wa-sent);
  color: var(--wa-text);
  border-top-right-radius: 2px;
  margin-right: 4px;
}
.smai-row.user .smai-bub::after {
  content: '';
  position: absolute; top: 0; right: -8px;
  border: 8px solid transparent;
  border-top-color: var(--wa-sent);
  border-left-color: var(--wa-sent);
  border-top-right-radius: 2px;
}
/* Mesaj saati */
.smai-time {
  font-size: 10.5px; color: var(--wa-muted);
  float: right; margin: 2px 0 -2px 8px;
}
.smai-row.user .smai-time { color: #6E9C8C; }

/* ── Yazıyor... ── */
.smai-typing-bub {
  background: var(--wa-recv);
  border-radius: 8px; border-top-left-radius: 2px;
  padding: 10px 14px; margin-left: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
  display: inline-flex; gap: 4px; align-items: center;
}
.smai-typing-bub span {
  width: 7px; height: 7px;
  background: #aaa; border-radius: 50%;
  animation: wa-dot 1.2s infinite;
}
.smai-typing-bub span:nth-child(2) { animation-delay: .2s; }
.smai-typing-bub span:nth-child(3) { animation-delay: .4s; }
@keyframes wa-dot {
  0%,60%,100% { transform: translateY(0); background: #bbb; }
  30%          { transform: translateY(-5px); background: #888; }
}

/* ── Hızlı yanıt butonları ── */
.smai-chips {
  padding: 6px 10px 4px;
  display: flex; flex-wrap: wrap; gap: 6px;
  background: var(--wa-bg);
  flex-shrink: 0;
}
.smai-chip {
  background: #fff; border: 1.5px solid var(--wa-green);
  color: var(--wa-green-dark); font-size: 12.5px; font-weight: 500;
  padding: 5px 12px; border-radius: 18px;
  cursor: pointer; transition: all .15s;
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.smai-chip:hover {
  background: var(--wa-green);
  color: #fff; border-color: var(--wa-green);
}

/* ── Input alanı ── */
.smai-input-wrap {
  background: var(--wa-border);
  padding: 8px 10px;
  display: flex; align-items: flex-end; gap: 8px;
  flex-shrink: 0;
}
@media (max-width: 500px) {
  .smai-input-wrap { padding-bottom: 20px; }
}

.smai-textarea {
  flex: 1;
  background: var(--wa-input-bg);
  border: none; outline: none;
  border-radius: 22px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 14px; color: var(--wa-text) !important;
  -webkit-text-fill-color: var(--wa-text) !important;
  line-height: 1.45; resize: none;
  min-height: 42px; max-height: 100px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  transition: box-shadow .2s;
}
.smai-textarea::placeholder { color: #aaa; }
.smai-textarea:focus { box-shadow: 0 1px 6px rgba(0,0,0,.15); }
.smai-textarea:focus::placeholder { color: transparent; }

.smai-send-btn {
  width: 46px !important;
  height: 46px !important;
  min-width: 46px !important;
  max-width: 46px !important;
  flex: 0 0 46px !important;
  aspect-ratio: 1 / 1 !important;
  padding: 0 !important;
  margin: 0 !important;
  background: var(--wa-green) !important;
  background-image: none !important;
  border: none !important;
  border-radius: 50% !important;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 6px rgba(12,140,160,.4);
  transition: transform .15s, background .15s;
  -webkit-appearance: none !important;
  appearance: none !important;
  line-height: 0 !important;
}
.smai-send-btn:hover  { background: var(--wa-green-dark) !important; transform: scale(1.05); }
.smai-send-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.smai-send-btn svg {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  fill: #fff !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin-left: 2px;
  pointer-events: none;
}
.smai-send-btn svg path { fill: #fff !important; }

/* ── Özet kart ── */
.smai-card {
  background: #fff;
  border-left: 4px solid var(--wa-green);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  margin-top: 2px;
}
.smai-card-title {
  font-weight: 700; font-size: 12px;
  color: var(--wa-green-dark); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 7px;
}
.smai-card-row {
  display: flex; justify-content: space-between;
  padding: 3px 0; border-bottom: 1px solid #f0f0f0;
  color: var(--wa-muted); gap: 8px; font-size: 12.5px;
}
.smai-card-row:last-of-type { border: none; }
.smai-card-row span:last-child { color: var(--wa-text); font-weight: 500; text-align: right; }

.smai-randevu-btn {
  width: 100%; margin-top: 10px;
  background: var(--wa-green);
  color: #fff; border: none; border-radius: 8px;
  padding: 10px; font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  transition: background .15s; letter-spacing: .2px;
}
.smai-randevu-btn:hover { background: var(--wa-green-dark); }

/* ── Toast ── */
#smai-toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: #1a3a1a; border: 1px solid var(--wa-green);
  color: var(--wa-green); padding: 10px 20px;
  border-radius: 10px; font-size: 13px; font-weight: 500;
  font-family: inherit; white-space: nowrap;
  z-index: 10000;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .3s, visibility .3s;
}
#smai-toast.show { opacity: 1; visibility: visible; }

/* ── WellnessPickr: links in replies ── */
.smai-bub a { color: var(--wa-green-dark); font-weight: 600; text-decoration: underline; word-break: break-word; }

/* ── WellnessPickr: "Buy From the Manufacturer" button under the product image ── */
.smai-buy-wrap { margin: 12px 0 0; text-align: center; }
.smai-buy {
  display: inline-flex !important; align-items: center; justify-content: center; gap: 8px;
  width: 100%; max-width: 320px; padding: 11px 14px !important; border: 0 !important;
  border-radius: 14px !important; background: #F5A623 !important; color: #102F3A !important;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px; font-weight: 700; line-height: 1.2; text-align: center;
  white-space: normal !important; text-transform: none !important; height: auto !important; min-height: 0 !important; letter-spacing: .01em; cursor: pointer;
  box-shadow: 0 6px 16px rgba(245,166,35,.35); transition: transform .15s, box-shadow .15s, background .15s;
}
.smai-buy:hover { background: #F0961A !important; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(245,166,35,.45); }
.smai-buy:focus-visible { outline: 3px solid #102F3A; outline-offset: 2px; }
.smai-buy svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.smai-buy-note { display: block; margin-top: 6px; font-size: 12px; color: #48616A; }

#smai-chat, #smai-chat button, #smai-chat textarea { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
@media (max-width: 600px) {
  .smai-buy-wrap { margin-top: 8px; }
  .smai-buy { padding: 8px 6px !important; font-size: 11.5px; line-height: 1.15; border-radius: 10px !important; gap: 0; box-shadow: 0 3px 10px rgba(245,166,35,.35); }
  .smai-buy svg { display: none; }
}

/* ══ v2.0 additions (link whitelist, affiliate tag, online dot, left position, footer) ══ */
#smai-trigger.left { right: auto !important; left: 20px; }
#smai-chat.left { right: auto; left: 20px; }
@media (max-width: 500px) { #smai-trigger.left { left: 14px; } #smai-chat.left { left: 0 !important; } }

.smai-online { position: relative; display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 0 2px #fff; flex: none; }
.smai-online::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid #22C55E; animation: smai-pulse 2s ease-out infinite; }
@keyframes smai-pulse { 0% { transform: scale(.8); opacity: .9; } 70% { transform: scale(2.1); opacity: 0; } 100% { opacity: 0; } }
#smai-trigger { overflow: visible !important; }
#smai-trigger .smai-online { position: absolute; right: 6px; top: 6px; }
#smai-chat .smai-avatar { position: relative; }
#smai-chat .smai-online--av { position: absolute; right: -1px; bottom: -1px; box-shadow: 0 0 0 2px var(--wa-header); }
#smai-chat .smai-online--av::after { display: none; }
#smai-chat .smai-status { display: flex !important; align-items: center; gap: 6px; }
#smai-chat .smai-status::before { display: none !important; content: none !important; }
#smai-chat .smai-status .smai-online { width: 8px; height: 8px; box-shadow: none; }
#smai-chat .smai-status .smai-online::after { display: none; }
#smai-chat .smai-header-btn svg { width: 18px; height: 18px; fill: currentColor; display: block; }

#smai-chat .smai-link { color: var(--wa-green-dark); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; box-shadow: none; }
#smai-chat .smai-link:hover { color: var(--wa-green-deep); }
#smai-chat .smai-link--aff { display: inline; padding: 3px 8px; background: #F5A623; color: #102F3A !important; border-radius: 6px; font-weight: 700; text-decoration: none; -webkit-box-decoration-break: clone; box-decoration-break: clone; line-height: 1.9; }
#smai-chat .smai-link--aff::after { content: " ↗"; }
#smai-chat .smai-link--aff:hover { background: #E0951A; color: #102F3A !important; }
#smai-chat .smai-affnote { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--wa-border); font-size: 11.5px; line-height: 1.4; color: var(--wa-muted); }
#smai-chat .smai-affnote a { color: var(--wa-green-dark); text-decoration: underline; }

#smai-chat .smai-foot { flex: none; margin: 0; padding: 4px 12px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--wa-input-bg); font-size: 11px; line-height: 1.4; color: var(--wa-muted); text-align: center; }
#smai-chat .smai-foot a { color: var(--wa-green-dark); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) { .smai-online::after { animation: none !important; } }
/* 2.0.1: manufacturer's official site (not an affiliate link) */
#smai-chat .smai-link--off { background: var(--wa-green); color: #fff !important; }
#smai-chat .smai-link--off:hover { background: var(--wa-green-dark); color: #fff !important; }
/* 2.0.3: mobile fixes */
html.smh-lock #smai-trigger { display: none !important; }
@media (max-width: 600px) {
  .smf-bottom__in { padding-bottom: 84px !important; }
  .smai-buy { font-size: 12.5px; min-height: 44px; }
}
