/* ==========================================================================
   Canlı destek — ziyaretçi penceresi (.mfc-*) ve temsilci ekranı (.dsk-*)
   ========================================================================== */

/* ---------- Ziyaretçi: açma düğmesi ---------- */
.mfc { position: fixed; right: 16px; bottom: 84px; z-index: 58; }
@media (min-width: 1024px) { .mfc { right: 24px; bottom: 24px; } }
.mfc-launch { position: relative; width: 58px; height: 58px; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--brand), var(--navy-900)); box-shadow: 0 14px 30px -10px rgba(var(--navy-950-rgb, 12, 30, 54), .6), 0 0 0 4px rgba(255, 255, 255, .7); transition: transform .25s; }
.mfc-launch:hover { transform: scale(1.06); }
.mfc-launch > .ic { transition: transform .25s, opacity .2s; }
.mfc-launch-x { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transform: rotate(-90deg); transition: transform .25s, opacity .2s; }
.mfc.is-open .mfc-launch > .ic { opacity: 0; transform: rotate(90deg); }
.mfc.is-open .mfc-launch-x { opacity: 1; transform: none; }
.mfc-badge { position: absolute; top: -2px; right: -2px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #e5484d; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 3px #fff; }

/* ---------- Ziyaretçi: pencere ---------- */
.mfc-panel { position: absolute; right: 0; bottom: 72px; width: 380px; height: min(620px, calc(100vh - 140px)); display: flex; flex-direction: column; overflow: hidden;
  border-radius: 22px; background: #fff; box-shadow: 0 30px 70px -20px rgba(12, 30, 54, .45), 0 0 0 1px rgba(12, 30, 54, .06); animation: mfc-in .22s ease-out; }
@keyframes mfc-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.mfc-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 14px 16px; color: #fff; background: linear-gradient(135deg, var(--navy-800, #1b3a60), var(--navy-950, #0c1e36)); }
.mfc-avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .12); flex: none; }
.mfc-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mfc-head-text b { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.mfc-status { font-size: 12px; color: rgba(255, 255, 255, .72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mfc-status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #9aa6b2; vertical-align: 1px; }
.mfc-status.is-on::before { background: #3fd07f; box-shadow: 0 0 0 3px rgba(63, 208, 127, .25); }
.mfc-icon-btn { width: 36px; height: 36px; flex: none; border: 0; border-radius: 10px; display: grid; place-items: center; background: transparent; color: inherit; cursor: pointer; }
.mfc-icon-btn:hover { background: rgba(255, 255, 255, .12); }
.mfc-foot .mfc-icon-btn { color: var(--muted); }
.mfc-foot .mfc-icon-btn:hover { background: var(--bg); color: var(--brand-600); }
.mfc-ic { display: inline-grid; place-items: center; }
.mfc-menu-wrap { position: relative; }
.mfc-menu { position: absolute; right: 0; top: 42px; z-index: 5; min-width: 230px; padding: 6px; border-radius: 14px; background: #fff; box-shadow: 0 16px 40px -12px rgba(12, 30, 54, .35), 0 0 0 1px var(--line); }
.mfc-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; text-align: left; cursor: pointer; }
.mfc-menu-item:hover { background: var(--bg); }

.mfc-body { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); overscroll-behavior: contain; }
.mfc-row { display: flex; }
.mfc-row.is-me { justify-content: flex-end; }
.mfc-bubble { max-width: 82%; padding: 9px 12px 6px; border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgba(12, 30, 54, .06), 0 0 0 1px rgba(12, 30, 54, .05); font-size: 14px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.mfc-row.is-them .mfc-bubble { border-bottom-left-radius: 6px; }
.mfc-row.is-me .mfc-bubble { border-bottom-right-radius: 6px; background: var(--brand-600, #2b5d98); color: #fff; box-shadow: none; }
.mfc-row.is-pending { opacity: .6; }
.mfc-bubble p { margin: 0; white-space: pre-wrap; }
.mfc-bubble a { color: inherit; text-decoration: underline; }
.mfc-who { display: block; font-size: 11.5px; font-weight: 700; color: var(--brand-600); margin-bottom: 2px; }
.mfc-time { display: block; margin-top: 2px; font-size: 10.5px; opacity: .6; text-align: right; }
.mfc-img { display: block; margin: 2px -4px 4px; }
.mfc-img img { display: block; max-width: 100%; max-height: 240px; border-radius: 10px; }
.mfc-file { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; font-weight: 600; font-size: 13px; }
.mfc-sys { align-self: center; max-width: 90%; padding: 4px 10px; border-radius: 999px; background: rgba(12, 30, 54, .06); color: var(--muted); font-size: 11.5px; text-align: center; }
.mfc-topic { margin-bottom: 4px; }
.mfc-wait { align-self: stretch; padding: 10px 12px; border-radius: 12px; background: #fff7e6; color: #8a5a00; font-size: 12.5px; line-height: 1.5; box-shadow: 0 0 0 1px #f3e2bd; }
.mfc-notice { align-self: center; padding: 8px 12px; border-radius: 10px; background: #e8f0fb; color: var(--navy-800); font-size: 12.5px; }
.mfc-notice.is-danger { background: var(--danger-bg); color: var(--danger); }
.mfc-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.mfc-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aa6b2; animation: mfc-dot 1s infinite; }
.mfc-typing i:nth-child(2) { animation-delay: .15s; }
.mfc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes mfc-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

.mfc-start { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; padding: 14px; border-radius: 16px; background: #fff; box-shadow: 0 0 0 1px rgba(12, 30, 54, .06); }
.mfc-hello { margin: 0 0 2px; font-size: 13px; color: var(--muted); }
.mfc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mfc-input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; font-size: 14px; color: var(--ink); resize: none; }
.mfc-input:focus { outline: none; border-color: var(--brand-300, #8fb3dc); box-shadow: 0 0 0 3px rgba(53, 110, 175, .15); }
.mfc-hint { color: var(--muted-2, #93a3b5); font-size: 11.5px; line-height: 1.45; }
.mfc-err { margin: 0; color: var(--danger); font-size: 12.5px; font-weight: 600; }
.mfc-send-wide { padding: 11px 14px; border: 0; border-radius: 12px; background: var(--brand-600, #2b5d98); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.mfc-send-wide:disabled { opacity: .6; }
.mfc-wa { display: inline-flex; align-self: center; align-items: center; gap: 8px; margin-top: 4px; padding: 8px 14px; border-radius: 999px; background: #e8f9ef; color: #128c4b; font-size: 13px; font-weight: 700; }

.mfc-foot { border-top: 1px solid var(--line); background: #fff; }
.mfc-foot:empty { display: none; }
.mfc-compose { display: flex; align-items: flex-end; gap: 6px; padding: 10px; }
.mfc-compose .mfc-input { flex: 1; min-height: 42px; max-height: 120px; border-radius: 14px; }
.mfc-send { width: 42px; height: 42px; flex: none; border: 0; border-radius: 12px; display: grid; place-items: center; background: var(--brand-600, #2b5d98); color: #fff; cursor: pointer; }
.mfc-send:disabled { opacity: .5; }

.mfc-closed { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 8px; padding: 16px; border-radius: 16px; background: #fff; text-align: center; box-shadow: 0 0 0 1px rgba(12, 30, 54, .06); }
.mfc-closed p { margin: 0; font-size: 13px; color: var(--muted); }
.mfc-stars { display: flex; gap: 4px; }
.mfc-star { width: 38px; height: 38px; border: 0; border-radius: 10px; background: var(--bg); color: #c3ccd6; cursor: pointer; display: grid; place-items: center; }
.mfc-star.on { color: #f5a524; background: #fff6e0; }
.mfc-star.on svg { fill: currentColor; }
.mfc-link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--brand-600); font: inherit; font-weight: 700; cursor: pointer; }

@media (max-width: 639px) {
  .mfc { right: 14px; bottom: calc(92px + env(safe-area-inset-bottom)); }
  .mfc-launch { width: 52px; height: 52px; }
  .mfc.is-open { inset: 0; right: 0; bottom: 0; z-index: 80; }
  .mfc.is-open .mfc-launch { display: none; }
  .mfc-panel { position: fixed; inset: 0; width: auto; height: 100%; height: 100dvh; border-radius: 0; bottom: 0; }
  .mfc-head { padding-top: calc(14px + env(safe-area-inset-top)); }
  .mfc-compose { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  html.mfc-lock, html.mfc-lock body { overflow: hidden; }
}
@media print { .mfc { display: none !important; } }

/* ==========================================================================
   Temsilci ekranı (/panel/destek)
   ========================================================================== */
.dsk { display: grid; grid-template-columns: 320px minmax(0, 1fr) 320px; gap: 0; height: calc(100vh - 170px); min-height: 560px; border-radius: 20px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.dsk-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.dsk-list { border-right: 1px solid var(--line); }
.dsk-info { border-left: 1px solid var(--line); overflow-y: auto; background: #fbfcfe; }
.dsk-tabs { display: flex; gap: 4px; padding: 10px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.dsk-tabs button { flex: none; padding: 7px 10px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.dsk-tabs button.on { background: var(--navy-900); color: #fff; }
.dsk-tabs button b { margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: rgba(229, 72, 77, .15); color: #c2413b; font-size: 11px; }
.dsk-tabs button.on b { background: rgba(255, 255, 255, .2); color: #fff; }
.dsk-search { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.dsk-search input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 13px; }
.dsk-threads { flex: 1; overflow-y: auto; }
.dsk-item { display: block; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font: inherit; cursor: pointer; }
.dsk-item:hover { background: var(--bg); }
.dsk-item.on { background: #eaf1fb; box-shadow: inset 3px 0 0 var(--brand); }
.dsk-item-top { display: flex; align-items: center; gap: 6px; }
.dsk-item-top b { flex: 1; min-width: 0; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsk-item-top time { font-size: 11px; color: var(--muted); flex: none; }
.dsk-item p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsk-item .dsk-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.dsk-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.dsk-empty { padding: 30px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.dsk-me { display: flex; align-items: center; gap: 8px; padding: 10px; border-top: 1px solid var(--line); font-size: 12.5px; }
.dsk-me select { flex: 1; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 12.5px; }
.dsk-dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa6b2; flex: none; }
.dsk-dot.cevrimici { background: #2fbf71; box-shadow: 0 0 0 3px rgba(47, 191, 113, .2); }
.dsk-dot.mesgul { background: #f5a524; }

.dsk-chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dsk-chat-head .grow { min-width: 0; }
.dsk-chat-head h2 { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsk-chat-head small { color: var(--muted); font-size: 12px; }
.dsk-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dsk-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.dsk-msgs .mfc-row.is-me .mfc-bubble { background: var(--navy-800, #1b3a60); }
.dsk-note .mfc-bubble { background: #fff8db !important; color: #6b5200 !important; box-shadow: 0 0 0 1px #f1dd8f !important; }
.dsk-note .mfc-who { color: #8a6d00; }
.dsk-compose { border-top: 1px solid var(--line); padding: 10px 12px; background: #fff; }
.dsk-compose.is-note { background: #fffbea; }
.dsk-compose-row { display: flex; align-items: flex-end; gap: 6px; }
.dsk-compose textarea { flex: 1; min-height: 44px; max-height: 160px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font: inherit; font-size: 14px; resize: none; }
.dsk-compose-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; flex-wrap: wrap; }
.dsk-compose-tools label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; cursor: pointer; }
.dsk-compose-tools select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 12.5px; max-width: 220px; }
.dsk-canned-pop { position: absolute; bottom: 100%; left: 0; right: 0; max-height: 220px; overflow-y: auto; margin-bottom: 6px; padding: 6px; border-radius: 12px; background: #fff; box-shadow: 0 12px 30px -10px rgba(12, 30, 54, .35), 0 0 0 1px var(--line); }
.dsk-canned-pop button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; font: inherit; font-size: 13px; cursor: pointer; }
.dsk-canned-pop button:hover, .dsk-canned-pop button.on { background: var(--bg); }
.dsk-canned-pop code { color: var(--brand-600); margin-right: 6px; }
.dsk-placeholder { flex: 1; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); text-align: center; padding: 30px; }

.dsk-info-sec { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.dsk-info-sec h3 { margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.dsk-info-sec dl { display: grid; grid-template-columns: 96px 1fr; gap: 5px 8px; margin: 0; }
.dsk-info-sec dt { color: var(--muted); }
.dsk-info-sec dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.dsk-info-sec ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dsk-info-sec li { display: flex; justify-content: space-between; gap: 8px; }
.dsk-info-sec li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsk-info-sec li small { color: var(--muted); flex: none; }
.dsk-who { display: flex; align-items: center; gap: 10px; }
.dsk-who .avatar { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--navy-900); color: #fff; font-weight: 700; }
.dsk-who b { display: block; font-size: 15px; }
.dsk-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.dsk-kpis div { padding: 8px; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px var(--line); text-align: center; }
.dsk-kpis b { display: block; font-size: 16px; }
.dsk-kpis small { color: var(--muted); font-size: 11px; }
.dsk-back { display: none; }

@media (max-width: 1279px) { .dsk { grid-template-columns: 290px minmax(0, 1fr); } .dsk-info { display: none; } .dsk.show-info .dsk-info { display: flex; position: fixed; inset: 0 0 0 auto; width: min(360px, 92vw); z-index: 90; box-shadow: -20px 0 40px -20px rgba(0, 0, 0, .35); } .dsk-info-toggle { display: inline-flex !important; } }
@media (max-width: 899px) {
  .dsk { grid-template-columns: 1fr; height: calc(100vh - 150px); }
  .dsk:not(.has-chat) .dsk-chat { display: none; }
  .dsk.has-chat .dsk-list { display: none; }
  .dsk-back { display: inline-grid; }
}
.dsk-info-toggle { display: none !important; }
.mfc-avatar.is-agent { background: #fff; color: var(--navy-900); font-weight: 800; font-size: 16px; }
.dsk-msgs .mfc-row.is-me:not(.dsk-note) .mfc-who { color: rgba(255, 255, 255, .72); }
@media (max-width: 899px) { .dsk-stats { display: none; } }
