:root{
    --qz-pop-primary:#920ADB;
    --qz-pop-primary-light:#f6effd;
    --qz-pop-text:#1f2937;
    --qz-pop-border:#e5e7eb;
    --qz-pop-note-bg: #fdf2f8; 
    --qz-pop-note-text: #b91c1c; 
}

.qz-pop-wrapper {
    direction: rtl;
    text-align: right;
    display: none; /* إخفاء النافذة افتراضياً ليتم التحكم بها عبر الجافا سكريبت */
}

.qz-pop-wrapper * {
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family: 'Tajawal', sans-serif;
}

/* Overlay */
.qz-pop-overlay{
    position:fixed;
    inset:0;
    background:rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display:flex;
    justify-content:center;
    align-items:center;
    padding:5px;
    z-index:99999;
}

/* Popup Container */
.qz-pop-container{
    position: relative;
    width:100%;
    max-width:480px;
    max-height:98vh;
    background:white;
    border-radius:24px;
    overflow-y:auto;
    display:flex;
    flex-direction:column;
    box-shadow:0 20px 60px rgba(0,0,0,.25);
}

.qz-pop-close-btn {
    position: absolute;
    top: 14px;
    left: 15px;
    width: 25px;
    height: 25px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--qz-pop-border);
    border-radius: 50%;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    transition: 0.2s;
    font-weight: bold;
}

.qz-pop-close-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.qz-pop-header {
    padding: 10px 17px 2px;
    text-align: center;
}

.qz-pop-logo{
    width:100px;
    max-width:70%;
    margin:auto;
    display:block;
}

.qz-pop-hero-image{
    width:100%;
    height:160px; 
    object-fit:cover;
    display:block;
}

.qz-pop-progress-wrap{
    padding:5px 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.qz-pop-progress-container-bar {
    flex-grow: 1;
}

.qz-pop-progress-track{
    height:6px;
    background:#eee;
    border-radius:100px;
    overflow:hidden;
}

.qz-pop-progress-bar{
    height:100%;
    width:0%;
    background:var(--qz-pop-primary);
    transition:.3s;
}

.qz-pop-question-number-top {
    color: var(--qz-pop-primary);
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

/* Content */
.qz-pop-content {
    padding: 10px 15px;
    flex-grow: 1;
}

.qz-pop-step {
    display:none;
}

.qz-pop-step.qz-pop-active{
    display:block;
    animation:qzPopFade .3s ease;
}

@keyframes qzPopFade{
    from{ opacity:0; transform:translateY(8px); }
    to{ opacity:1; transform:none; }
}

@keyframes qzPopShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.qz-pop-shake {
    animation: qzPopShake 0.3s ease-in-out;
}

.qz-pop-note-box {
    background: var(--qz-pop-note-bg);
    color: var(--qz-pop-note-text);
    padding: 12px 16px;
    border-radius: 4px 14px 14px 4px;
    border-right: 4px solid var(--qz-pop-primary);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 12px;
}

.qz-pop-welcome-title {
    font-size: 24px;
    font-weight: 800;
    color: #dc2626; 
    margin-bottom: 12px;
    text-align: center;
}

.qz-pop-welcome-desc {
    font-size: 16px;
    color: var(--qz-pop-text);
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
}

.qz-pop-features-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 5px;
    border-radius: 16px;
    margin-bottom: 10px;
}

.qz-pop-feature-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--qz-pop-text);
    background: var(--qz-pop-primary-light);    
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(146, 10, 219, 0.1);
}

.qz-pop-features-list .qz-pop-feature-item:nth-child(3) {
    grid-column: span 2;
}

.qz-pop-question-text{
    font-size:20px;
    font-weight:700;
    color:var(--qz-pop-text);
    margin-bottom:12px;
    line-height:1.4;
}

.qz-pop-answers-list{
    display:flex;
    flex-direction:column;
    gap:10px;
}

.qz-pop-answer-card{
    border:2px solid var(--qz-pop-border);
    border-radius:14px;
    padding:12px 16px;
    cursor:pointer;
    font-size:15px;
    font-weight: 500;
    transition:.2s;
}

.qz-pop-answer-card:hover{
    border-color:var(--qz-pop-primary);
}

.qz-pop-answer-card.qz-pop-selected{
    background:var(--qz-pop-primary-light);
    border-color:var(--qz-pop-primary);
    font-weight: 700;
}

.qz-pop-error-msg {
    color: #dc2626;
    font-size: 13px;
    font-weight: 700;
    margin-top: 12px;
    display: none;
    text-align: center;
}

.qz-pop-result-box {
    background: var(--qz-pop-primary-light);
    border: 2px dashed var(--qz-pop-primary);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin-top: 15px;
}

.qz-pop-result-box h3 {
    color: var(--qz-pop-text);
    font-size: 16px;
    margin-bottom: 8px;
    font-weight: 500;
}

