/* Plovoucí WhatsApp kontakt */
.whatsapp-float {
  position: fixed;
  right: 50px;
  bottom: 50px;
  right: max(50px, env(safe-area-inset-right));
  bottom: max(50px, calc(30px + env(safe-area-inset-bottom)));
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 56px;
  padding: 0 18px 0 14px;
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  font-family: "Roboto Condensed", sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.whatsapp-float:hover {
  background: #1fbd59;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}

.whatsapp-float:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.whatsapp-float-icon {
  display: block;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}

@media (max-width: 479px) {
  .whatsapp-float {
    right: 14px;
    bottom: 14px;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    min-height: 52px;
    padding: 0 15px 0 12px;
    font-size: 15px;
  }

  .whatsapp-float-icon {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-float {
    transition: none;
  }
}

/* Rozbalovací panel – bez JavaScriptu zůstane původní přímý odkaz funkční. */
.whatsapp-widget-ready .whatsapp-float {
  width: 60px;
  min-width: 60px;
  height: 60px;
  min-height: 60px;
  padding: 0;
  justify-content: center;
  border: 0;
  cursor: pointer;
}

.whatsapp-widget-ready .whatsapp-float span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.whatsapp-widget-ready .whatsapp-float::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #e53935;
}

/* Jemné upozornění s dlouhou pauzou; neovlivňuje pozici tlačítka. */
.whatsapp-widget-ready .whatsapp-float::before {
  content: "";
  position: absolute;
  inset: -7px;
  border: 2px solid rgba(37, 211, 102, 0.52);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
  animation: whatsapp-attention-ring 6.5s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

.whatsapp-widget-ready .whatsapp-float:hover::before,
.whatsapp-widget-ready .whatsapp-float:focus-visible::before,
.whatsapp-chat-open .whatsapp-float::before {
  animation: none;
  opacity: 0;
}

.whatsapp-widget-ready .whatsapp-float-icon {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
}

.whatsapp-chat-panel {
  position: fixed;
  right: 50px;
  bottom: 122px;
  right: max(50px, env(safe-area-inset-right));
  bottom: max(122px, calc(102px + env(safe-area-inset-bottom)));
  z-index: 9998;
  width: min(360px, calc(100vw - 40px));
  overflow: hidden;
  border-radius: 18px;
  background: #efeae2;
  color: #1f2933;
  font-family: "Roboto Condensed", sans-serif;
  text-align: left;
  box-shadow: 0 12px 42px rgba(0, 0, 0, 0.3);
  transform-origin: right bottom;
  animation: whatsapp-panel-in 0.2s ease-out;
}

.whatsapp-chat-panel[hidden] {
  display: none;
}

.whatsapp-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 15px 18px;
  background: #087d70;
  color: #fff;
}

.whatsapp-chat-avatar {
  display: flex;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: #fff;
}

.whatsapp-chat-avatar img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.whatsapp-chat-person {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.whatsapp-chat-person strong {
  font-size: 18px;
  line-height: 1.1;
}

.whatsapp-chat-person span {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  line-height: 1.2;
}

.whatsapp-chat-close {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.whatsapp-chat-close:hover,
.whatsapp-chat-close:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.whatsapp-chat-body {
  padding: 20px 18px 16px;
  background-color: #efeae2;
  background-image: radial-gradient(rgba(7, 94, 84, 0.055) 1px, transparent 1px);
  background-size: 12px 12px;
}

.whatsapp-chat-bubble {
  position: relative;
  width: fit-content;
  max-width: 90%;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 4px 12px 12px 12px;
  background: #fff;
  font-size: 15px;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.whatsapp-chat-form {
  margin: 0;
}

.whatsapp-chat-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.whatsapp-chat-input {
  display: block;
  width: 100%;
  min-height: 82px;
  resize: vertical;
  margin: 0 0 12px;
  padding: 12px 13px;
  border: 1px solid #d6d3cd;
  border-radius: 12px;
  background: #fff;
  color: #1f2933;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.whatsapp-chat-input:focus {
  border-color: #25d366;
  outline: 3px solid rgba(37, 211, 102, 0.22);
}

.whatsapp-chat-send {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.whatsapp-chat-send:hover {
  background: #1fbd59;
  transform: translateY(-1px);
}

.whatsapp-chat-send:focus-visible {
  outline: 3px solid #087d70;
  outline-offset: 2px;
}

.whatsapp-chat-send img {
  display: block;
  width: 25px;
  height: 25px;
}

.whatsapp-chat-note {
  margin: 9px 0 0;
  color: #66737d;
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
}

@keyframes whatsapp-panel-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes whatsapp-attention-ring {
  0%,
  72%,
  100% {
    opacity: 0;
    transform: scale(0.9);
  }

  75% {
    opacity: 0.42;
    transform: scale(0.94);
  }

  84% {
    opacity: 0;
    transform: scale(1.28);
  }
}

@media (max-width: 767px) {
  .whatsapp-float {
    bottom: 20px;
    bottom: max(20px, env(safe-area-inset-bottom));
  }

  .whatsapp-widget-ready .whatsapp-float::before {
    animation: none;
  }

  .whatsapp-chat-panel {
    bottom: 92px;
    bottom: max(92px, calc(72px + env(safe-area-inset-bottom)));
  }
}

@media (max-width: 479px) {
  .whatsapp-widget-ready .whatsapp-float {
    bottom: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    width: 56px;
    min-width: 56px;
    height: 56px;
    min-height: 56px;
  }

  .whatsapp-widget-ready .whatsapp-float::before {
    animation: none;
  }

  .whatsapp-chat-panel {
    right: 14px;
    bottom: 82px;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(82px, calc(68px + env(safe-area-inset-bottom)));
    width: calc(100vw - 28px);
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
    border-radius: 16px;
  }

  .whatsapp-chat-header {
    min-height: 76px;
    padding: 12px 14px;
  }

  .whatsapp-chat-avatar {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .whatsapp-chat-avatar img {
    width: 37px;
    height: 37px;
  }

  .whatsapp-chat-body {
    padding: 16px 14px 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-widget-ready .whatsapp-float::before {
    animation: none;
  }

  .whatsapp-chat-panel {
    animation: none;
  }

  .whatsapp-chat-send {
    transition: none;
  }
}
