/* Evert ERP — canlı destek: asistan panelindeki "Şimdi danışmana sorun" kartı ve satış danışmanıyla sohbet ekranı (wwwroot/js/canli.js). */

/* ---------- danışman kartı (panel ana görünümü) ---------- */
.ap-live {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 14px 14px 12px; border-radius: 18px; text-align: left; color: #fff; overflow: clip; isolation: isolate; /* clip: hidden gibi kaydırma kabı olmaz, kart ızgarada ezilmez */
  background: radial-gradient(220px 120px at 100% 0%, rgba(25,195,201,.5), transparent 70%), linear-gradient(135deg, var(--petrol-700), var(--petrol));
  box-shadow: 0 14px 30px -16px rgba(4,42,48,.8), inset 0 1px 0 rgba(255,255,255,.12); transition: transform .3s var(--ease), box-shadow .3s;
}
.ap-live::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.1) 50%, transparent 70%); transform: translateX(-100%); animation: alSheen 5s ease-in-out 1.2s infinite; }
@keyframes alSheen { 0%, 70% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.ap-live:hover, .ap-live:focus-visible { transform: translateY(-2px); box-shadow: 0 20px 36px -16px rgba(4,42,48,.85), 0 0 0 3px rgba(25,195,201,.35); }
.ap-live > .icon { flex: none; width: 34px; height: 34px; padding: 8px; border-radius: 50%; background: rgba(255,255,255,.14); margin-left: auto; transition: transform .3s var(--ease); }
.ap-live:hover > .icon { transform: translateX(3px); }
.al-text { min-width: 0; }
.al-text b { display: block; font: 800 1.02rem/1.25 var(--font-head); letter-spacing: -.01em; }
.al-text small { display: block; margin-top: 3px; font-size: .78rem; line-height: 1.35; color: rgba(255,255,255,.78); }
.al-state { font-weight: 700; color: #7CE8B5; margin-right: 3px; }
.ap-live.offline .al-state { color: rgba(255,255,255,.7); }

/* avatar + çevrimiçi noktası (kart, sohbet başlığı ve danışman balonları ortak) */
.cd-avatar { position: relative; flex: none; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.cd-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.cd-avatar img.logo { width: 26px; height: 26px; object-fit: contain; border-radius: 0; }
.cd-dot { position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--petrol); }
.cd-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: cdPulse 2s ease-out infinite; }
.offline .cd-dot { background: #8A9A9E; }
.offline .cd-dot::after { animation: none; }
@keyframes cdPulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(2.4); opacity: 0; } }

/* ---------- sohbet görünümü ---------- */
.assist-panel.chatting { height: min(620px, calc(100vh - 110px)); max-height: none; }
.assist-panel.chatting .ap-home { display: none; }
.ap-home { display: flex; flex-direction: column; min-height: 0; }
.ap-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--kirik); }
.ap-chat[hidden] { display: none; }
.assist-panel.chatting .ap-chat { animation: cdIn .35s var(--ease) both; }
@keyframes cdIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

