/**
 * Sales Engine Plus - Frontend Styles
 * RTL-first design for Persian/Farsi sites
 */

/* ═══════════════════════════════════════
   Base & Utilities
   ═══════════════════════════════════════ */
.sep-btn {
    display: inline-block;
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-family: inherit;
    line-height: 1.5;
}
.sep-btn-primary { background: #6366f1; color: #fff; }
.sep-btn-primary:hover { background: #4f46e5; transform: translateY(-1px); box-shadow: 0 4px 15px rgba(99,102,241,0.4); }
.sep-btn-success { background: #10b981; color: #fff; }
.sep-btn-success:hover { background: #059669; }
.sep-btn-lg { padding: 14px 36px; font-size: 17px; width: 100%; }
.sep-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }
.sep-btn-added { background: #10b981 !important; pointer-events: none; }

.sep-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
    outline: none;
}
.sep-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.sep-form-group { margin-bottom: 12px; }

.sep-success { text-align: center; padding: 16px; color: #065f46; background: #d1fae5; border-radius: 8px; }
.sep-error { text-align: center; padding: 16px; color: #991b1b; background: #fef2f2; border-radius: 8px; }
.sep-info { text-align: center; padding: 16px; color: #1e40af; background: #eff6ff; border-radius: 8px; }

.sep-coupon-code {
    display: inline-block;
    padding: 8px 24px;
    background: #fff;
    border: 2px dashed #6366f1;
    border-radius: 8px;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 3px;
    color: #6366f1;
    margin: 12px 0;
    direction: ltr;
}

/* ═══════════════════════════════════════
   Exit-Intent Popup
   ═══════════════════════════════════════ */
.sep-popup-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: sepFadeIn 0.3s ease;
}
.sep-popup-box {
    background: #fff;
    border-radius: 16px;
    padding: 36px;
    max-width: 420px;
    width: 90%;
    position: relative;
    animation: sepSlideUp 0.4s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.sep-popup-close {
    position: absolute;
    top: 12px;
    left: 12px;
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}
.sep-popup-close:hover { background: #f3f4f6; color: #374151; }
.sep-popup-content { text-align: center; }
.sep-popup-icon { font-size: 48px; margin-bottom: 12px; }
.sep-popup-title { font-size: 22px; font-weight: 800; color: #111827; margin: 0 0 8px; }
.sep-popup-desc { color: #6b7280; margin: 0 0 20px; font-size: 14px; }
.sep-popup-discount-badge {
    display: inline-block;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    padding: 8px 24px;
    border-radius: 24px;
    font-size: 20px;
    font-weight: 900;
    margin-bottom: 20px;
}
.sep-popup-no-thanks { margin-top: 12px; }
.sep-popup-no-thanks a { color: #9ca3af; font-size: 13px; text-decoration: none; }
.sep-popup-no-thanks a:hover { color: #6b7280; }

/* ═══════════════════════════════════════
   Social Proof Notification
   ═══════════════════════════════════════ */
.sep-sp-notification {
    position: fixed;
    z-index: 99999;
    background: #fff;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    max-width: 340px;
    width: auto;
    transform: translateX(-100%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #f3f4f6;
}
.sep-sp-bottom-right { bottom: 20px; right: 20px; transform: translateX(100%); }
.sep-sp-bottom-left { bottom: 20px; left: 20px; transform: translateX(-100%); }
.sep-sp-top-right { top: 20px; right: 20px; transform: translateX(100%); }
.sep-sp-top-left { top: 20px; left: 20px; transform: translateX(-100%); }

.sep-sp-show { transform: translateX(0) !important; opacity: 1 !important; }

.sep-sp-content { display: flex; align-items: center; gap: 12px; }
.sep-sp-image { width: 50px; height: 50px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.sep-sp-image img { width: 100%; height: 100%; object-fit: cover; }
.sep-sp-text { font-size: 13px; line-height: 1.5; }
.sep-sp-name { color: #111827; font-weight: 700; }
.sep-sp-action { color: #6b7280; }
.sep-sp-product { color: #6366f1; font-weight: 600; }
.sep-sp-product-link { text-decoration: none; }
.sep-sp-time { display: block; color: #9ca3af; font-size: 11px; margin-top: 2px; }
.sep-sp-close {
    position: absolute;
    top: 4px;
    left: 4px;
    background: none;
    border: none;
    font-size: 16px;
    color: #d1d5db;
    cursor: pointer;
}

/* ═══════════════════════════════════════
   Free Shipping Bar
   ═══════════════════════════════════════ */
.sep-fsb {
    position: fixed;
    left: 0; right: 0;
    z-index: 99998;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 8px 20px;
    transition: all 0.3s;
}
.sep-fsb-top { top: 0; }
.sep-fsb-bottom { bottom: 0; }
.sep-fsb-inner { max-width: 800px; margin: 0 auto; text-align: center; }
.sep-fsb-text { font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 4px; }
.sep-fsb-progress {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}
.sep-fsb-fill {
    height: 100%;
    background: var(--sep-bar-color, #10b981);
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.sep-fsb-reached .sep-fsb-text { color: #059669; }
.sep-fsb-reached .sep-fsb-fill { background: #10b981; }

.sep-fsb-cart {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    text-align: center;
}
.sep-fsb-cart .sep-fsb-progress { margin-top: 8px; }
.sep-fsb-cart.sep-fsb-reached { background: #dcfce7; border-color: #86efac; }

/* ═══════════════════════════════════════
   Order Bump
   ═══════════════════════════════════════ */
.sep-order-bump {
    border: 2px dashed #fbbf24;
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0;
    background: #fffbeb;
    transition: all 0.3s;
}
.sep-order-bump:hover { border-color: #f59e0b; box-shadow: 0 4px 12px rgba(245,158,11,0.15); }
.sep-bump-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #fde68a;
}
.sep-bump-flash { font-size: 20px; animation: sepPulse 1.5s infinite; }
.sep-bump-title { font-size: 15px; font-weight: 700; color: #92400e; }
.sep-bump-body { display: flex; gap: 12px; align-items: center; }
.sep-bump-image { width: 80px; height: 80px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.sep-bump-image img { width: 100%; height: 100%; object-fit: cover; }
.sep-bump-info h4 { margin: 0 0 4px; font-size: 14px; color: #111827; }
.sep-bump-prices { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.sep-bump-prices del { color: #9ca3af; font-size: 13px; }
.sep-bump-prices ins { color: #dc2626; font-weight: 700; font-size: 15px; text-decoration: none; }
.sep-bump-save { background: #dc2626; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.sep-bump-checkbox { display: flex; align-items: center; gap: 8px; margin-top: 8px; cursor: pointer; font-size: 14px; font-weight: 600; color: #374151; }
.sep-bump-checkbox input { width: 18px; height: 18px; accent-color: #f59e0b; }

/* ═══════════════════════════════════════
   OTP Checkout
   ═══════════════════════════════════════ */
.sep-otp-login {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
}
.sep-otp-box h3 { margin: 0 0 8px; font-size: 18px; color: #1e293b; }
.sep-otp-desc { color: #64748b; font-size: 14px; margin: 0 0 16px; }
.sep-otp-digits {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 16px 0;
    direction: ltr;
}
.sep-otp-digit {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}
.sep-otp-digit:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.sep-otp-timer { margin: 12px 0; color: #64748b; font-size: 14px; }
.sep-otp-skip { margin-top: 12px; }
.sep-otp-skip a { color: #94a3b8; font-size: 13px; text-decoration: none; }

/* ═══════════════════════════════════════
   Gateway Status
   ═══════════════════════════════════════ */
.sep-gateway-notice {
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 600;
}
.sep-gateway-down { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.sep-gateway-degraded { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ═══════════════════════════════════════
   One-Click Upsell
   ═══════════════════════════════════════ */
.sep-upsell-offer {
    background: linear-gradient(135deg, #fafaf9, #fef3c7);
    border: 2px solid #fbbf24;
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    text-align: center;
    animation: sepSlideUp 0.5s ease;
}
.sep-upsell-badge {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    padding: 4px 16px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
}
.sep-upsell-title { font-size: 20px; font-weight: 800; color: #111827; margin: 0 0 12px; }
.sep-upsell-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    color: #dc2626;
    font-weight: 600;
}
.sep-timer-digits { display: flex; gap: 4px; direction: ltr; font-size: 20px; font-weight: 900; }
.sep-upsell-product { display: flex; gap: 16px; align-items: center; margin: 16px 0; text-align: right; }
.sep-upsell-image { width: 120px; height: 120px; border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.sep-upsell-image img { width: 100%; height: 100%; object-fit: cover; }
.sep-upsell-details h4 { margin: 0 0 6px; font-size: 16px; }
.sep-upsell-details p { color: #6b7280; font-size: 13px; margin: 0 0 8px; }
.sep-upsell-pricing { display: flex; gap: 8px; align-items: center; }
.sep-upsell-pricing del { color: #9ca3af; font-size: 15px; }
.sep-upsell-pricing ins { color: #dc2626; font-weight: 800; font-size: 18px; text-decoration: none; }
.sep-upsell-savings { color: #059669; font-weight: 700; margin-top: 8px; font-size: 14px; }
.sep-upsell-no { display: block; margin-top: 10px; color: #9ca3af; font-size: 13px; text-decoration: none; }

/* ═══════════════════════════════════════
   Urgency Timer
   ═══════════════════════════════════════ */
.sep-urgency-timer {
    background: linear-gradient(135deg, #fef2f2, #fff1f2);
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 16px;
    margin: 12px 0;
    text-align: center;
}
.sep-timer-label { font-size: 13px; color: #991b1b; font-weight: 600; margin-bottom: 6px; }
.sep-timer-countdown { display: flex; align-items: center; justify-content: center; gap: 4px; direction: ltr; }
.sep-timer-unit { text-align: center; }
.sep-timer-num {
    display: inline-block;
    background: #dc2626;
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 22px;
    font-weight: 900;
    min-width: 44px;
}
.sep-timer-unit small { display: block; color: #991b1b; font-size: 10px; margin-top: 2px; }
.sep-timer-sep { font-size: 20px; font-weight: 900; color: #dc2626; }
.sep-timer-mini { color: #dc2626; font-size: 12px; font-weight: 600; margin-top: 4px; }

/* ═══════════════════════════════════════
   Smart Bundle
   ═══════════════════════════════════════ */
.sep-smart-bundle {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    margin: 24px 0;
}
.sep-bundle-title { text-align: center; font-size: 18px; font-weight: 800; color: #111827; margin: 0 0 20px; }
.sep-bundle-products { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.sep-bundle-item { text-align: center; min-width: 100px; }
.sep-bundle-img { width: 80px; height: 80px; border-radius: 8px; overflow: hidden; margin: 0 auto 6px; }
.sep-bundle-img img { width: 100%; height: 100%; object-fit: cover; }
.sep-bundle-name { font-size: 12px; color: #374151; font-weight: 600; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sep-bundle-price { font-size: 12px; color: #6b7280; margin-top: 2px; }
.sep-bundle-plus { font-size: 24px; font-weight: 900; color: #6366f1; }
.sep-bundle-check-label { cursor: pointer; display: block; }
.sep-bundle-checkbox { position: absolute; opacity: 0; }
.sep-bundle-check-label:has(input:not(:checked)) { opacity: 0.4; }
.sep-bundle-summary { text-align: center; border-top: 1px solid #e5e7eb; padding-top: 16px; }
.sep-bundle-total-row { margin: 4px 0; font-size: 14px; color: #6b7280; }
.sep-bundle-total-row del { color: #9ca3af; }
.sep-bundle-discount-row ins { color: #dc2626; font-weight: 800; font-size: 18px; text-decoration: none; }
.sep-bundle-savings { color: #059669; font-weight: 700; margin-top: 8px; font-size: 15px; }

/* ═══════════════════════════════════════
   Stock Alert
   ═══════════════════════════════════════ */
.sep-stock-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    margin: 8px 0;
}
.sep-stock-animated .sep-stock-icon { animation: sepPulse 1s infinite; }
.sep-stock-text { font-size: 13px; font-weight: 700; color: #991b1b; flex: 1; }
.sep-stock-bar { height: 4px; background: #fecaca; border-radius: 2px; flex: 0 0 60px; }
.sep-stock-fill { height: 100%; background: #ef4444; border-radius: 2px; transition: width 0.3s; }
.sep-stock-badge {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

/* ═══════════════════════════════════════
   Spin Wheel
   ═══════════════════════════════════════ */
.sep-spin-trigger {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99998;
    animation: sepBounce 2s infinite;
}
.sep-spin-btn-open {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99,102,241,0.4);
    font-family: inherit;
}
.sep-spin-container {
    background: #fff;
    border-radius: 20px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    position: relative;
    animation: sepSlideUp 0.4s ease;
    text-align: center;
}
.sep-spin-title { font-size: 20px; font-weight: 800; color: #111827; margin: 0 0 20px; }
.sep-spin-wheel-wrapper { position: relative; display: inline-block; margin-bottom: 20px; }
.sep-spin-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    color: #ef4444;
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* ═══════════════════════════════════════
   Animations
   ═══════════════════════════════════════ */
@keyframes sepFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sepSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sepPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes sepBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ═══════════════════════════════════════
   Responsive
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
    .sep-popup-box { padding: 24px 16px; }
    .sep-upsell-product { flex-direction: column; text-align: center; }
    .sep-bundle-products { gap: 4px; }
    .sep-bundle-item { min-width: 70px; }
    .sep-bundle-img { width: 60px; height: 60px; }
    .sep-sp-notification { max-width: 300px; }
    .sep-otp-digit { width: 40px; height: 48px; font-size: 20px; }
}