.qz-pop-result-name {
    color: var(--qz-pop-primary);
    font-size: 22px;
    font-weight: 800;
}

/* Buttons */
.qz-pop-footer{
    display:flex;
    justify-content:space-between;
    gap:10px;
    padding:16px 20px 20px;
}

.qz-pop-btn{
    border:none;
    cursor:pointer;
    border-radius:999px;
    padding:12px 24px;
    font-size:15px;
    font-weight:700;
    transition: 0.2s;
}

.qz-pop-btn-next{
    background:var(--qz-pop-primary);
    color:white;
    flex-grow: 1;
    text-align: center;
}

.qz-pop-btn-back{
    background:#f4f4f4;
    color:#555;
    display: none;
}

/* ستايلات مخصصة لصفحات بطاقة الحك المضافة لتجنب التعارض */
.scratch-page-content {
    text-align: center;
    padding: 5px 10px;
}

.scratch-page-title {
    font-size: 22px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 4px;
}

.scratch-page-desc {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 15px;
}

#scratch-container {
    position: relative;
    width: 280px;
    height: 180px;
    margin: 0 auto 15px;
    user-select: none;
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

#scratch-canvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: pointer;
    z-index: 10;
    transition: opacity 0.5s ease;
}

.reward-underlayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3d2fc 0%, #f7e8fc 100%);
    border: 3px dashed #920ADB;
    border-radius: 1rem;
    z-index: 1;
    padding: 1rem;
}

.scratch-claim-btn {
    background: #920ADB;
    color: white;
    font-weight: 700;
    font-size: 14px;
    padding: 8px 24px;
    border-radius: 999px;
    border: none;
    margin-top: 10px;
    cursor: not-allowed;
    opacity: 0.5;
    transition: 0.3s;
}

@keyframes pulse-subtle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}
.pulse-ready {
    animation: pulse-subtle 2s infinite ease-in-out;
}

.qz-pop-input-group {
    margin-bottom: 16px;
    text-align: right;
}

.qz-pop-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 6px;
}

.qz-pop-input-style {
    width: 100%;
    padding: 11px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 15px;
    color: #0f172a;
    outline: none;
    transition: 0.2s;
    text-align: right;
}
.qz-pop-input-style:focus {
    border-color: var(--qz-pop-primary);
    box-shadow: 0 0 0 3px rgba(146, 10, 219, 0.15);
}

.scratch-action-btn {
    width: 100%;
    background: #0f172a;
    color: white;
    font-weight: 700;
    padding: 13px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: 0.2s;
    margin-top: 10px;
}
.scratch-action-btn:hover {
    background: #1e293b;
}

.coupon-container-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    padding: 12px;
    max-width: 320px;
    margin: 15px auto;
}

.coupon-code-text {
    font-family: monospace;
    font-size: 20px;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: 1px;
}

.coupon-copy-btn {
    background: #b979db;
    color: #0f172a;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}
.coupon-copy-btn:hover {
    background: #a554d1;
}

/* ستايل الزر العائم (Floating Button) */
.qz-floating-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: var(--qz-pop-primary);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 14px 44px 14px 22px; /* زيادة الهامش الأيمن لإعطاء مساحة لزر الإغلاق */
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(146, 10, 219, 0.35);
    cursor: pointer;
    z-index: 9999;
    display: none; /* يتم التحكم بالظهور عبر جافا سكريبت */
    align-items: center;
    gap: 8px;
    font-family: 'Tajawal', sans-serif;
    transition: transform 0.3s, background-color 0.2s;
}
.qz-floating-btn:hover {
    transform: scale(1.03);
    background: #7d07bd;
}

/* زر إغلاق داخلي للزر العائم */
.qz-floating-close-x {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    transition: background 0.2s;
}
.qz-floating-close-x:hover {
    background: rgba(255, 255, 255, 0.45);
}

/* Mobile */
@media(max-width:480px){
    .qz-pop-overlay { padding: 0; }
    .qz-pop-container{ max-width:90vw; max-height:90vh; }
    .qz-pop-hero-image{ height:120px; }
    .qz-pop-question-text, .qz-pop-welcome-title{ font-size:16px; }
    .qz-pop-welcome-desc, .qz-pop-feature-item { font-size: 14px; }
    .qz-pop-answer-card { padding: 10px 14px; font-size: 14px; }
    .qz-pop-note-box { font-size: 13px; padding: 10px 12px; margin-bottom: 14px; }
    .qz-pop-question-number-top { font-size: 12px; }
    .qz-pop-result-name { font-size: 18px; }
    .scratch-page-title { font-size: 18px; }
    .qz-floating-btn { bottom: 15px; right: 15px; padding: 12px 38px 12px 16px; font-size: 13px; }
    .qz-floating-close-x { right: 8px; width: 18px; height: 18px; font-size: 14px; }
}