.ac-head { position: relative; display: flex; align-items: center; gap: 10px; padding: 14px 12px 14px 10px; color: #fff; background: radial-gradient(300px 120px at 90% 0%, rgba(25,195,201,.45), transparent 70%), linear-gradient(135deg, var(--petrol), var(--petrol-900)); }
.ac-head .cd-avatar { width: 42px; height: 42px; border-radius: 14px; }
.ac-head .cd-dot { box-shadow: 0 0 0 3px var(--petrol-900); }
.ac-who { min-width: 0; flex: 1; }
.ac-who b { display: block; font: 700 .98rem/1.25 var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-who small { display: block; font-size: .76rem; color: rgba(255,255,255,.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-who small .al-state { margin-right: 2px; }
.ac-btn { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: rgba(255,255,255,.85); transition: background .2s, color .2s; }
.ac-btn:hover, .ac-btn:focus-visible, .ac-btn[aria-expanded="true"] { background: rgba(255,255,255,.12); color: #fff; }
.ac-btn .icon { width: 19px; height: 19px; }
.ac-menu { position: absolute; top: calc(100% - 6px); right: 46px; z-index: 3; min-width: 210px; padding: 6px; border-radius: 14px; background: #fff; color: var(--murekkep); box-shadow: var(--shadow-lg), 0 0 0 1px rgba(7,62,70,.08); }
.ac-menu[hidden] { display: none; }
.ac-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; font: 600 .86rem var(--font-body); text-align: left; }
.ac-menu button:hover, .ac-menu button:focus-visible { background: var(--nane-50); }
.ac-menu .icon { width: 17px; height: 17px; color: var(--turkuaz); }
.ac-menu .danger, .ac-menu .danger .icon { color: var(--fail); }

.ac-note { display: flex; align-items: center; gap: 8px; padding: 9px 16px; background: var(--nane); color: var(--petrol); font-size: .78rem; font-weight: 600; line-height: 1.35; border-bottom: 1px solid rgba(7,62,70,.06); }
.ac-note .icon { flex: none; width: 17px; height: 17px; color: var(--turkuaz); }

.ac-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 4px; scroll-behavior: smooth; }
.ac-day { align-self: center; margin: 4px 0 10px; padding: 3px 10px; border-radius: 999px; background: rgba(7,62,70,.06); color: var(--soluk); font-size: .7rem; font-weight: 600; letter-spacing: .02em; }

.ac-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 86%; animation: fadeUp .3s var(--ease) both; }
.ac-msg + .ac-msg.same { margin-top: -1px; }
.ac-msg.them { align-self: flex-start; }
.ac-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.ac-msg .ac-av { flex: none; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--petrol-700), var(--petrol)); }
.ac-msg .ac-av img { width: 16px; height: 16px; object-fit: contain; }
.ac-msg .ac-av img.photo { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.ac-msg.same .ac-av { visibility: hidden; }
.ac-bubble { position: relative; padding: 9px 13px 7px; font-size: .9rem; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.them .ac-bubble { background: #fff; color: var(--murekkep); border-radius: 6px 18px 18px 18px; box-shadow: 0 1px 2px rgba(7,62,70,.08), 0 0 0 1px rgba(7,62,70,.05); }
.them.same .ac-bubble { border-top-left-radius: 6px; }
.me .ac-bubble { background: linear-gradient(135deg, var(--turkuaz), var(--petrol-700)); color: #fff; border-radius: 18px 6px 18px 18px; box-shadow: 0 6px 16px -10px rgba(0,155,164,.9); }
.ac-bubble a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.them .ac-bubble a { color: var(--turkuaz); }
.ac-meta { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin-top: 2px; font-size: .66rem; line-height: 1; opacity: .7; white-space: nowrap; }
.ac-meta .icon { width: 14px; height: 14px; }
.me .ac-meta .read { color: #9FF3F5; opacity: 1; }
.ac-msg.pending .ac-bubble { opacity: .7; }
.ac-msg.failed .ac-bubble { background: #fff; color: var(--fail); box-shadow: 0 0 0 1px rgba(224,85,90,.4); }
.ac-retry { align-self: flex-end; margin: 2px 4px 6px; font-size: .74rem; font-weight: 600; color: var(--fail); text-decoration: underline; }
.ac-name { margin: 6px 0 2px 36px; font-size: .7rem; font-weight: 600; color: var(--soluk); }

.ac-sys { align-self: center; max-width: 92%; margin: 8px 0; padding: 7px 12px; border-radius: 12px; background: rgba(7,62,70,.06); color: var(--soluk); font-size: .76rem; line-height: 1.4; text-align: center; }

.ac-typing { display: flex; align-items: center; gap: 8px; padding: 0 14px 8px; color: var(--soluk); font-size: .74rem; }
.ac-typing[hidden] { display: none; }
.ac-dots { display: inline-flex; gap: 3px; padding: 9px 11px; border-radius: 6px 14px 14px 14px; background: #fff; box-shadow: 0 0 0 1px rgba(7,62,70,.06); }
.ac-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--turkuaz); animation: acDot 1.2s ease-in-out infinite; }
.ac-dots i:nth-child(2) { animation-delay: .15s; } .ac-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes acDot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }

/* iletişim bilgisi kartı: danışman bir süre yanıt vermezse ya da çevrimdışıyken */
.ac-card { align-self: stretch; margin: 8px 0; padding: 14px; border-radius: 16px; background: #fff; box-shadow: 0 0 0 1px rgba(7,62,70,.08), 0 8px 20px -14px rgba(4,42,48,.4); animation: fadeUp .35s var(--ease) both; }
.ac-card b { display: block; font: 700 .9rem/1.3 var(--font-head); color: var(--petrol); }
.ac-card p { margin: 4px 0 10px; font-size: .8rem; line-height: 1.45; color: var(--soluk); }
.ac-card form { display: grid; gap: 8px; }
.ac-card input { width: 100%; height: 40px; padding: 0 12px; border-radius: 11px; border: 1.5px solid var(--cizgi); font: inherit; font-size: .86rem; color: var(--murekkep); background: var(--kirik); transition: border-color .2s, box-shadow .2s; }
.ac-card input:focus { outline: 0; border-color: var(--turkuaz); box-shadow: 0 0 0 3px rgba(0,155,164,.12); background: #fff; }
.ac-card button[type="submit"] { height: 40px; border-radius: 11px; background: var(--petrol); color: #fff; font: 700 .86rem var(--font-head); transition: background .2s; }
.ac-card button[type="submit"]:hover { background: var(--petrol-700); }
.ac-card button[disabled] { opacity: .6; cursor: progress; }
.ac-card .ac-err { margin: 0; font-size: .76rem; color: var(--fail); }
.ac-card.done { display: flex; gap: 10px; align-items: center; }
.ac-card.done .icon { flex: none; width: 22px; height: 22px; color: var(--ok); }
.ac-card.done p { margin: 0; color: var(--murekkep); }

.ac-actions { display: flex; gap: 8px; }
.ac-actions button { height: 38px; padding: 0 16px; border-radius: 11px; background: var(--fail); color: #fff; font: 700 .84rem var(--font-head); }
.ac-actions button.ghost { background: var(--nane-50); color: var(--petrol); }
.ac-actions button:hover { filter: brightness(1.06); }
.ac-ended { display: grid; gap: 10px; justify-items: center; margin: 10px 0 4px; }
.ac-ended button { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px; background: var(--petrol); color: #fff; font: 700 .86rem var(--font-head); }
.ac-ended button:hover { background: var(--petrol-700); }
.ac-ended .icon { width: 17px; height: 17px; }

.ac-compose { display: flex; align-items: flex-end; gap: 8px; margin: 0 12px; padding: 6px 6px 6px 14px; border-radius: 18px; background: #fff; box-shadow: 0 0 0 1.5px var(--cizgi), 0 10px 24px -18px rgba(4,42,48,.5); transition: box-shadow .2s; }
.ac-compose:focus-within { box-shadow: 0 0 0 1.5px var(--turkuaz), 0 0 0 5px rgba(0,155,164,.12); }
.ac-compose textarea { flex: 1; min-width: 0; max-height: 120px; padding: 8px 0; border: 0; outline: 0; resize: none; font: inherit; font-size: .92rem; line-height: 1.4; color: var(--murekkep); background: none; }
.ac-compose textarea::placeholder { color: #8A9A9E; }
.ac-send { flex: none; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--turkuaz), var(--petrol-700)); box-shadow: 0 8px 16px -10px rgba(0,155,164,.9); transition: transform .2s var(--ease), opacity .2s, filter .2s; }
.ac-send .icon { width: 19px; height: 19px; }
.ac-send:disabled { opacity: .35; box-shadow: none; cursor: default; }
.ac-send:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.08); }
.ac-compose.off { opacity: .5; pointer-events: none; }
.ac-foot { margin: 0; padding: 8px 16px 12px; font-size: .68rem; line-height: 1.4; color: var(--soluk); text-align: center; }
.ac-foot a { color: var(--petrol); text-decoration: underline; text-underline-offset: 2px; }

/* düğme rozeti ve kapalı paneldeki yeni ileti önizlemesi */
.af-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; background: var(--fail); color: #fff; font: 800 .72rem/1 var(--font-head); box-shadow: 0 0 0 3px var(--kirik); animation: cdPop .35s var(--ease) both; }
.af-badge[hidden] { display: none; }
@keyframes cdPop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.cd-peek { position: relative; display: flex; gap: 10px; align-items: flex-start; max-width: 300px; padding: 12px 34px 12px 12px; border-radius: 18px 18px 6px 18px; background: #fff; color: var(--murekkep); text-align: left; box-shadow: var(--shadow-lg), 0 0 0 1px rgba(7,62,70,.06); cursor: pointer; pointer-events: auto; animation: cdPeek .45s var(--ease) both; }
.cd-peek[hidden] { display: none; }
.cd-peek .ac-av { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--petrol-700), var(--petrol)); }
.cd-peek .ac-av img { width: 18px; height: 18px; object-fit: contain; }
.cd-peek b { display: block; font: 700 .82rem var(--font-head); color: var(--petrol); }
.cd-peek span span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .84rem; line-height: 1.4; }
.cd-peek-x { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--soluk); }
.cd-peek-x:hover { background: var(--nane-50); color: var(--petrol); }
.cd-peek-x .icon { width: 13px; height: 13px; }
@keyframes cdPeek { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* telefonda sohbet tam ekran açılır; düğme ve önizleme gizlenir */
@media (max-width: 600px) {
  .assist.open.chatting { inset: 0; right: 0; bottom: 0; z-index: 160; } /* üst menünün (100) ve çekmecenin (150) üstünde */
  .assist.open.chatting .assist-fab { display: none; }
  .assist-panel.chatting { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
  .ac-compose textarea { font-size: 16px; } /* iOS odakta yakınlaştırmasın */
  .ac-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .ac-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .ap-live::after, .cd-dot::after, .ac-dots i { animation: none; }
  .ac-log { scroll-behavior: auto; }
}
