/* ============================================================
   zalo-popup.css - Popup mời vào nhóm Zalo (chỉ mobile ≤768px)
   ============================================================ */

.zp-backdrop,
.zp-sheet,
.zp-fab { display: none; }

@media (max-width: 768px) {
  /* ---- Nền mờ ---- */
  .zp-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  .zp-backdrop.active { opacity: 1; visibility: visible; }

  /* ---- Bottom sheet ---- */
  .zp-sheet {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2001;
    padding: 14px 20px calc(22px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    background: linear-gradient(165deg, #0b1a3a 0%, #0f2a66 55%, #0068ff 140%);
    color: #fff;
    box-shadow: 0 -16px 50px rgba(0, 60, 180, 0.45);
    transform: translateY(105%);
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
  }
  .zp-sheet.active { transform: translateY(0); }

  .zp-sheet::before {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    top: -120px;
    right: -80px;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.45), transparent 70%);
    pointer-events: none;
  }

  .zp-handle {
    width: 40px;
    height: 4px;
    margin: 0 auto 14px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.35);
  }

  .zp-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
  }

  .zp-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    position: relative;
  }
  .zp-logo {
    width: 54px;
    height: 54px;
    flex-shrink: 0;
    border-radius: 16px;
    background: #fff;
    color: #0068ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 800;
    box-shadow: 0 6px 18px rgba(0, 104, 255, 0.5);
    animation: zp-bounce 2.4s ease-in-out infinite;
  }
  .zp-badge {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.18);
    color: #fcd34d;
    border: 1px solid rgba(251, 191, 36, 0.4);
    margin-bottom: 5px;
  }
  .zp-title {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.3;
  }

  .zp-benefits {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    display: grid;
    gap: 9px;
    position: relative;
  }
  .zp-benefits li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.84rem;
    color: rgba(255, 255, 255, 0.9);
  }
  .zp-benefits i {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    background: rgba(52, 211, 153, 0.18);
    color: #34d399;
  }

  .zp-join {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    height: 50px;
    border-radius: 14px;
    background: #fff;
    color: #0068ff !important;
    font-size: 0.95rem;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease;
  }
  .zp-join:active { transform: scale(0.97); }
  .zp-join::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(110deg, transparent, rgba(0, 104, 255, 0.18), transparent);
    animation: zp-shine 2.6s ease-in-out infinite;
  }

  .zp-later {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
  }

  /* ---- Nút Zalo nổi ---- */
  .zp-fab {
    display: flex;
    position: fixed;
    right: 14px;
    bottom: calc(72px + env(safe-area-inset-bottom));
    width: 52px;
    height: 52px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0068ff, #2f8bff);
    color: #fff !important;
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration: none;
    z-index: 999;
    box-shadow: 0 6px 18px rgba(0, 104, 255, 0.45);
    transition: transform 0.2s ease, opacity 0.3s ease;
  }
  .zp-fab::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid #0068ff;
    animation: zp-pulse 1.8s ease-out infinite;
  }
  .zp-fab:active { transform: scale(0.92); }
  .zp-fab.hidden { opacity: 0; pointer-events: none; }

  @keyframes zp-pulse {
    0%   { transform: scale(1);   opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
  }
  @keyframes zp-bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
  }
  @keyframes zp-shine {
    0%   { left: -60%; }
    60%, 100% { left: 130%; }
  }
}
