/* ===== Stant görevlisi baloncuğu + chatbot ===== */

.pk-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.pk-chat-labels {
  overflow: hidden;
}

.pk-chat-bubble {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  transform: translate(-50%, -100%);
  opacity: 0;
  transition: opacity 0.2s ease;
  filter: drop-shadow(0 8px 18px rgba(8, 20, 32, 0.35));
  pointer-events: none;
}

.pk-chat-bubble.is-near {
  opacity: 1;
  pointer-events: auto;
}

.pk-chat-bubble-main {
  position: relative;
  max-width: 220px;
  padding: 10px 14px 12px;
  border: 0;
  border-radius: 16px 16px 16px 4px;
  background: #fff;
  color: #16324a;
  font: 600 13px/1.35 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
  text-align: left;
}

.pk-chat-bubble-main:hover {
  background: #f3f8fc;
}

.pk-chat-bubble-tail {
  position: absolute;
  left: 14px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: #fff;
  transform: rotate(45deg);
  border-radius: 2px;
}

.pk-chat-fab {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.pk-chat-fab-chat {
  background: linear-gradient(160deg, #2b7bb8, #185a8c);
}

.pk-chat-fab:hover {
  filter: brightness(1.1);
  transform: scale(1.04);
}

/* ---------- Panel ---------- */
.pk-chat-panel {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: none;
}

.pk-chat-panel.open {
  display: block;
}

.pk-chat-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 28, 0.45);
}

.pk-chat-sheet {
  position: absolute;
  right: 16px;
  bottom: 16px;
  top: auto;
  width: min(400px, calc(100vw - 24px));
  height: min(620px, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  background: var(--pk-ui-bg-solid, #1a1d22);
  color: var(--pk-ui-text, #fff);
  border: 2px solid var(--pk-ui-border, #e30613);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--pk-ui-shadow, 0 22px 60px rgba(0, 0, 0, 0.35));
}

.pk-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(227, 6, 19, 0.16);
  color: #f4f9fc;
  border-bottom: 1px solid rgba(227, 6, 19, 0.45);
}

.pk-chat-head-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  display: grid;
  place-items: center;
}

.pk-chat-head-icon--ai {
  background: linear-gradient(145deg, #7b5cf0, #3d2a9e);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.pk-chat-head-text {
  flex: 1;
  min-width: 0;
}

.pk-chat-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.pk-chat-uni {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pk-chat-close {
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.pk-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(227, 6, 19, 0.25);
}

.pk-chat-chip {
  border: 1px solid rgba(227, 6, 19, 0.45);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.pk-chat-chip:hover {
  border-color: #e30613;
  color: #fff;
  filter: brightness(1.08);
}

.pk-chat-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.pk-chat-msg {
  display: flex;
  max-width: 92%;
}

.pk-chat-msg-user {
  align-self: flex-end;
}

.pk-chat-msg-assistant {
  align-self: flex-start;
}

.pk-chat-msg-bubble {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.pk-chat-msg-user .pk-chat-msg-bubble {
  background: #1a6b4a;
  color: #f4fff8;
  border-bottom-right-radius: 4px;
}

.pk-chat-msg-assistant .pk-chat-msg-bubble {
  background: #fff;
  color: #1a2a38;
  border: 1px solid #d7e1ea;
  border-bottom-left-radius: 4px;
}

.pk-chat-typing .pk-chat-msg-bubble {
  display: flex;
  gap: 5px;
  align-items: center;
  min-height: 18px;
}

.pk-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8aa0b2;
  animation: pk-chat-dot 1s infinite ease-in-out;
}

.pk-chat-typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.pk-chat-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pk-chat-dot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.pk-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid rgba(227, 6, 19, 0.35);
}

.pk-chat-form input {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
}

.pk-chat-send {
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  background: #e30613;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.pk-chat-send:disabled {
  opacity: 0.5;
  cursor: default;
}

body.pk-chat-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .pk-chat-panel {
    z-index: 80;
  }

  .pk-chat-sheet {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: min(88dvh, 720px);
    max-height: 100dvh;
    border-radius: 16px 16px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .pk-chat-head {
    padding: 12px 12px;
  }

  .pk-chat-close {
    width: 40px;
    height: 40px;
  }

  .pk-chat-suggestions {
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(227, 6, 19, 0.25);
  }

  .pk-chat-chip {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(227, 6, 19, 0.45);
    color: #fff;
    min-height: 36px;
    padding: 8px 12px;
  }

  .pk-chat-form input {
    font-size: 16px;
    min-height: 44px;
  }

  .pk-chat-send {
    min-width: 72px;
    min-height: 44px;
  }

  .pk-chat-bubble-main {
    max-width: 170px;
    font-size: 12px;
    padding: 8px 11px 10px;
  }

  .pk-chat-fab {
    width: 44px;
    height: 44px;
    min-width: 0;
  }
}
