/* Pufi · evdebiz asistanı */
.pufi { --pufi-olive: #8a8338; --pufi-olive-2: #6f6a2b; position: fixed; right: 16px; bottom: 16px; z-index: 60; font-family: inherit; }
.pufi.has-wa { bottom: 84px; }
.pufi svg { width: 100%; height: 100%; }

.pufi-launch { width: 64px; height: 64px; border-radius: 50%; border: 0; padding: 6px 6px 3px; cursor: pointer; background: var(--sand, #f6f4ef); box-shadow: 0 10px 28px rgba(35, 31, 32, .22), inset 0 0 0 2px #fff; display: block; transition: transform .2s ease; }
.pufi-launch:hover { transform: translateY(-2px) scale(1.04); }
.pufi-launch:focus-visible { outline: 3px solid var(--pufi-olive); outline-offset: 3px; }
.pufi-face { display: block; width: 100%; height: 100%; animation: pufi-bob 3.2s ease-in-out infinite; }
.pufi.open .pufi-launch { display: none; }

.pufi-eyes { transform-origin: 60px 73px; animation: pufi-blink 4.6s infinite; }
@keyframes pufi-blink { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(.1); } }
@keyframes pufi-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes pufi-hop { 0%, 100% { transform: translateY(0) scale(1, 1); } 30% { transform: translateY(0) scale(1.08, .9); } 60% { transform: translateY(-6px) scale(.96, 1.05); } }

/* Dolaşan Pufi */
.pufi-walker { position: relative; transform: translateX(var(--x, 0px)); transition: transform var(--walk, 0s) linear; will-change: transform; }
.pufi.open .pufi-walker { display: none; }
.pufi.walking .pufi-face { animation: pufi-walk .42s ease-in-out infinite; }
.pufi.flip .pufi-face svg { transform: scaleX(-1); }
.pufi.talking .pufi-face { animation: pufi-talk 1.4s ease-in-out infinite; }
@keyframes pufi-walk { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-7px) rotate(4deg); } }
@keyframes pufi-talk { 0%, 100% { transform: scale(1); } 20% { transform: scale(1.06, .95); } 40% { transform: scale(.97, 1.04); } }

