/**
 * تصميم النشرة البريدية - ستايل شي إن
 * يطلع من اليسار مع تاب جانبي
 */

/* ===== المودال الأساسي ===== */
.newsletter-popup {
    position: fixed !important;
    top: 50% !important;
    left: -340px !important;
    transform: translateY(-50%) !important;
    width: 340px !important;
    z-index: 999999 !important;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease !important;
    pointer-events: all !important;
    opacity: 0;
}

/* المرحلة الأولى: إظهار التاب فقط (النافذة 340px + التاب 40px = يجب إخفاء 340px) */
.newsletter-popup.tab-visible {
    left: -340px !important;
    opacity: 1 !important;
}

/* المرحلة الثانية: فتح النافذة كاملة */
.newsletter-popup.show {
    left: 0 !important;
    opacity: 1 !important;
}

/* إخفاء الـ overlay */
.popup-overlay {
    display: none !important;
}

/* ===== المحتوى ===== */
.popup-content {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%) !important;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25) !important;
    border-radius: 0 !important;
    padding: 30px 25px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
}

/* ===== إخفاء العناصر القديمة ===== */
.popup-close,
.popup-header,
.popup-icon,
.popup-features,
.privacy-note,
.input-group,
.newsletter-image,
.newsletter-divider,
.newsletter-info {
    display: none !important;
}

/* ===== التاب الجانبي - طويل ومتلاصق ===== */
.popup-toggle {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    right: -40px !important;
    width: 40px !important;
    height: auto !important;
    background: #374151 !important;
    color: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    text-align: center !important;
    writing-mode: vertical-rl !important;
    text-orientation: mixed !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    letter-spacing: 2px !important;
    cursor: pointer !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.25) !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.popup-toggle:hover {
    background: #1f2937 !important;
    width: 45px !important;
}

.popup-toggle i {
    display: none !important;
}

.popup-toggle::after {
    content: "اشترك معنا" !important;
}

/* ===== الجسم الرئيسي ===== */
.popup-body {
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
    background: transparent !important;
}

/* ===== العنوان ===== */
.newsletter-title {
    color: #ffffff !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    text-align: center !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

/* ===== العرض ===== */
.newsletter-subtitle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin: 5px 0;
}

.newsletter-offer {
    text-align: center;
}

.newsletter-offer .discount {
    color: #fbbf24 !important;
    font-size: 52px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.newsletter-offer .discount-label {
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    margin-top: 5px;
}

.popup-body > p {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 14px !important;
    text-align: center !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    display: block !important;
}

/* ===== النموذج ===== */
.subscription-form {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    margin-top: 5px !important;
    background: transparent !important;
    padding: 0 !important;
}

.email-input {
    width: 100% !important;
    padding: 14px 15px !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-family: 'Cairo', sans-serif !important;
    background: #ffffff !important;
    color: #1f2937 !important;
    outline: none !important;
    text-align: right !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box !important;
}

.email-input:focus {
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3) !important;
}

.email-input::placeholder {
    color: #9ca3af !important;
}

/* حقل الاسم */
.name-input {
    width: 100% !important;
    padding: 14px 15px !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-family: 'Cairo', sans-serif !important;
    background: #ffffff !important;
    color: #1f2937 !important;
    outline: none !important;
    text-align: right !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box !important;
}

.name-input:focus {
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3) !important;
}

.name-input::placeholder {
    color: #9ca3af !important;
}

/* زر الاشتراك */
.btn-subscribe,
.btn-subscribe-visitor {
    width: 100% !important;
    padding: 14px 25px !important;
    background: #fbbf24 !important;
    color: #374151 !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    font-family: 'Cairo', sans-serif !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.btn-subscribe:hover,
.btn-subscribe-visitor:hover {
    background: #f59e0b !important;
}

.btn-subscribe i,
.btn-subscribe-visitor i {
    display: none !important;
}

/* ===== نص الشروط ===== */
.newsletter-terms {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    line-height: 1.4;
    margin-top: 5px;
}

.newsletter-terms a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: underline;
}

/* ===== رسائل التحقق ===== */
.email-validation-message {
    display: none !important;
}

