/* PEF site asistanı — yalnızca UI (konuşma kutusu); API sonraki adımda */
.pef-assistant {
  position: fixed;
  z-index: 10050;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  font-family: 'Inter', sans-serif;
  pointer-events: none;
}
.pef-assistant.is-open .pef-assistant-fab {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.pef-assistant-fab {
  pointer-events: auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(201, 168, 76, 0.55);
  background: linear-gradient(145deg, #0e2040 0%, #152a52 50%, #0a1628 100%);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--gold, #c9a84c);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.22s ease, opacity 0.22s ease, border-color 0.2s;
}
.pef-assistant-fab:hover {
  transform: scale(1.06);
  border-color: rgba(201, 168, 76, 0.85);
  color: #e8c97a;
}
.pef-assistant-fab:focus-visible {
  outline: 2px solid rgba(74, 144, 226, 0.9);
  outline-offset: 3px;
}
.pef-assistant-fab svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.pef-assistant-panel {
  pointer-events: auto;
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(400px, calc(100vw - 24px));
  max-height: min(560px, 72vh);
  display: flex;
  flex-direction: column;
  background: rgba(10, 22, 40, 0.97);
  border: 1px solid rgba(201, 168, 76, 0.28);
  border-radius: 14px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(16px);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  visibility: hidden;
  transition:
    opacity 0.26s ease,
    transform 0.26s ease,
    visibility 0s linear 0.28s;
}
.pef-assistant.is-open .pef-assistant-panel {
  display: flex !important;
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  transition-delay: 0s, 0s, 0s;
}

.pef-assistant-panel[hidden] {
  display: none !important;
}

.pef-assistant-head {
  flex-shrink: 0;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(201, 168, 76, 0.2);
  background: linear-gradient(180deg, rgba(26, 94, 184, 0.12) 0%, transparent 100%);
}
.pef-assistant-head-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.pef-assistant-titlewrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.pef-assistant-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}
.pef-assistant-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 19px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin: 0;
}
.pef-assistant-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.52);
  line-height: 1.45;
  margin-top: 6px;
  max-width: 280px;
}
.pef-assistant-head-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.pef-assistant-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.pef-assistant-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.pef-assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  scroll-behavior: smooth;
}

.pef-assistant-msg {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.pef-assistant-msg-user {
  align-self: flex-end;
  margin-left: 20%;
  background: rgba(26, 94, 184, 0.38);
  border: 1px solid rgba(74, 144, 226, 0.35);
  color: rgba(255, 255, 255, 0.94);
}
.pef-assistant-msg-bot {
  align-self: flex-start;
  margin-right: 14%;
  background: rgba(14, 32, 64, 0.85);
  border: 1px solid rgba(201, 168, 76, 0.2);
  color: rgba(255, 255, 255, 0.88);
}
.pef-assistant-msg-meta {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 8px;
  padding: 0 4px;
  text-align: center;
}

.pef-assistant-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 5px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(14, 32, 64, 0.75);
  border: 1px solid rgba(201, 168, 76, 0.15);
}
.pef-assistant-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.55);
  animation: pef-asst-dot 1.2s infinite ease-in-out;
}
.pef-assistant-typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.pef-assistant-typing span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes pef-asst-dot {
  0%, 80%, 100% {
    opacity: 0.35;
    transform: scale(0.85);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pef-assistant-fab,
  .pef-assistant-panel {
    transition: none;
  }
  .pef-assistant-typing span {
    animation: none;
    opacity: 0.65;
  }
}

.pef-assistant-foot {
  flex-shrink: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(5, 10, 22, 0.5);
}
.pef-assistant-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.pef-assistant-input {
  flex: 1;
  min-height: 42px;
  max-height: 160px;
  height: 42px;
  resize: none;
  overflow-y: hidden;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.45;
  transition: border-color 0.15s, box-shadow 0.15s, height 0.05s linear;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 168, 76, 0.55) rgba(255, 255, 255, 0.06);
}
.pef-assistant-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}
.pef-assistant-input:focus {
  outline: none;
  border-color: rgba(201, 168, 76, 0.45);
  box-shadow: 0 0 0 2px rgba(26, 94, 184, 0.2);
}
.pef-assistant-input::-webkit-scrollbar {
  width: 8px;
}
.pef-assistant-input::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  margin: 4px 0;
}
.pef-assistant-input::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(201, 168, 76, 0.55), rgba(201, 168, 76, 0.35));
  border-radius: 4px;
  border: 1px solid rgba(10, 22, 40, 0.4);
}
.pef-assistant-input::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(201, 168, 76, 0.75), rgba(201, 168, 76, 0.55));
}

.pef-assistant-messages {
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 168, 76, 0.45) rgba(255, 255, 255, 0.04);
}
.pef-assistant-messages::-webkit-scrollbar {
  width: 8px;
}
.pef-assistant-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}
.pef-assistant-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(201, 168, 76, 0.5), rgba(201, 168, 76, 0.3));
  border-radius: 4px;
}
.pef-assistant-messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(201, 168, 76, 0.75), rgba(201, 168, 76, 0.5));
}

.pef-assistant-send {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #c9a84c 0%, #b08d38 100%);
  color: #0a1628;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pef-assistant-send:hover:not(:disabled) {
  filter: brightness(1.08);
}
.pef-assistant-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.pef-assistant-send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.pef-assistant-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 22, 0.55);
  backdrop-filter: blur(2px);
  z-index: 10040;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
  pointer-events: none;
}

/* Tablet ve dar ekranlar — chat tam genişlikte sağ-alt yerine ortalı */
@media (max-width: 900px) {
  .pef-assistant {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .pef-assistant-fab {
    width: 52px;
    height: 52px;
  }
  .pef-assistant-panel {
    position: fixed;
    right: 12px;
    left: 12px;
    bottom: calc(72px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    max-height: min(560px, 70vh);
    border-radius: 14px;
  }
  .pef-assistant-msg-user {
    margin-left: 12%;
  }
  .pef-assistant-msg-bot {
    margin-right: 8%;
  }
}

.pef-assistant-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

/* Telefon — neredeyse tam ekran */
@media (max-width: 560px) {
  .pef-assistant-panel {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    top: auto;
    max-height: min(78vh, calc(100vh - 100px - env(safe-area-inset-bottom)));
    border-radius: 16px;
  }
  .pef-assistant-head {
    padding: 12px 14px 10px;
  }
  .pef-assistant-title {
    font-size: 17px;
  }
  .pef-assistant-sub {
    font-size: 11px;
    max-width: none;
  }
  .pef-assistant-msg {
    max-width: 88%;
    font-size: 13px;
  }
  .pef-assistant-input {
    font-size: 14px;
  }
}
