/* popup.css - نسخه نهایی و بهبود یافته */
:root {
  --pi-accent: #ff5a5f;
  --pi-accent-hover: #ff4146;
  --pi-bg-overlay: rgba(15, 23, 42, 0.65);
  --pi-radius: 16px;
  --pi-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  --pi-font-family: inherit; /* ارث بری از فونت قالب */
  --pi-z-index: 999999;
}

/* انیمیشن‌ها */
@keyframes piFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes piSlideUp { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes piPulse { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 90, 95, 0.4); } 70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(255, 90, 95, 0); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 90, 95, 0); } }

/* پاپ‌آپ اصلی */
.pi-backdrop {
  position: fixed;
  inset: 0;
  background: var(--pi-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--pi-z-index);
  backdrop-filter: blur(5px);
  padding: 20px;
  animation: piFadeIn 0.3s ease-out;
}

.pi-backdrop.pi-fade-out {
    opacity: 0;
    transition: opacity 0.3s;
}

.pi-card {
  width: 100%;
  max-width: 650px;
  background: white;
  border-radius: var(--pi-radius);
  box-shadow: var(--pi-shadow);
  display: flex;
  overflow: hidden;
  position: relative;
  font-family: var(--pi-font-family);
  animation: piSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ستون سمت چپ (آیکون و شماره) */
.pi-left {
  flex: 0 0 180px;
  background: linear-gradient(135deg, #fff5f5, #fff0f0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  border-left: 1px solid rgba(0,0,0,0.03);
}

.pi-pulse {
  width: 50px;
  height: 50px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 15px;
  animation: piPulse 2s infinite;
  box-shadow: 0 4px 12px rgba(255, 90, 95, 0.15);
}

.pi-badge {
  font-size: 12px;
  font-weight: bold;
  color: var(--pi-accent);
  background: rgba(255, 90, 95, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.pi-phone {
  font-size: 18px;
  font-weight: 800;
  color: #333;
  letter-spacing: 0.5px;
}

/* ستون سمت راست (محتوا) */
.pi-right {
  flex: 1;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pi-close {
  position: absolute;
  top: 15px;
  right: 15px; /* سمت راست برای فارسی */
  left: auto;
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 5px;
  transition: color 0.2s;
  z-index: 10;
}
.pi-close:hover { color: var(--pi-accent); }

.pi-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 10px;
  color: #1a1a1a;
  padding-left: 20px; /* جلوگیری از برخورد با دکمه بستن در موبایل */
}

.pi-desc {
  font-size: 14px;
  line-height: 1.6;
  color: #555;
  margin-bottom: 20px;
}

.pi-actions {
  display: flex;
  gap: 12px;
}

/* دکمه‌ها */
.pi-btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
}

.pi-btn-primary {
  background: var(--pi-accent);
  color: white;
  box-shadow: 0 4px 10px rgba(255, 90, 95, 0.25);
}
.pi-btn-primary:hover {
  background: var(--pi-accent-hover);
  transform: translateY(-2px);
  color: white;
}

.pi-btn-ghost {
  background: transparent;
  color: #666;
  border-color: #eee;
}
.pi-btn-ghost:hover {
  background: #f9f9f9;
  color: #333;
}

/* دکمه استعلام داخل صفحه محصول */
.pi-ask-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  border: 2px dashed #e2e8f0;
  color: #4a5568;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 5px;
}

.pi-ask-btn:hover {
  border-color: var(--pi-accent);
  color: var(--pi-accent);
  background: #fff5f5;
}

.pi-ask-icon svg {
    stroke: currentColor;
}

/* مودال هشدار (Modal) */
.pi-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999998;
    backdrop-filter: blur(2px);
    animation: piFadeIn 0.2s;
}

.pi-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 400px;
  background: white;
  border-radius: 12px;
  z-index: 999999;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: piSlideUp 0.3s;
}
.pi-modal-content { padding: 24px; }
.pi-modal h4 { margin: 0 0 10px; font-size: 18px; color: #1a1a1a; }
.pi-modal p { margin: 0 0 20px; font-size: 14px; color: #666; line-height: 1.5; }
.pi-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }


/* ریسپانسیو */
@media (max-width: 600px) {
  .pi-card { flex-direction: column; }
  .pi-left { 
    flex-direction: row; 
    padding: 15px; 
    border-bottom: 1px solid #eee; 
    border-left: none;
    justify-content: flex-start;
    gap: 15px;
  }
  .pi-pulse { margin-bottom: 0; width: 40px; height: 40px; font-size: 20px; }
  .pi-right { padding: 20px; }
  .pi-title { font-size: 18px; padding-left: 0; padding-right: 0; margin-top: 10px; }
  .pi-actions { flex-direction: column-reverse; } /* دکمه تماس بالا باشد */
  .pi-btn { width: 100%; }
  
  /* فیکس دکمه بستن در موبایل */
  .pi-close {
    top: 10px;
    left: 10px; /* انتقال به چپ در موبایل برای عدم تداخل با متن فارسی */
    right: auto;
    background: rgba(0,0,0,0.05);
    border-radius: 50%;
  }
}