.popup-message {
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 13px;
    text-align: center;
    width: 100%;
}

.popup-message.success {
    background: rgba(255,255,255,0.2);
    color: #ffffff;
}

.popup-message.error {
    background: rgba(239, 68, 68, 0.3);
    color: #ffffff;
}

/* ===== الأيقونة اللاصقة - مخفية ===== */
.newsletter-sticky-icon {
    display: none !important;
}

/* ===== التصميم المتجاوب ===== */
@media (max-width: 768px) {
    .newsletter-popup {
        top: auto !important;
        bottom: 80px !important;
        transform: none !important;
        width: 280px !important;
        left: -280px !important;
    }
    
    /* المرحلة الأولى: إظهار التاب فقط - الشاشات الصغيرة (280px عرض النافذة) */
    .newsletter-popup.tab-visible {
        left: -280px !important;
        opacity: 1 !important;
    }
    
    /* المرحلة الثانية: فتح النافذة كاملة - الشاشات الصغيرة */
    .newsletter-popup.show {
        left: 0 !important;
        opacity: 1 !important;
    }
    
    .popup-content {
        padding: 20px 15px !important;
        border-radius: 0 !important;
    }
    
    .popup-toggle {
        top: 0 !important;
        bottom: 0 !important;
        right: -35px !important;
        width: 35px !important;
        font-size: 12px !important;
        letter-spacing: 1px !important;
        border-radius: 0 !important;
    }
    
    .newsletter-title {
        font-size: 16px !important;
    }
    
    .newsletter-offer .discount {
        font-size: 36px !important;
    }
    
    .newsletter-offer .discount-label {
        font-size: 13px !important;
    }
    
    .popup-body > p {
        font-size: 12px !important;
    }
    
    .email-input,
    .name-input {
        padding: 12px !important;
        font-size: 13px !important;
    }
    
    .btn-subscribe,
    .btn-subscribe-visitor {
        padding: 12px 20px !important;
        font-size: 14px !important;
    }
    
    .newsletter-terms {
        font-size: 10px !important;
    }
}

/* شاشات أصغر */
@media (max-width: 480px) {
    .newsletter-popup {
        bottom: 60px !important;
        width: 260px !important;
        left: -260px !important;
    }
    
    /* المرحلة الأولى: إظهار التاب فقط - الشاشات الأصغر (260px عرض النافذة) */
    .newsletter-popup.tab-visible {
        left: -260px !important;
        opacity: 1 !important;
    }
    
    .newsletter-popup.show {
        left: 0 !important;
    }
    
    .popup-toggle {
        right: -32px !important;
        width: 32px !important;
        font-size: 11px !important;
    }
    
    .popup-content {
        padding: 15px 12px !important;
        border-radius: 0 !important;
    }
    
    .newsletter-title {
        font-size: 14px !important;
    }
    
    .newsletter-offer .discount {
        font-size: 32px !important;
    }
    
    .newsletter-offer .discount-label {
        font-size: 12px !important;
    }
}

/* ===== تحسينات الأداء ===== */
.newsletter-popup {
    will-change: left;
}


/* ===== زر الإخفاء النهائي (X) - شريط فوق التاب ===== */
.popup-dismiss {
    position: absolute !important;
    top: -28px !important;
    right: -40px !important;
    width: 40px !important;
    height: 28px !important;
    background: #374151 !important;
    border: none !important;
    border-radius: 8px 8px 0 0 !important;
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 12px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    z-index: 100 !important;
    visibility: visible !important;
    opacity: 1 !important;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.2) !important;
}

.popup-dismiss:hover {
    background: #1f2937 !important;
    color: white !important;
}

.popup-dismiss:hover i {
    color: #ef4444 !important;
}

@media (max-width: 768px) {
    .popup-dismiss {
        top: -24px !important;
        right: -35px !important;
        width: 35px !important;
        height: 24px !important;
        font-size: 11px !important;
    }
}

@media (max-width: 480px) {
    .popup-dismiss {
        top: -22px !important;
        right: -32px !important;
        width: 32px !important;
        height: 22px !important;
        font-size: 10px !important;
    }
}
