/* WhatsApp FAB + panel — wpcode.md tabanı (temaya uyumlu, yalnızca .wa-widget içi) */

:root {
  --wa-dark-green: #075E54;
  --wa-teal: #128C7E;
  --wa-light-green: #25D366;
  --wa-outgoing: #DCF8C6;
  --wa-outgoing-shadow: #b6e2a1;
  --wa-chat-bg: #ECE5DD;
  --wa-incoming: #FFFFFF;
  --wa-input-bg: #F0F0F0;
  --wa-text: #303030;
  --wa-text-light: #8E8E8E;
  --wa-time: #7C9A9E;
  --wa-blue-tick: #53BDEB;
}

.wa-widget,
.wa-widget * {
  box-sizing: border-box;
}

.wa-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 20000000;
  font-family: "Urbanist", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* Sohbet açıkken yuvarlak buton yok; kapalıyken panel .open değil (animasyonlu gizli) */
.wa-widget.is-chat-open .wa-fab {
  display: none !important;
}

.wa-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--wa-light-green);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 16px rgba(37, 211, 102, 0.4),
    0 0 0 0 rgba(37, 211, 102, 0.3);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 10;
}

.wa-fab:hover {
  transform: scale(1.08);
  box-shadow:
    0 6px 24px rgba(37, 211, 102, 0.5),
    0 0 0 0 rgba(37, 211, 102, 0.3);
}

.wa-fab:active {
  transform: scale(0.96);
}

.wa-fab .fab-icon {
  font-size: 28px;
  color: #fff;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wa-fab.active .fab-icon {
  transform: rotate(90deg);
}

.wa-fab.active {
  background: var(--wa-dark-green);
}

.wa-fab::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #4aef85;
  border: 2.5px solid #fff;
  border-radius: 50%;
  animation: wa-pulse-dot 2s ease-in-out infinite;
}

.wa-fab.active::after {
  display: none;
}

@keyframes wa-pulse-dot {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(74, 239, 133, 0.5);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(74, 239, 133, 0);
  }
}

.wa-chat {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 330px;
  max-width: calc(100vw - 48px);
  height: 400px;
  max-height: calc(100vh - 120px);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.25),
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  transform: scale(0) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wa-chat.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Kapalıyken panel FAB üzerinde konumlanır; açıkken FAB gizli → köşeye yaslı */
.wa-widget.is-chat-open .wa-chat {
  bottom: 0;
  max-height: min(400px, calc(100vh - 48px));
}

.wa-header {
  background: var(--wa-dark-green);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.wa-header-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--wa-dark-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  font-weight: 600;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.wa-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  border-radius: 50%;
  box-sizing: border-box;
}

.wa-header-info {
  flex: 1;
  min-width: 0;
}

.wa-header-name {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.wa-header-status {
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.3;
}

.wa-header-status .online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4aef85;
  animation: wa-pulse-dot 2s ease-in-out infinite;
}

.wa-header-actions {
  display: flex;
  gap: 4px;
}

.wa-header-actions button {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 17px;
}

.wa-header-actions button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.wa-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
  position: relative;
  background-color: var(--wa-chat-bg);
}

/* Doodle görsel ~%25 opaklıkta; zeminde düz renk (--wa-chat-bg) */
.wa-body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("../img/wp-chat-bg.webp");
  background-repeat: repeat;
  background-size: auto;
  background-position: 0 0;
  opacity: 0.25;
  pointer-events: none;
}

.wa-body > * {
  position: relative;
  z-index: 1;
}

.wa-body::-webkit-scrollbar {
  width: 5px;
}

.wa-body::-webkit-scrollbar-track {
  background: transparent;
}

.wa-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}

.wa-date-divider {
  text-align: center;
  margin: 8px 0 14px;
}

.wa-date-divider span {
  background: rgba(255, 255, 255, 0.9);
  color: var(--wa-text-light);
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  font-weight: 500;
}

.wa-msg {
  max-width: 82%;
  margin-bottom: 4px;
  position: relative;
  animation: wa-msg-in 0.35s cubic-bezier(0.34, 1.3, 0.64, 1) both;
}

@keyframes wa-msg-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.wa-msg.incoming {
  margin-right: auto;
  margin-left: 0;
}

