/* Yukarı çık, WhatsApp (solda), Canlı destek (sağda) */

.floating-actions__btn--left {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 9998;
}

@media (max-width: 480px) {
  .floating-actions__btn--left {
    bottom: 1rem;
    left: 1rem;
  }
}

.floating-actions {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

@media (max-width: 480px) {
  .floating-actions {
    bottom: 1rem;
    right: 1rem;
  }
}

.floating-actions__btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: #fff;
}

.floating-actions__btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.floating-actions__btn:focus {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.floating-actions__btn--top {
  background: #374151;
  display: none;
}

.floating-actions__btn--top.is-visible {
  display: flex;
}

.floating-actions__btn--wa {
  background: #25d366;
}

.floating-actions__btn--chat {
  background: #111;
}

/* Live chat panel */
.live-chat-panel {
  position: fixed;
  bottom: 6rem;
  right: 1.25rem;
  width: 360px;
  max-width: calc(100vw - 2rem);
  max-height: 480px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s, visibility 0.25s, transform 0.25s;
}

.live-chat-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (max-width: 480px) {
  .live-chat-panel {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    max-height: 85vh;
    min-height: 50vh;
    height: 85vh;
    border-radius: 20px 20px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s ease-out;
  }
  .live-chat-panel.is-open {
    transform: translateY(0);
  }
  /* Klavye açıldığında: panel yüksekliği görünür alana sığsın; min yükseklik ile sohbet tam görünsün */
  .live-chat-panel--keyboard {
    top: auto !important;
    bottom: 0 !important;
    height: var(--live-chat-viewport-height, 85vh) !important;
    max-height: none !important;
    min-height: 55vh !important;
    transition: height 0.15s ease-out;
  }
  .live-chat-panel__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  .live-chat-panel__messages {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .live-chat-panel__input-wrap {
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
}

.live-chat-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  background: #111;
  color: #fff;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .live-chat-panel__header {
    padding: 1rem 1rem 1rem 1.25rem;
    min-height: 52px;
  }
}

.live-chat-panel__title {
  font-weight: 600;
  font-size: 1rem;
}

.live-chat-panel__close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  padding: 0;
}

@media (max-width: 480px) {
  .live-chat-panel__close {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
  }
}

.live-chat-panel__close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.live-chat-panel__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1rem;
  overflow: hidden;
  background: #f8fafc;
}

@media (max-width: 480px) {
  .live-chat-panel__body {
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0));
  }
}

/* Mesaj balonları: AI solda, kullanıcı sağda (panel AI Destek ile aynı stil) */
.live-chat-panel__messages {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.live-chat-panel__message {
  padding: 12px 16px;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  font-size: 0.9375rem;
  line-height: 1.5;
  max-width: 85%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.live-chat-panel__message--bot {
  background: #fff;
  color: #1e293b;
  align-self: flex-start;
}

.live-chat-panel__message--welcome {
  background: #fff;
  color: #1e293b;
}

.live-chat-panel__message--loading {
  font-style: italic;
  color: #94a3b8;
  background: #f8fafc;
}

.live-chat-panel__message--links {
  padding: 8px 16px 12px;
  background: #f8fafc;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.live-chat-panel__links-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 6px;
}

.live-chat-panel__links-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.live-chat-panel__link {
  font-size: 0.875rem;
  color: #2563eb;
  text-decoration: none;
}

.live-chat-panel__link:hover {
  text-decoration: underline;
}

.live-chat-panel__message--user {
  background: #111;
  color: #fff;
  align-self: flex-end;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 4px;
  margin-left: 0;
}

.live-chat-panel__wa-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.875rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #25d366;
  border: none;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.2s;
  flex-shrink: 0;
}

.live-chat-panel__wa-cta:hover {
  background: #20bd5a;
  color: #fff;
}

.live-chat-panel__wa-cta svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.live-chat-panel__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.live-chat-panel__messages .live-chat-panel__message {
  margin-bottom: 0;
}

/* Hazır mesajlar – ince, normal mesaj kutusu gibi pill */
.live-chat-panel__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
  flex-shrink: 0;
}

