/**
 * Frontend styles for ATP Floating Call.
 * Follows WordPress CSS Coding Standards, fully optimized for GPU rendering.
 */

.atp-float {
  position: fixed;
  z-index: 999990;
  display: flex;
  align-items: center;
  direction: ltr;
}

.atp-float-trigger {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 50px;
  background: var(--atp-bg-text);
  color: var(--atp-text-color);
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(4px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backface-visibility: hidden;
  will-change: transform;
}

.atp-float-trigger:hover,
.atp-float-trigger:focus-visible {
  color: var(--atp-text-color);
  transform: scale(1.05);
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.atp-float-icon {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--atp-brand-color);
}

.atp-svg-icon {
  width: 24px;
  height: 24px;
  fill: var(--atp-text-color);
}

.atp-float-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.atp-float-label {
  padding: 0 15px 0 10px;
  color: inherit;
  font-size: 14px;
  font-weight: bold;
  white-space: nowrap;
}

.atp-float-icon::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--atp-brand-color);
  opacity: 0.4;
  z-index: -1;
  animation: atp-ripple 2s infinite ease-in-out;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

@keyframes atp-ripple {
  0% {
    opacity: 0.4;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.8);
  }
}

/* RTL handling based on admin attributes */
.atp-float.atp-position-right .atp-float-trigger {
  flex-direction: row-reverse;
}

.atp-float.atp-position-right .atp-float-label {
  padding: 0 10px 0 15px;
}

/* Default fixed positioning. */
.atp-position-top {
  top: var(--atp-offset-v);
  bottom: auto;
}

.atp-position-bottom {
  top: auto;
  bottom: var(--atp-offset-v);
}

.atp-position-left {
  left: var(--atp-offset-h);
  right: auto;
}

.atp-position-right {
  left: auto;
  right: var(--atp-offset-h);
}

/* Device-specific positioning uses the default settings unless enabled. */
@media (min-width: 1024px) {
  .atp-hide-desktop {
    display: none !important;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .atp-hide-tablet {
    display: none !important;
  }

  .atp-spacing-tablet.atp-tablet-position-top {
    top: var(--atp-offset-v-tablet);
    bottom: auto;
  }

  .atp-spacing-tablet.atp-tablet-position-bottom {
    top: auto;
    bottom: var(--atp-offset-v-tablet);
  }

  .atp-spacing-tablet.atp-tablet-align-left {
    left: var(--atp-offset-h-tablet);
    right: auto;
  }

  .atp-spacing-tablet.atp-tablet-align-right {
    left: auto;
    right: var(--atp-offset-h-tablet);
  }
}

@media (max-width: 767px) {
  .atp-hide-mobile {
    display: none !important;
  }

  .atp-spacing-mobile.atp-mobile-position-top {
    top: var(--atp-offset-v-mobile);
    bottom: auto;
  }

  .atp-spacing-mobile.atp-mobile-position-bottom {
    top: auto;
    bottom: var(--atp-offset-v-mobile);
  }

  .atp-spacing-mobile.atp-mobile-align-left {
    left: var(--atp-offset-h-mobile);
    right: auto;
  }

  .atp-spacing-mobile.atp-mobile-align-right {
    left: auto;
    right: var(--atp-offset-h-mobile);
  }

  .atp-float-trigger {
    min-height: 48px;
    padding: 4px 6px 4px 4px;
    border-radius: 999px;
  }

  .atp-float-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
  }

  .atp-float-label {
    display: block;
    max-width: min(58vw, 220px);
    padding: 0 12px 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    line-height: 1.2;
  }

  .atp-float-trigger {
    margin-bottom: env(safe-area-inset-bottom);
  }
}

@media (max-width: 374px) {
  .atp-float-label {
    max-width: 50vw;
    padding-right: 8px;
    padding-left: 8px;
    font-size: 12px;
  }
}

@media (min-width: 768px) {
  .atp-float-trigger {
    padding: 4px;
  }
}
 
/* Accessibility: Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .atp-float-trigger {
    transition: none;
  }
  .atp-float-trigger:hover,
  .atp-float-trigger:focus-visible {
    transform: none;
  }
  .atp-float-icon::after {
    animation: none;
    display: none;
  }
}