.wa-msg.outgoing {
  margin-left: auto;
  margin-right: 0;
}

.wa-msg-bubble {
  padding: 7px 10px 8px;
  border-radius: 10px;
  position: relative;
  line-height: 1.45;
  font-size: 15.5px;
  color: var(--wa-text);
  word-wrap: break-word;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

.wa-msg.incoming .wa-msg-bubble {
  background: var(--wa-incoming);
  border-top-left-radius: 3px;
}

.wa-msg.outgoing .wa-msg-bubble {
  background: var(--wa-outgoing);
  border-top-right-radius: 3px;
}

.wa-msg.incoming .wa-msg-bubble::before {
  content: "";
  position: absolute;
  top: 0;
  left: -8px;
  border-top: 0 solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 10px solid var(--wa-incoming);
}

.wa-msg.outgoing .wa-msg-bubble::after {
  content: "";
  position: absolute;
  top: 0;
  right: -8px;
  border-top: 0 solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 10px solid var(--wa-outgoing);
}

.wa-msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
  float: right;
  margin-left: 10px;
  position: relative;
  top: 5px;
}

.wa-msg-time {
  font-size: 12.5px;
  color: var(--wa-time);
}

.wa-msg-tick {
  font-size: 15px;
  color: var(--wa-blue-tick);
  line-height: 1;
}

.wa-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
}

.wa-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wa-text-light);
  animation: wa-typing-bounce 1.4s ease-in-out infinite;
}

.wa-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.wa-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes wa-typing-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.wa-footer {
  background: var(--wa-input-bg);
  padding: 8px 10px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.wa-footer button {
  background: none;
  border: none;
  color: var(--wa-text-light);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 20px;
  flex-shrink: 0;
}

.wa-footer button:hover {
  color: var(--wa-teal);
  background: rgba(18, 140, 126, 0.08);
}

.wa-input-wrap {
  flex: 1;
  position: relative;
}

.wa-input {
  width: 100%;
  border: none;
  outline: none;
  background: #fff;
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 15.5px;
  font-family: inherit;
  color: var(--wa-text);
  resize: none;
  max-height: 80px;
  line-height: 1.4;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s;
}

.wa-input::placeholder {
  color: var(--wa-text-light);
}

.wa-input:focus {
  box-shadow: inset 0 0 0 1.5px var(--wa-teal);
}

.wa-send-btn {
  background: var(--wa-light-green) !important;
  color: #fff !important;
  width: 38px !important;
  height: 38px !important;
  font-size: 18px !important;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.wa-send-btn:hover {
  background: var(--wa-teal) !important;
  color: #fff !important;
  transform: scale(1.08);
}

.wa-send-btn:active {
  transform: scale(0.92);
}

.wa-emoji-picker {
  position: absolute;
  bottom: 52px;
  left: 0;
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: none;
  flex-wrap: wrap;
  gap: 2px;
  width: 260px;
  z-index: 10;
}

.wa-emoji-picker.show {
  display: flex;
  animation: wa-msg-in 0.25s ease;
}

.wa-emoji-picker span {
  font-size: 24px;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  text-align: center;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-emoji-picker span:hover {
  background: var(--wa-chat-bg);
  transform: scale(1.2);
}

.wa-encryption {
  text-align: center;
  margin: 12px 0 4px;
  font-size: 12.5px;
  color: var(--wa-text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  line-height: 1.35;
  max-width: 100%;
}

.wa-encryption i {
  font-size: 12px;
  color: var(--wa-text-light);
}

@media (max-width: 480px) {
  .wa-chat {
    width: min(330px, calc(100vw - 24px));
    height: min(400px, calc(100vh - 100px));
    bottom: 68px;
    right: 12px;
    border-radius: 12px;
  }

  .wa-widget.is-chat-open .wa-chat {
    bottom: 0;
    width: min(330px, calc(100vw - 24px));
    height: min(400px, calc(100vh - 40px));
    max-height: calc(100vh - 40px);
  }

  .wa-widget {
    bottom: 16px;
    right: 12px;
  }
}

/* Telefon: widget gizli (masaüstü / tablet) */
@media (max-width: 767.98px) {
  .wa-widget {
    display: none !important;
  }
}