.live-chat-panel__quick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.35;
  color: #475569;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.live-chat-panel__quick-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #cbd5e1;
}

.live-chat-panel__quick-btn:active {
  transform: scale(0.98);
}

@media (max-width: 480px) {
  .live-chat-panel__quick {
    flex-direction: column;
  }
  .live-chat-panel__quick-btn {
    width: 100%;
  }
}

.live-chat-panel__quick.is-hidden {
  display: none;
}

.live-chat-panel__input-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
  flex-shrink: 0;
}

.live-chat-panel__input-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  margin: 0;
}

.live-chat-panel__input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.live-chat-panel__input {
  flex: 1;
  padding: 0.625rem 0.75rem;
  font-size: 0.9375rem;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  min-width: 0;
  resize: none;
  font-family: inherit;
  line-height: 1.4;
}

.live-chat-panel__input--textarea {
  min-height: 48px;
  max-height: 120px;
  overflow-y: auto;
}

@media (max-width: 480px) {
  .live-chat-panel__input {
    min-height: 44px;
    font-size: 16px;
  }
  .live-chat-panel__input--textarea {
    min-height: 44px;
  }
}

.live-chat-panel__input:focus {
  outline: none;
  border-color: #111;
}

.live-chat-panel__send {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

@media (max-width: 480px) {
  .live-chat-panel__send {
    min-height: 44px;
    min-width: 52px;
    padding: 0.75rem 1rem;
    -webkit-tap-highlight-color: transparent;
  }
}

.live-chat-panel__send:hover {
  background: #333;
  transform: scale(1.05);
}

.live-chat-panel__copy-btn {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: #6b7280;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.live-chat-panel__copy-btn:hover {
  background: #f9fafb;
  border-color: #111;
  color: #111;
}

@media (max-width: 480px) {
  .live-chat-panel__copy-btn {
    min-height: 44px;
    font-size: 0.875rem;
    -webkit-tap-highlight-color: transparent;
  }
  .live-chat-panel__message {
    font-size: 0.9375rem;
    padding: 0.875rem 1rem;
    max-width: 92%;
  }
}

/* Hamburger menü açıkken (mobil): WhatsApp + canlı destek / yukarı çık + live chat paneli gizle */
@media (max-width: 767px) {
  body.mobile-menu-open a.floating-actions__btn--left,
  body.mobile-menu-open .floating-actions__btn--left,
  body.mobile-menu-open #floating-actions {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
  }
  body.mobile-menu-open .live-chat-panel {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: -1 !important;
  }
}

/* Ürünler sayfası filtre paneli açıkken (mobil): WhatsApp + canlı destek / yukarı çık + live chat gizle */
@media (max-width: 959px) {
  body.products-filter-open a.floating-actions__btn--left,
  body.products-filter-open .floating-actions__btn--left,
  body.products-filter-open #floating-actions {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
  }
  body.products-filter-open .live-chat-panel {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: -1 !important;
  }
}

/* Kayıt sayfası sözleşme popup açıkken: WhatsApp + yukarı çık + live chat gizle (tüm ekranlar) */
body.register-popup-open a.floating-actions__btn--left,
body.register-popup-open .floating-actions__btn--left,
body.register-popup-open #floating-actions {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -1 !important;
}
body.register-popup-open .live-chat-panel {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: -1 !important;
}

/* Checkout sözleşme popup açıkken: WhatsApp + yukarı çık + live chat gizle */
body.checkout-terms-popup-open a.floating-actions__btn--left,
body.checkout-terms-popup-open .floating-actions__btn--left,
body.checkout-terms-popup-open #floating-actions {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -1 !important;
}
body.checkout-terms-popup-open .live-chat-panel {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: -1 !important;
}
