/* Sabit iletişim FAB + panel (feed & forum) */
.bb-contact-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  font-family: 'DM Sans', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

.bb-contact-widget * {
  box-sizing: border-box;
}

.bb-contact-panel {
  width: min(296px, calc(100vw - 28px));
  max-height: min(82vh, 560px);
  background: var(--card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 20px;
  box-shadow: 0 20px 56px rgba(15, 23, 42, 0.18), 0 4px 16px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  opacity: 0;
  transform: scale(0.88) translateY(8px);
  visibility: hidden;
  transition:
    opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.28s;
}

.bb-contact-widget.is-open .bb-contact-panel {
  opacity: 1;
  transform: scale(1) translateY(0);
  visibility: visible;
}

html.dark .bb-contact-panel {
  background: #131828;
  border-color: #1e2d4a;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.bb-contact-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 0.95rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

html.dark .bb-contact-panel-head {
  border-bottom-color: #1e2d4a;
}

.bb-contact-panel-title {
  font-family: 'Instrument Serif', serif;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text, #0f172a);
  line-height: 1.25;
  margin: 0;
}

.bb-contact-panel-sub {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  margin-top: 4px;
  font-weight: 300;
  line-height: 1.4;
}

.bb-contact-panel-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--gray-100, #f1f5f9);
  color: var(--gray-500, #64748b);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.bb-contact-panel-close:hover {
  background: var(--gray-200, #e2e8f0);
  color: var(--text, #0f172a);
}

html.dark .bb-contact-panel-close {
  background: #1a2236;
  color: #94a3b8;
}

html.dark .bb-contact-panel-close:hover {
  background: #243552;
  color: #f1f5ff;
}

.bb-contact-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.bb-contact-view {
  position: relative;
  height: 100%;
  overflow-y: auto;
}

.bb-contact-form {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Anket katmanı — iletişim panelinin üstünde */
.bb-contact-survey-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: var(--card, #fff);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition:
    opacity 0.26s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.26s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.26s;
  pointer-events: none;
}

html.dark .bb-contact-survey-layer {
  background: #131828;
}

.bb-contact-widget.is-survey-open .bb-contact-survey-layer {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.bb-survey-inner {
  padding: 0.75rem 1rem 1rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.bb-survey-back {
  border: none;
  background: transparent;
  color: var(--blue-600, #2563eb);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0 0 0.65rem;
  cursor: pointer;
  text-align: left;
  transition: opacity 0.15s;
}

.bb-survey-back:hover {
  opacity: 0.8;
}

html.dark .bb-survey-back {
  color: var(--blue-400, #60a5fa);
}

.bb-survey-title {
  font-family: 'Instrument Serif', serif;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text, #0f172a);
  margin: 0 0 0.25rem;
}

.bb-survey-intro {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  margin: 0 0 1rem;
  line-height: 1.45;
  font-weight: 300;
}

.bb-survey-questions {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-bottom: 1rem;
}

.bb-survey-q-text {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text, #0f172a);
  margin: 0 0 0.55rem;
  line-height: 1.4;
}

.bb-survey-scale {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bb-survey-scale-hint {
  font-size: 0.7rem;
  color: var(--muted, #64748b);
  width: 14px;
  flex-shrink: 0;
  text-align: center;
}

.bb-scale-btn {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: var(--gray-50, #f8faff);
  color: var(--gray-700, #334155);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s,
    transform 0.12s,
    box-shadow 0.15s;
}

.bb-scale-btn:hover {
  border-color: var(--blue-400, #60a5fa);
  background: var(--blue-50, #eff6ff);
  color: var(--blue-700, #1d4ed8);
}

.bb-scale-btn.is-selected {
  background: linear-gradient(145deg, var(--blue-500, #3b82f6), var(--blue-700, #1d4ed8));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

html.dark .bb-scale-btn {
  background: #0c0f1a;
  border-color: #1e2d4a;
  color: #cbd5e1;
}

html.dark .bb-scale-btn:hover {
  background: rgba(37, 99, 235, 0.15);
  border-color: var(--blue-400, #60a5fa);
  color: #93c5fd;
}

html.dark .bb-scale-btn.is-selected {
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  color: #fff;
}

.bb-survey-scale-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 0.68rem;
  color: var(--muted, #64748b);
  font-weight: 300;
}

.bb-survey-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.bb-survey-submit:disabled:hover {
  opacity: 0.45;
  transform: none;
}

.bb-survey-status {
  font-size: 0.78rem;
  min-height: 1.1rem;
  margin: -0.35rem 0 0.65rem;
  line-height: 1.4;
}

.bb-survey-status--success {
  color: #059669;
}

.bb-survey-status--error {
  color: #dc2626;
}

html.dark .bb-survey-status--success {
  color: #34d399;
}

html.dark .bb-survey-status--error {
  color: #f87171;
}

/* Yeniden başlat onayı */
.bb-survey-confirm {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 0 0 18px 18px;
  padding: 1.25rem 1.15rem;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  text-align: center;
}

html.dark .bb-survey-confirm {
  background: rgba(19, 24, 40, 0.98);
}

.bb-survey-confirm[aria-hidden='false'] {
  display: flex;
}

.bb-survey-confirm-text {
  font-size: 0.86rem;
  color: var(--text, #0f172a);
  line-height: 1.5;
  margin: 0 0 1rem;
}

.bb-survey-confirm-actions {
  display: flex;
  gap: 8px;
}

.bb-survey-confirm-no,
.bb-survey-confirm-yes {
  flex: 1;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border, #e2e8f0);
  transition: background 0.15s;
}

.bb-survey-confirm-no {
  background: var(--gray-50, #f8faff);
  color: var(--gray-700, #334155);
}

.bb-survey-confirm-yes {
  background: linear-gradient(135deg, var(--blue-600, #2563eb), var(--blue-700, #1d4ed8));
  border-color: transparent;
  color: #fff;
}

.bb-survey-confirm-no:hover {
  background: var(--gray-100, #f1f5f9);
}

html.dark .bb-survey-confirm-no {
  background: #1a2236;
  border-color: #1e2d4a;
  color: #cbd5e1;
}

.bb-contact-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gray-700, #334155);
  margin-bottom: 5px;
}

html.dark .bb-contact-field label {
  color: var(--gray-500, #94a3b8);
}

.bb-contact-field input,
.bb-contact-field textarea {
  width: 100%;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--text, #0f172a);
  background: var(--card, #fff);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

html.dark .bb-contact-field input,
html.dark .bb-contact-field textarea {
  background: #0c0f1a;
  border-color: #1e2d4a;
  color: #f1f5ff;
}

.bb-contact-field input::placeholder,
.bb-contact-field textarea::placeholder {
  color: var(--gray-400, #94a3b8);
}

.bb-contact-field input:focus,
.bb-contact-field textarea:focus {
  border-color: var(--blue-400, #60a5fa);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.bb-contact-field textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

.bb-contact-send {
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.72rem 1rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue-600, #2563eb), var(--blue-700, #1d4ed8));
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.bb-contact-send:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
}

.bb-contact-send:active {
  transform: translateY(0);
}

.bb-contact-survey {
  width: 100%;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--blue-600, #2563eb);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, color 0.15s;
}

.bb-contact-survey:hover {
  background: var(--blue-50, #eff6ff);
}

html.dark .bb-contact-survey {
  color: var(--blue-400, #60a5fa);
}

html.dark .bb-contact-survey:hover {
  background: rgba(37, 99, 235, 0.12);
}

.bb-contact-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, var(--blue-500, #3b82f6), var(--blue-700, #1d4ed8));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.45);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.22s;
}

.bb-contact-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 32px rgba(37, 99, 235, 0.5);
}

.bb-contact-fab:active {
  transform: scale(0.98);
}

.bb-contact-widget.is-open .bb-contact-fab {
  background: var(--gray-700, #334155);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.25);
}

html.dark .bb-contact-widget.is-open .bb-contact-fab {
  background: #243552;
}

.bb-contact-fab svg {
  width: 24px;
  height: 24px;
  display: block;
}

.bb-contact-fab .bb-contact-icon-close {
  display: none;
}

.bb-contact-widget.is-open .bb-contact-fab .bb-contact-icon-chat {
  display: none;
}

.bb-contact-widget.is-open .bb-contact-fab .bb-contact-icon-close {
  display: block;
}

@media (max-width: 900px) {
  .bb-contact-widget {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    right: 16px;
  }

  body.gm-has-mobile-nav .bb-contact-widget {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  body.forum-thread-open .bb-contact-widget {
    z-index: 400;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
  }
}
