.nbs-chat-bubble {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  right: calc(20px + env(safe-area-inset-right));
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--wine, #8a2846), var(--gold, #c9a15a));
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(28, 21, 18, 0.35);
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nbs-chat-bubble:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 26px rgba(138, 40, 70, 0.4);
}

.nbs-chat-bubble.nbs-hidden {
  display: none;
}

/* Panel, ikonla aynı sağ-alt köşede sabit kalır — kesin, küçük bir kutu.
   Viewport'a göre esneyen bir yükseklik/genişlik YOK (100vw/100vh yok);
   sadece iki sabit boyut seti var: masaüstü ve mobil. */
.nbs-chat-panel {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  right: calc(20px + env(safe-area-inset-right));
  background: var(--ivory, #f7f1ec);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(28, 21, 18, 0.3);
  border: 1px solid rgba(201, 161, 90, 0.35);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif);
}

.nbs-chat-panel.nbs-open {
  display: flex;
}

@media (min-width: 768px) {
  .nbs-chat-panel {
    width: 360px;
    height: 500px;
  }
}

@media (max-width: 767px) {
  .nbs-chat-panel {
    width: calc(100vw - 32px);
    max-width: 380px;
    height: 480px;
    /* Sadece bir üst sınır: klavye kapalıyken hiç devreye girmez (panel
       tam 480px kalır), klavye açılıp görünür alan daralınca panel
       gerekirse küçülüp başlık/mesaj alanının görünür kalmasını sağlar. */
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
  }
}

.nbs-chat-header {
  background: linear-gradient(120deg, var(--wine, #8a2846), var(--wine-dark, #6d1e37));
  color: #fdf6ef;
  padding: 16px 18px;
  font-weight: 700;
  font-family: var(--font-display, serif);
  letter-spacing: 0.02em;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nbs-chat-close {
  flex: none;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fdf6ef;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.nbs-chat-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.nbs-chat-messages {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--ivory, #f7f1ec);
}

.nbs-msg {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.nbs-msg-user {
  align-self: flex-end;
  background: var(--wine, #8a2846);
  color: #fff;
  border-bottom-right-radius: 3px;
}

.nbs-msg-bot {
  align-self: flex-start;
  background: #fff;
  color: #2a201c;
  border: 1px solid rgba(201, 161, 90, 0.3);
  border-bottom-left-radius: 3px;
}

.nbs-msg-error {
  align-self: flex-start;
  background: #fdeaea;
  color: #a33;
  border-bottom-left-radius: 3px;
}

.nbs-chat-input-row {
  display: flex;
  border-top: 1px solid rgba(201, 161, 90, 0.3);
  padding: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  gap: 6px;
  background: #fffdfb;
}

.nbs-chat-input-row input {
  flex: 1;
  border: 1px solid rgba(28, 21, 18, 0.15);
  border-radius: 10px;
  padding: 9px 12px;
  /* 16px altı font boyutu iOS Safari'de input'a dokununca sayfayı
     otomatik yakınlaştırır (zoom) — bu değer o eşiğin altına inmemeli. */
  font-size: 16px;
  outline: none;
  font-family: inherit;
}

.nbs-chat-input-row input:focus {
  border-color: var(--gold, #c9a15a);
}

.nbs-chat-input-row button {
  background: var(--wine, #8a2846);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.nbs-chat-input-row button:hover:not(:disabled) {
  background: var(--wine-dark, #6d1e37);
}

.nbs-chat-input-row button:disabled {
  opacity: 0.6;
  cursor: default;
}
