/* ==========================================================================
   SMART LEAD POPUP & MOBILE BANNER - FRONTEND CSS
   - Desktop: Modal 720x450 (Nền mờ đen 50%)
   - Mobile: Banner đáy <= 160px (Không nền mờ, không đè nút nổi Hotline/Zalo)
   ========================================================================== */

:root {
  --wplp-primary: #2563eb;
  --wplp-primary-hover: #1d4ed8;
  --wplp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wplp-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--wplp-font);
  -webkit-font-smoothing: antialiased;
}

.wplp-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

/* 1. Backdrop Desktop (Nền phủ đen 50%) */
.wplp-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* 2. Modal Desktop: 720x450 (Chiếm ~35% màn hình) */
.wplp-container {
  position: relative;
  z-index: 2;
  width: 720px;
  height: 450px;
  max-width: calc(100% - 32px);
  max-height: calc(100% - 32px);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  overflow: hidden;
  transform: scale(0.92) translateY(12px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.wplp-overlay.is-active .wplp-container {
  transform: scale(1) translateY(0);
}

/* Nút Đóng (X) */
.wplp-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  padding: 0;
}

.wplp-close:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fca5a5;
  transform: rotate(90deg);
}

/* Cột Ảnh trái (360x450) */
.wplp-image-col {
  width: 360px;
  height: 100%;
  flex-shrink: 0;
  background: #e2e8f0;
  position: relative;
  overflow: hidden;
}

.wplp-image-col img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wplp-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

/* Cột Nội Dung phải (360x450, padding 32px) */
.wplp-content-col {
  width: 360px;
  flex: 1;
  height: 100%;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  background: #ffffff;
}

.wplp-title {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  margin: 0 0 6px 0;
  letter-spacing: -0.01em;
}

.wplp-desc {
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.4;
  margin: 0 0 16px 0;
}

/* Form Styles */
.wplp-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.wplp-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 9px;
  font-size: 0.9rem;
  color: #1e293b;
  background: #ffffff;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.wplp-input:focus {
  border-color: var(--wplp-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.wplp-btn-submit {
  width: 100%;
  height: 44px;
  background: var(--wplp-primary);
  color: #ffffff;
  border: none;
  border-radius: 9px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
  margin-top: 2px;
}

.wplp-btn-submit:hover {
  filter: brightness(0.92);
  transform: translateY(-1px);
}

.wplp-btn-hotline {
  width: 100%;
  height: 38px;
  background: #ffffff;
  color: #0284c7;
  border: 1.5px solid #bae6fd;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.wplp-btn-hotline:hover {
  background: #f0f9ff;
  border-color: #38bdf8;
  color: #0369a1;
}

.wplp-dismiss-link {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
  margin-top: 2px;
  transition: color 0.2s ease;
  text-align: center;
}

.wplp-dismiss-link:hover {
  color: #64748b;
  text-decoration: underline;
}

.wplp-mobile-actions {
  display: none;
}

.wplp-success-state {
  display: none;
  text-align: center;
  padding: 20px 10px;
}

.wplp-check-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 10px auto;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.wplp-success-state h4 {
  font-size: 1.2rem;
  color: #0f172a;
  margin: 0 0 4px 0;
}

.wplp-success-state p {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0;
}

/* ==========================================================================
   TABLET: 640x400 (ảnh 320x400)
   ========================================================================== */
@media (max-width: 991px) and (min-width: 768px) {
  .wplp-container {
    width: 640px;
    height: 400px;
  }
  .wplp-image-col {
    width: 300px;
  }
  .wplp-content-col {
    padding: 24px;
  }
  .wplp-title {
    font-size: 1.2rem;
  }
}

/* ==========================================================================
   MOBILE: BỐ CỤC 1 CỘT CANH GIỮA MÀN HÌNH (ẢNH CHỮ NHẬT ĐỨNG Ở TRÊN)
   ========================================================================== */
@media (max-width: 767px) {
  .wplp-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center; /* Canh giữa màn hình theo chiều dọc */
    padding: 16px;
    z-index: 999999;
    box-sizing: border-box;
  }

  /* Nền phủ mờ đen nhẹ tập trung chú ý */
  .wplp-backdrop {
    display: block !important;
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }

  /* Container 1 Cột canh giữa màn hình */
  .wplp-container {
    pointer-events: auto;
    width: 100%;
    max-width: 340px;
    height: auto;
    max-height: 90vh;
    border-radius: 20px;
    border: none;
    background: #ffffff;
    padding: 0;
    margin: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    transform: scale(0.9) translateY(10px);
    display: flex;
    flex-direction: column; /* 1 Cột dọc */
    overflow: hidden;
    position: relative;
    z-index: 2;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .wplp-overlay.is-active .wplp-container {
    transform: scale(1) translateY(0);
  }

  /* Nút đóng nổi bật ở góc trên */
  .wplp-close {
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(15, 23, 42, 0.6);
    border: none;
    color: #ffffff;
    border-radius: 50%;
    z-index: 20;
    backdrop-filter: blur(4px);
  }

  .wplp-close:hover {
    background: #ef4444;
    color: #ffffff;
  }

  /* Phía trên: Hình banner hiển thị trọn vẹn từ đỉnh đầu xuống */
  .wplp-image-col {
    width: 100%;
    height: auto;
    max-height: 220px;
    flex-shrink: 0;
    background: #f1f5f9;
    position: relative;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
    border: none;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .wplp-image-col img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover; /* Giữ trọn vẹn khuôn mặt & đỉnh đầu không bị cắt */
    object-position: top center;
    border-radius: 0;
    display: block;
  }

  .wplp-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    display: block;
  }

  /* Phía dưới: Nội dung & Form tư vấn */
  .wplp-content-col {
    width: 100%;
    padding: 16px 18px 14px 18px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    text-align: left;
    box-sizing: border-box;
  }

  .wplp-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 4px 0;
    line-height: 1.3;
    max-width: 100%;
  }

  .wplp-desc {
    display: block;
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 12px;
    line-height: 1.35;
  }

  /* Form nhập trên Mobile */
  .wplp-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .wplp-input {
    height: 38px;
    font-size: 0.85rem;
    border-radius: 8px;
  }

  .wplp-btn-submit {
    height: 40px;
    font-size: 0.9rem;
    border-radius: 8px;
    margin-top: 2px;
  }

  .wplp-btn-hotline {
    height: 36px;
    font-size: 0.85rem;
    border-radius: 8px;
  }

  .wplp-dismiss-link {
    display: block;
    font-size: 0.75rem;
    padding: 2px;
    margin-top: 2px;
  }

  .wplp-mobile-actions {
    display: none !important;
  }

  .wplp-mobile-quick-form {
    display: none !important;
  }
}
