/**
 * DadeVarz Peyvand - Enterprise Dynamic Popup System Styles
 */

/* Overlay / Backdrop */
.peyvand-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.peyvand-popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Popup Modal Box */
.peyvand-popup-wrapper {
  position: fixed;
  z-index: 99999;
  max-width: 92vw;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.35s ease;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.3), 0 0 1px 1px rgba(255, 255, 255, 0.15) inset;
  border-radius: 16px;
  overflow: hidden;
  direction: rtl;
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.peyvand-popup-wrapper.active {
  opacity: 1;
  visibility: visible;
}

/* --- Positions --- */
/* 1. Center (Modal) */
.peyvand-popup-pos-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%) scale(0.96);
}
.peyvand-popup-pos-center.active {
  transform: translate(-50%, -50%) scale(1);
}

/* 2. Top Center */
.peyvand-popup-pos-top_center {
  top: 24px;
  left: 50%;
  transform: translate(-50%, -20px);
}
.peyvand-popup-pos-top_center.active {
  transform: translate(-50%, 0);
}

/* 3. Bottom Center */
.peyvand-popup-pos-bottom_center {
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
}
.peyvand-popup-pos-bottom_center.active {
  transform: translate(-50%, 0);
}

/* 4. Bottom Right */
.peyvand-popup-pos-bottom_right {
  bottom: 24px;
  right: 24px;
  transform: translateY(20px);
}
.peyvand-popup-pos-bottom_right.active {
  transform: translateY(0);
}

/* 5. Bottom Left */
.peyvand-popup-pos-bottom_left {
  bottom: 24px;
  left: 24px;
  transform: translateY(20px);
}
.peyvand-popup-pos-bottom_left.active {
  transform: translateY(0);
}

/* 6. Top Right */
.peyvand-popup-pos-top_right {
  top: 24px;
  right: 24px;
  transform: translateY(-20px);
}
.peyvand-popup-pos-top_right.active {
  transform: translateY(0);
}

/* 7. Top Left */
.peyvand-popup-pos-top_left {
  top: 24px;
  left: 24px;
  transform: translateY(-20px);
}
.peyvand-popup-pos-top_left.active {
  transform: translateY(0);
}

/* Close Button */
.peyvand-popup-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.peyvand-popup-close:hover {
  background: rgba(0, 0, 0, 0.16);
  transform: scale(1.08);
}

.peyvand-popup-close:focus {
  outline: 2px solid #0265dc;
}

/* Popup Content Card */
.peyvand-popup-body {
  display: flex;
  flex-direction: column;
  position: relative;
}

.peyvand-popup-img-wrap {
  width: 100%;
  overflow: hidden;
  background: #f1f5f9;
  line-height: 0;
}

.peyvand-popup-img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
}

.peyvand-popup-text-content {
  padding: 1.75rem 2rem 2rem;
}

.peyvand-popup-heading {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 0.75rem;
  line-height: 1.4;
  padding-left: 28px; /* space for close button */
}

.peyvand-popup-text {
  font-size: 0.95rem;
  line-height: 1.8;
  margin: 0 0 1.25rem;
  opacity: 0.9;
  white-space: pre-line;
}

.peyvand-popup-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.peyvand-popup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 8px;
  background: #0265dc;
  color: #ffffff !important;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 4px 12px rgba(2, 101, 220, 0.25);
}

.peyvand-popup-btn:hover {
  background: #014bb1;
  transform: translateY(-1px);
}

.peyvand-popup-btn-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  border: 1px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: background 0.2s;
}

.peyvand-popup-btn-dismiss:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .peyvand-popup-wrapper {
    max-width: 94vw !important;
    left: 3vw !important;
    right: 3vw !important;
    transform: none !important;
  }

  .peyvand-popup-pos-center,
  .peyvand-popup-pos-top_center,
  .peyvand-popup-pos-bottom_center,
  .peyvand-popup-pos-bottom_right,
  .peyvand-popup-pos-bottom_left,
  .peyvand-popup-pos-top_right,
  .peyvand-popup-pos-top_left {
    left: 3vw !important;
    right: 3vw !important;
    transform: translateY(20px) !important;
  }

  .peyvand-popup-pos-center.active,
  .peyvand-popup-pos-top_center.active,
  .peyvand-popup-pos-bottom_center.active,
  .peyvand-popup-pos-bottom_right.active,
  .peyvand-popup-pos-bottom_left.active,
  .peyvand-popup-pos-top_right.active,
  .peyvand-popup-pos-top_left.active {
    bottom: 16px !important;
    top: auto !important;
    transform: translateY(0) !important;
  }

  .peyvand-popup-text-content {
    padding: 1.25rem;
  }

  .peyvand-popup-heading {
    font-size: 1.15rem;
  }
}