/* Konuşma balonu */
.pufi-teaser { position: absolute; right: 0; bottom: 76px; width: max-content; min-width: 200px; max-width: min(290px, calc(100vw - 32px)); background: #fff; color: var(--ink, #231f20); border-radius: 16px 16px 4px 16px; padding: 12px 30px 10px 14px; font-size: .9rem; line-height: 1.4; box-shadow: 0 12px 32px rgba(35, 31, 32, .18); animation: pufi-in .3s ease both; }
.pufi-teaser::after { content: ""; position: absolute; right: 22px; bottom: -7px; width: 14px; height: 14px; background: #fff; transform: rotate(45deg); border-radius: 0 0 3px 0; }
.pufi.bubble-left .pufi-teaser { right: auto; left: 0; border-radius: 16px 16px 16px 4px; }
.pufi.bubble-left .pufi-teaser::after { right: auto; left: 22px; }
.pufi-say { margin: 0 0 8px; cursor: pointer; }
.pufi-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.pufi-acts:empty { display: none; }
.pufi-acts button, .pufi-acts a { border: 1px solid var(--line, #e7e2d8); background: var(--sand, #f6f4ef); border-radius: 999px; padding: 5px 11px; font-size: .82rem; cursor: pointer; color: var(--ink, #231f20); text-decoration: none; line-height: 1.3; }
.pufi-acts button:hover, .pufi-acts a:hover { border-color: var(--pufi-olive); color: var(--pufi-olive-2); }
.pufi-mute { display: block; margin-top: 8px; border: 0; background: none; padding: 0; font-size: .72rem; color: var(--muted, #7a7475); text-decoration: underline; cursor: pointer; }
.pufi-teaser-x { position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 1.15rem; line-height: 1; color: var(--muted, #7a7475); cursor: pointer; padding: 2px 5px; }

/* Kart içi düğme ve mesaj altı öneriler */
.pufi-card-add { margin: 0 9px 9px; border: 0; border-radius: 8px; background: var(--pufi-olive); color: #fff; font-size: .78rem; padding: 6px 8px; cursor: pointer; }
.pufi-card-add:hover { background: var(--pufi-olive-2); }
.pufi-card-add:disabled { opacity: .6; cursor: default; }
.pufi-card-add.done { background: #2f7a4b; }
.pufi-msg .pufi-chips { padding-top: 6px; }
@keyframes pufi-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.pufi-panel { position: fixed; right: 16px; bottom: 16px; width: 390px; height: min(640px, calc(100vh - 32px)); background: #fff; border-radius: 20px; box-shadow: 0 24px 60px rgba(35, 31, 32, .25); display: flex; flex-direction: column; overflow: hidden; animation: pufi-in .22s ease both; }
.pufi-panel[hidden] { display: none; }
@media (max-width: 560px) {
  .pufi-panel { inset: 0; width: auto; height: 100%; height: 100dvh; border-radius: 0; }
  .pufi { right: 12px; }
}

.pufi-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; background: var(--sand, #f6f4ef); border-bottom: 1px solid var(--line, #e7e2d8); }
.pufi-avatar { width: 42px; height: 42px; flex: none; background: #fff; border-radius: 50%; padding: 4px 4px 2px; box-shadow: inset 0 0 0 1px var(--line, #e7e2d8); }
.pufi-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.pufi-title strong { font-size: 1.02rem; }
.pufi-title small { color: var(--muted, #7a7475); font-size: .78rem; display: flex; align-items: center; gap: 6px; }
.pufi-dot { width: 7px; height: 7px; border-radius: 50%; background: #2f7a4b; display: inline-block; }
.pufi-icon { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2, #4a4546); cursor: pointer; display: grid; place-items: center; }
.pufi-icon:hover { background: rgba(35, 31, 32, .06); }
.pufi-icon svg { width: 20px; height: 20px; }

.pufi-log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; scroll-behavior: smooth; }
.pufi-msg { display: flex; flex-direction: column; max-width: 88%; }
.pufi-msg.bot { align-self: flex-start; }
.pufi-msg.user { align-self: flex-end; align-items: flex-end; }
.pufi-bubble { padding: 10px 13px; border-radius: 16px; font-size: .93rem; line-height: 1.5; overflow-wrap: anywhere; }
.pufi-msg.bot .pufi-bubble { background: var(--sand, #f6f4ef); border-bottom-left-radius: 5px; }
.pufi-msg.user .pufi-bubble { background: var(--ink, #231f20); color: #fff; border-bottom-right-radius: 5px; white-space: pre-wrap; }
.pufi-bubble a { color: var(--pufi-olive-2); text-decoration: underline; text-underline-offset: 2px; }
.pufi-bubble ul { margin: 4px 0; padding-left: 18px; }
.pufi-bubble p { margin: 0 0 .5em; }
.pufi-bubble p:last-child { margin: 0; }
.pufi-msg.err .pufi-bubble { background: #fbeae6; color: #7c2d1d; }

.pufi-cards { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px 4px; margin-right: -14px; padding-right: 14px; scroll-snap-type: x mandatory; max-width: calc(100% + 14px); }
.pufi-msg.bot:has(.pufi-cards) { max-width: 100%; }
.pufi-card { flex: 0 0 148px; scroll-snap-align: start; background: #fff; border: 1px solid var(--line, #e7e2d8); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; color: inherit; text-decoration: none; transition: box-shadow .15s, transform .15s; }
.pufi-card > a { display: flex; flex-direction: column; flex: 1; color: inherit; text-decoration: none; }
.pufi-card:hover { color: inherit; box-shadow: 0 8px 20px rgba(35, 31, 32, .1); transform: translateY(-1px); }
.pufi-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--sand, #f6f4ef); }
.pufi-card span { padding: 7px 9px 0; font-size: .8rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.pufi-card b { padding: 4px 9px 9px; font-size: .86rem; font-weight: 600; }
.pufi-card s { color: var(--muted, #7a7475); font-weight: 400; font-size: .76rem; margin-left: 4px; }

.pufi-chips[hidden], .pufi-teaser[hidden] { display: none; }
.pufi-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 4px; }
.pufi-chips button { border: 1px solid var(--line, #e7e2d8); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: .84rem; cursor: pointer; color: var(--ink, #231f20); }
.pufi-chips button:hover { border-color: var(--pufi-olive); color: var(--pufi-olive-2); }

.pufi-typing { display: flex; align-items: center; gap: 8px; color: var(--muted, #7a7475); font-size: .84rem; }
.pufi-typing i { width: 30px; height: 30px; display: block; animation: pufi-hop .9s ease-in-out infinite; }

.pufi-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 6px; border-top: 1px solid var(--line, #e7e2d8); }
.pufi-form textarea { flex: 1; resize: none; border: 1px solid var(--line, #e7e2d8); border-radius: 14px; padding: 10px 12px; font-size: 16px; line-height: 1.35; max-height: 120px; min-height: 42px; background: #fff; }
.pufi-form textarea:focus { outline: none; border-color: var(--pufi-olive); box-shadow: 0 0 0 3px rgba(138, 131, 56, .15); }
.pufi-send { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; background: var(--pufi-olive); color: #fff; cursor: pointer; display: grid; place-items: center; }
.pufi-send:hover { background: var(--pufi-olive-2); }
.pufi-send:disabled { opacity: .5; cursor: default; }
.pufi-send svg { width: 20px; height: 20px; }
.pufi-note { margin: 0; padding: 2px 14px 10px; font-size: .7rem; color: var(--muted, #7a7475); line-height: 1.35; }
.pufi-note a { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  .pufi-face, .pufi-eyes, .pufi-typing i, .pufi-panel, .pufi-teaser { animation: none; }
}
@media print { .pufi { display: none; } }

/* Pufi numaraları */
.pufi.jump .pufi-face { animation: pufi-jump 1.2s ease-out; }
.pufi.look .pufi-face svg { animation: pufi-look 1.2s ease-in-out; }
.pufi.spin .pufi-face { animation: pufi-spin 1.2s ease-in-out; }
@keyframes pufi-jump { 0%, 100% { transform: translateY(0) scale(1); } 15% { transform: translateY(0) scale(1.12, .85); } 40% { transform: translateY(-26px) scale(.94, 1.08); } 65% { transform: translateY(0) scale(1.1, .9); } 80% { transform: translateY(-6px); } }
@keyframes pufi-look { 0%, 100% { transform: scaleX(1); } 30%, 45% { transform: scaleX(-1); } 70% { transform: scaleX(1); } }
@keyframes pufi-spin { 0% { transform: rotate(0); } 60% { transform: rotate(370deg); } 80% { transform: rotate(355deg); } 100% { transform: rotate(360deg); } }
@media (max-width: 560px) {
  .pufi-launch { width: 54px; height: 54px; padding: 5px 5px 2px; }
  .pufi-teaser { bottom: 66px; }
}
