/* ==========================================================================
   COMPONENT: QR Consultation Popup
   Responsive for mobile, tablet, and desktop.
   ========================================================================== */

/* ── Overlay Backdrop ── */
.qr-popup {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
    /* Hidden state */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.qr-popup.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ── Backdrop blur overlay ── */
.qr-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 8, 20, 0.72);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    cursor: pointer;
}

/* ── Card ── */
.qr-popup__card {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 28px;
    padding: clamp(28px, 5vw, 48px) clamp(24px, 5vw, 44px);
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow:
        0 32px 80px rgba(10, 8, 20, 0.32),
        0 0 0 1px rgba(201, 169, 110, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);

    /* Entry animation start state */
    transform: scale(0.88) translateY(24px);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.qr-popup.is-visible .qr-popup__card {
    transform: scale(1) translateY(0);
}

/* Decorative top gradient bar */
.qr-popup__card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: 28px 28px 0 0;
    background: linear-gradient(90deg, var(--purple, #4B2E83), var(--gold, #C9A96E));
}

/* ── Close Button ── */
.qr-popup__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(28, 28, 30, 0.07);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary, #4A4A52);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
    z-index: 2;
}
.qr-popup__close:hover {
    background: rgba(75, 46, 131, 0.12);
    color: var(--purple-mid, #6B47A8);
    transform: rotate(90deg);
}
.qr-popup__close:focus-visible {
    outline: 2px solid var(--purple-mid, #6B47A8);
    outline-offset: 2px;
}

/* ── Eyebrow ── */
.qr-popup__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold, #C9A96E);
    margin: 0 0 8px;
}
.qr-popup__eyebrow::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 2px;
    background: var(--gold, #C9A96E);
    border-radius: 2px;
}

/* ── Title & Subtitle ── */
.qr-popup__title {
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    font-weight: 700;
    color: var(--text-primary, #1C1C1E);
    line-height: 1.15;
    margin: 0 0 10px;
}

.qr-popup__subtitle {
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: 0.9rem;
    color: var(--text-secondary, #4A4A52);
    line-height: 1.65;
    margin: 0 0 20px;
}

/* ── QR Code Image ── */
.qr-popup__qr-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

/* Glowing halo behind the QR */
.qr-popup__qr-glow {
    position: absolute;
    inset: -12px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(75, 46, 131, 0.15), rgba(201, 169, 110, 0.10));
    filter: blur(14px);
    z-index: 0;
}

.qr-popup__qr-img {
    position: relative;
    z-index: 1;
    width: clamp(160px, 40vw, 200px);
    height: clamp(160px, 40vw, 200px);
    object-fit: contain;
    border-radius: 16px;
    border: 3px solid rgba(201, 169, 110, 0.25);
    box-shadow:
        0 8px 32px rgba(10, 8, 20, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    background: #fff;
    padding: 8px;
    display: block;
}

/* ── Scan label ── */
.qr-popup__scan-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: 0.8rem;
    color: var(--text-secondary, #4A4A52);
    margin: 0 0 18px;
    justify-content: center;
}
.qr-popup__scan-label svg {
    color: var(--purple-mid, #6B47A8);
    flex-shrink: 0;
}

/* ── Divider ── */
.qr-popup__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 18px;
    color: var(--text-secondary, #4A4A52);
    font-size: 0.8rem;
}
.qr-popup__divider::before,
.qr-popup__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(28, 28, 30, 0.10);
}

/* ── Action Buttons ── */
.qr-popup__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.qr-popup__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 13px 20px;
    border-radius: 12px;
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

/* WhatsApp button */
.qr-popup__btn--wa {
    background: #25D366;
    color: #fff;
    box-shadow: 0 4px 18px rgba(37, 211, 102, 0.30);
}
.qr-popup__btn--wa:hover {
    background: #1ebe5d;
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(37, 211, 102, 0.38);
    color: #fff;
}

/* Appointment button */
.qr-popup__btn--appt {
    background: linear-gradient(135deg, var(--purple-mid, #6B47A8), var(--purple, #4B2E83));
    color: #fff;
    box-shadow: 0 4px 18px rgba(75, 46, 131, 0.28);
}
.qr-popup__btn--appt:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(75, 46, 131, 0.38);
    color: #fff;
}

/* ── Doctor tag ── */
.qr-popup__doctor-tag {
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: 0.75rem;
    color: var(--text-secondary, #4A4A52);
    opacity: 0.75;
    margin: 0;
    line-height: 1.5;
}

/* ── Focus trap helper ── */
.qr-popup:focus { outline: none; }

/* ── Body lock when popup is open ── */
body.qr-popup-open {
    overflow: hidden;
}

/* =============================================================
   RESPONSIVE
   ============================================================= */

/* ── Mobile (≤480px) — compact layout ── */
@media (max-width: 480px) {
    .qr-popup__card {
        padding: 28px 20px 24px;
        border-radius: 22px;
    }

    .qr-popup__title {
        font-size: 1.5rem;
    }

    .qr-popup__subtitle {
        font-size: 0.85rem;
    }

    .qr-popup__qr-img {
        width: 150px;
        height: 150px;
    }

    .qr-popup__btn {
        padding: 12px 16px;
        font-size: 0.875rem;
    }
}

/* ── Small tablet (481px–767px) ── */
@media (min-width: 481px) and (max-width: 767px) {
    .qr-popup__card {
        max-width: 400px;
    }
}

/* ── Tablet landscape & desktop (≥768px) — side-by-side buttons ── */
@media (min-width: 768px) {
    .qr-popup__actions {
        flex-direction: row;
    }

    .qr-popup__btn {
        flex: 1;
    }

    .qr-popup__card {
        max-width: 460px;
    }
}

/* ── Large desktop (≥1200px) ── */
@media (min-width: 1200px) {
    .qr-popup__card {
        max-width: 480px;
    }
}
