/**
 * sticky-contact.css
 *
 * Dandiran WooCommerce Theme — Sticky "Contact Us" button + modal.
 *
 * Companion to template-parts/sticky-contact.php + assets/js/sticky-contact.js.
 * Depends on dnd-tokens.css custom properties (--dnd-primary, --dnd-radius-*,
 * etc) — enqueued with ['dnd-tokens'] as a dependency, same convention as
 * notify-me.css / auth-modal.css.
 *
 * The modal half of this file follows the exact same DNDModalBase visual
 * pattern already used by .dnd-notify-modal (notify-me.css) — same overlay
 * fade + dialog translateY/opacity transition — just renamed to
 * .dnd-contact-modal so it can carry its own list layout.
 */

/* ------------------------------------------------------------------ */
/* Floating button                                                     */
/* ------------------------------------------------------------------ */

.dnd-sticky-contact {
  position: fixed;
  left: 18px;
  bottom: calc(24px + var(--dnd-contact-bottom-extra, 0px) + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--dnd-primary), var(--dnd-primary-dark));
  color: #fff;
  box-shadow: 0 8px 20px rgba(160, 20, 30, 0.35);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  animation: dnd-sticky-contact-bob 4.5s ease-in-out infinite;
}

.dnd-sticky-contact:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 24px rgba(160, 20, 30, 0.42);
}

.dnd-sticky-contact:active {
  transform: scale(0.96);
}

.dnd-sticky-contact__icon {
  position: relative;
  z-index: 1;
  display: flex;
}

/* Soft radar ping behind the button — subtle, not a constant pulse,
   so it reads as "occasional attention grab" rather than noise. */
.dnd-sticky-contact__ping {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--dnd-primary);
  opacity: 0;
  animation: dnd-sticky-contact-ping 4.5s ease-in-out infinite;
}

/* Small, brief, occasional bounce — most of the 4.5s cycle the button
   sits still; the movement itself only takes ~350ms every cycle. */
@keyframes dnd-sticky-contact-bob {
  0%,
  90%,
  100% {
    transform: translateY(0);
  }
  93% {
    transform: translateY(-7px);
  }
  96% {
    transform: translateY(0);
  }
  98% {
    transform: translateY(-3px);
  }
}

@keyframes dnd-sticky-contact-ping {
  0%,
  85% {
    transform: scale(1);
    opacity: 0;
  }
  93% {
    transform: scale(1.35);
    opacity: 0.35;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dnd-sticky-contact,
  .dnd-sticky-contact__ping {
    animation: none;
  }
}

/* Sit above the mobile bottom nav (54px + safe-area, see mobile-nav.css)
   instead of overlapping it. */
@media (max-width: 991.98px) {
  body.has-mobile-nav .dnd-sticky-contact {
    bottom: calc(54px + 16px + var(--dnd-contact-bottom-extra, 0px) + env(safe-area-inset-bottom, 0px));
  }
}

/* ------------------------------------------------------------------ */
/* Modal — DNDModalBase contract                                       */
/* ------------------------------------------------------------------ */

.dnd-contact-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.dnd-contact-modal[hidden] {
  display: none;
}
.dnd-contact-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: min(600px, 86vh);
  overflow-y: auto;
  background: var(--dnd-white);
  border-radius: var(--dnd-radius-lg);
  padding: 30px 24px 14px;
  transform: translateY(16px);
  opacity: 0;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  direction: rtl;
}

.dnd-contact-modal.is-active .dnd-contact-modal__dialog {
  transform: translateY(0);
  opacity: 1;
}

.dnd-contact-modal__close {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--dnd-bg-soft);
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  color: var(--dnd-muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.dnd-contact-modal__close:hover {
  background: var(--dnd-primary-soft);
  color: var(--dnd-primary-dark);
}

.dnd-contact-modal__title {
  font-size: 19px;
  font-weight: 700;
  color: var(--dnd-text);
  margin: 0 0 6px;
  padding-left: 32px; /* جا برای دکمه بستن */
}

.dnd-contact-modal__subtitle {
  font-size: 13px;
  color: var(--dnd-muted);
  margin: 0 0 8px;
}

/* ------------------------------------------------------------------ */
/* لیست راه‌های ارتباطی — یک «دفترچه»ی خط‌دار، نه انبوهی از کارت‌های  */
/* سایه‌دار: هر ردیف تمام‌عرضه و فقط با یک خط از هم جدا می‌شه، تا      */
/* آیکون و بج مقدار فضای نفس کشیدن داشته باشن. یک حرکت هماهنگ روی     */
/* hover (رنگ‌آمیزی از پایین + پر شدن آیکون + جابه‌جایی فلش) جایگزین  */
/* الگوی کلیشه‌ای border/shadow شده.                                   */
/* ------------------------------------------------------------------ */

.dnd-contact-modal__list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  border-top: 1px solid var(--dnd-border);
  text-align: right;
}

.dnd-contact-modal__item {
  border-bottom: 1px solid var(--dnd-border);
}

.dnd-contact-modal__link {
  position: relative;
  display: grid;
  grid-template-columns: 50px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 4px;
  color: var(--dnd-text);
  text-decoration: none;
  overflow: hidden;
}

.dnd-contact-modal__link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--dnd-primary-soft);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.dnd-contact-modal__link:hover::before,
.dnd-contact-modal__link:focus-visible::before {
  transform: scaleY(1);
}

.dnd-contact-modal__link > * {
  position: relative;
}

.dnd-contact-modal__icon {
  flex: none;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--dnd-primary-soft);
  color: var(--dnd-primary);
  transition:
    background 0.3s ease,
    color 0.3s ease,
    transform 0.3s ease;
}

.dnd-contact-modal__link:hover .dnd-contact-modal__icon {
  background: var(--dnd-primary);
  color: #fff;
  transform: scale(1.05);
}

.dnd-contact-modal__icon img,
.dnd-contact-modal__icon svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dnd-contact-modal__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.dnd-contact-modal__text strong {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
}

.dnd-contact-modal__value {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--dnd-primary-dark);
  background: var(--dnd-primary-soft);
  border-radius: var(--dnd-radius-pill);
  padding: 3px 10px;
  transition: background 0.3s ease, color 0.3s ease;
}

.dnd-contact-modal__link:hover .dnd-contact-modal__value {
  background: var(--dnd-white);
}

.dnd-contact-modal__arrow {
  flex: none;
  color: var(--dnd-muted);
  font-size: 17px;
  opacity: 0.5;
  transition: transform 0.3s ease, opacity 0.3s ease, color 0.3s ease;
}

.dnd-contact-modal__link:hover .dnd-contact-modal__arrow {
  opacity: 1;
  color: var(--dnd-primary);
  transform: translateX(-4px);
}

.dnd-contact-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 30, 0.5);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.dnd-contact-modal.is-active .dnd-contact-modal__overlay {
  opacity: 1;
}