/**
 * Saha asistanı — kırmızı-siyah balon; sosyal çubuğun solunda durur.
 */

.cs-chat-fab {
  position: fixed;
  left: 16px;
  bottom: 18px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 16px 0 14px;
  border: 0;
  border-radius: 999px;
  background: #d6001c;
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(214, 0, 28, 0.38);
  cursor: pointer;
}

.cs-chat-fab:hover,
.cs-chat-fab:focus-visible {
  background: #ff1a38;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.cs-chat-fab.is-open {
  opacity: 0;
  pointer-events: none;
}

.cs-chat-fab svg {
  display: block;
}

.cs-chat {
  position: fixed;
  left: 16px;
  bottom: 18px;
  z-index: 41;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 36px));
  border-radius: 20px;
  background: #1a060b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.cs-chat[hidden] {
  display: none;
}

.cs-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  background: #2a0b12;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cs-chat-who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cs-chat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3dcc7a;
  box-shadow: 0 0 0 4px rgba(61, 204, 122, 0.18);
  flex-shrink: 0;
}

.cs-chat-who strong {
  display: block;
  font-size: 0.92rem;
}

.cs-chat-who p {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
}

.cs-chat-x {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.cs-chat-x:hover {
  background: rgba(255, 255, 255, 0.08);
}

.cs-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cs-chat-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.cs-chat-msg--bot {
  align-self: flex-start;
  background: #2a0b12;
  color: #fff;
}

.cs-chat-msg--user {
  align-self: flex-end;
  background: #d6001c;
  color: #fff;
}

.cs-chat-msg p {
  margin: 0 0 0.6em;
}

.cs-chat-msg p:last-child {
  margin-bottom: 0;
}

.cs-chat-msg a {
  color: #ffb3bd;
  text-decoration: underline;
}

.cs-chat-msg--user a {
  color: #fff;
}

.cs-chat-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.cs-chat-links a {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(214, 0, 28, 0.22);
  color: #fff;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
}

.cs-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cs-chat-chips button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: #140308;
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
}

.cs-chat-chips button:hover {
  border-color: #d6001c;
  background: #2a0b12;
}

.cs-chat-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-height: 1.2em;
}

.cs-chat-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  animation: cs-chat-blink 1s infinite;
}

.cs-chat-typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.cs-chat-typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes cs-chat-blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

.cs-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.cs-chat-form input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: #140308;
  color: #fff;
  font: inherit;
}

.cs-chat-form input:focus {
  outline: 2px solid #d6001c;
  outline-offset: 0;
}

.cs-chat-form button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: #d6001c;
  color: #fff;
  cursor: pointer;
}

.cs-chat-form button:hover {
  background: #ff1a38;
}

.cs-chat-note {
  margin: 0;
  padding: 4px 14px 10px;
  font-size: 0.68rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.38);
}

@media (max-width: 760px) {
  .cs-chat-fab {
    bottom: 78px;
  }

  .cs-chat {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    height: min(70vh, 560px);
  }

  .lib-credit,
  .lib-foot {
    padding-bottom: 132px;
  }
}
