/* ============================================
   Berenjo Promotion Engine — Frontend Styles v2
   ============================================ */

/* ===== Weight Badge ===== */
.berenjo-weight-badge {
    display: inline-block;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    margin-right: 6px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.2);
}

/* ===== Cart Progress ===== */
.berenjo-cart-progress {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 18px 22px;
    border-radius: 14px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
    direction: rtl;
    text-align: right;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.berenjo-cart-progress h4 {
    margin: 0 0 14px 0;
    font-size: 16px;
    color: #2c3e50;
    font-weight: 700;
}

.berenjo-cart-progress__bar {
    background: #e9ecef;
    border-radius: 12px;
    height: 22px;
    overflow: hidden;
    margin: 12px 0;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.berenjo-cart-progress__fill {
    background: linear-gradient(90deg, #27ae60, #2ecc71, #27ae60);
    background-size: 200% 100%;
    height: 100%;
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    animation: berenjo-shimmer 2s infinite;
}

@keyframes berenjo-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.berenjo-cart-progress__labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #6c757d;
    margin-top: 6px;
    font-weight: 500;
}

.berenjo-cart-progress__current {
    color: #27ae60;
    margin: 12px 0 0;
    font-size: 14px;
    font-weight: 600;
}

.berenjo-cart-progress__next {
    color: #e67e22;
    margin: 6px 0 0;
    font-size: 14px;
    font-weight: 600;
}

/* ===== Smart Offer ===== */
.berenjo-smart-offer-row td {
    padding: 0 !important;
    border: none !important;
}

.berenjo-smart-offer {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    border-radius: 10px;
    padding: 14px 18px;
    margin: 8px 0;
    text-align: center;
    font-size: 15px;
    color: #e65100;
    border: 1px solid #ffe0b2;
    font-weight: 600;
    animation: berenjo-pulse 2s infinite;
}

@keyframes berenjo-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.01); }
}

.berenjo-smart-offer__icon {
    font-size: 20px;
    margin-left: 6px;
    display: inline-block;
    animation: berenjo-fire 1s infinite alternate;
}

@keyframes berenjo-fire {
    0% { transform: scale(1); }
    100% { transform: scale(1.2); }
}

/* ===== Loyalty Card ===== */
.berenjo-loyalty-card {
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    direction: rtl;
    text-align: right;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.berenjo-loyalty-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.berenjo-loyalty-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    opacity: 0.03;
    background: radial-gradient(circle, currentColor 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
}

.berenjo-loyalty-card > * {
    position: relative;
    z-index: 1;
}

.berenjo-loyalty-card h3 {
    margin-top: 0;
    font-size: 19px;
    color: #2c3e50;
}

.berenjo-loyalty-card__level-name {
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.berenjo-loyalty-card__stats {
    color: #555;
    margin: 10px 0;
    font-size: 14px;
    line-height: 1.8;
}

.berenjo-loyalty-card__next {
    background: rgba(0,0,0,0.04);
    border-radius: 10px;
    padding: 12px 16px;
    margin-top: 14px;
    font-size: 13px;
    color: #666;
    border-right: 3px solid currentColor;
}

/* ===== Active Discount Badge ===== */
.berenjo-active-discount-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.3);
    animation: berenjo-badge-pop 0.5s ease;
}

@keyframes berenjo-badge-pop {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.berenjo-discount-icon {
    margin-left: 6px;
    font-size: 16px;
}

/* ===== Weight Discount Info ===== */
.berenjo-weight-discount-info {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 12px 0;
    border: 1px solid #a5d6a7;
    direction: rtl;
}

.berenjo-weight-discount-info h4 {
    margin: 0 0 10px 0;
    color: #2e7d32;
    font-size: 15px;
}

.berenjo-weight-current {
    color: #27ae60;
    font-weight: 600;
    margin: 6px 0;
}

.berenjo-weight-next {
    color: #e67e22;
    font-weight: 600;
    margin: 6px 0;
}

.berenjo-weight-max {
    color: #9c27b0;
    font-weight: 600;
    margin: 6px 0;
}

/* ===== Login Required ===== */
.berenjo-login-required {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 10px;
    padding: 14px 18px;
    text-align: center;
    color: #856404;
    font-size: 14px;
}

/* ============================================
   SPIN WHEEL — Popup Modal
   ============================================ */

.berenjo-wheel-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    justify-content: center;
    align-items: center;
    direction: rtl;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.berenjo-wheel-modal.is-active {
    display: flex;
    opacity: 1;
}

.berenjo-wheel-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.berenjo-wheel-modal__content {
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 24px;
    max-width: 520px;
    width: 92%;
    text-align: center;
    position: relative;
    box-shadow: 0 25px 80px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.berenjo-wheel-modal.is-active .berenjo-wheel-modal__content {
    transform: scale(1) translateY(0);
}

.berenjo-wheel-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0,0,0,0.05);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.berenjo-wheel-modal__close:hover {
    background: rgba(0,0,0,0.1);
    color: #333;
    transform: rotate(90deg);
}

/* Header */
.berenjo-wheel-modal__header {
    padding: 28px 24px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.berenjo-wheel-modal__header::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(180deg, transparent, #f8f9fa);
}

.berenjo-wheel-modal__icon {
    font-size: 48px;
    margin-bottom: 8px;
    display: inline-block;
    animation: berenjo-wheel-bounce 2s infinite;
}

@keyframes berenjo-wheel-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.berenjo-wheel-modal__title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.berenjo-wheel-modal__subtitle {
    margin: 8px 0 0;
    font-size: 14px;
    color: rgba(255,255,255,0.9);
}

/* Body */
.berenjo-wheel-modal__body {
    padding: 20px 24px;
}

/* Wheel Container */
.berenjo-wheel__container {
    margin: 0 auto;
    width: 280px;
    height: 280px;
    position: relative;
}

.berenjo-wheel__glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.15) 0%, transparent 70%);
    animation: berenjo-wheel-glow 3s infinite alternate;
}

@keyframes berenjo-wheel-glow {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}

#berenjo-wheel-canvas {
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}

.berenjo-wheel__pointer {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.berenjo-wheel__pointer-triangle {
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-top: 28px solid #e74c3c;
    filter: drop-shadow(0 2px 4px rgba(231, 76, 60, 0.4));
    animation: berenjo-pointer-wiggle 1.5s infinite;
}

@keyframes berenjo-pointer-wiggle {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

.berenjo-wheel__center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #fff, #f0f0f0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 15px rgba(0,0,0,0.15), inset 0 1px 3px rgba(255,255,255,0.8);
    z-index: 5;
    border: 3px solid #fff;
}

.berenjo-wheel__center-icon {
    font-size: 24px;
}

/* Prize Preview Tags */
.berenjo-wheel__prizes-preview {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.berenjo-wheel__prize-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--prize-color);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.berenjo-wheel__prize-tag:hover {
    transform: translateY(-2px);
}

.berenjo-wheel__prize-icon {
    font-size: 14px;
}

/* Footer */
.berenjo-wheel-modal__footer {
    padding: 0 24px 28px;
}

.berenjo-wheel__input-group {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 14px;
    transition: border-color 0.3s;
}

.berenjo-wheel__input-group:focus-within {
    border-color: #667eea;
}

.berenjo-wheel__input-prefix {
    padding: 10px 12px;
    font-size: 13px;
    color: #6c757d;
    font-weight: 600;
    border-left: 1px solid #dee2e6;
    white-space: nowrap;
}

.berenjo-wheel__phone {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 12px;
    font-size: 16px;
    text-align: left;
    direction: ltr;
    font-family: 'Segoe UI', monospace;
    outline: none;
    color: #2c3e50;
}

.berenjo-wheel__phone::placeholder {
    color: #adb5bd;
}

.berenjo-wheel__spin-btn {
    position: relative;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    letter-spacing: 1px;
}

.berenjo-wheel__spin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

.berenjo-wheel__spin-btn:active {
    transform: translateY(0);
}

.berenjo-wheel__spin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.berenjo-wheel__spin-btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: berenjo-shine 3s infinite;
}

@keyframes berenjo-shine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

.berenjo-wheel__result {
    display: none;
    margin-top: 16px;
    padding: 18px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.7;
    animation: berenjo-result-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes berenjo-result-pop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.berenjo-wheel__result.is-success {
    display: block;
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border: 2px solid #a5d6a7;
}

.berenjo-wheel__result.is-error {
    display: block;
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border: 2px solid #e57373;
}

.berenjo-wheel__coupon-code {
    display: inline-block;
    background: #fff;
    padding: 8px 18px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    margin-top: 10px;
    border: 2px dashed #27ae60;
    color: #27ae60;
    font-weight: 800;
    letter-spacing: 2px;
    animation: berenjo-coupon-glow 1.5s infinite alternate;
}

@keyframes berenjo-coupon-glow {
    0% { box-shadow: 0 0 5px rgba(39, 174, 96, 0.2); }
    100% { box-shadow: 0 0 20px rgba(39, 174, 96, 0.4); }
}

/* ===== Inline Wheel ===== */
.berenjo-spin-wheel-inline {
    background: linear-gradient(180deg, #ffffff, #f8f9fa);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    text-align: center;
}

.berenjo-wheel-inline-title {
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 16px;
    font-weight: 700;
}

.berenjo-wheel-inline__container {
    max-width: 340px;
    margin: 0 auto;
}

.berenjo-wheel-inline__canvas-wrap {
    position: relative;
    width: 260px;
    height: 260px;
    margin: 0 auto 16px;
}

.berenjo-wheel-inline__pointer {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 22px solid #e74c3c;
    z-index: 10;
}

.berenjo-wheel-inline__form {
    margin-top: 16px;
}

/* ===== Trigger Button ===== */
.berenjo-spin-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.3);
}

.berenjo-spin-trigger-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.4);
}

/* ===== Confetti Animation (for win) ===== */
.berenjo-confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100000;
}

.berenjo-confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: berenjo-confetti-fall 3s ease-out forwards;
}

@keyframes berenjo-confetti-fall {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .berenjo-wheel-modal__content {
        width: 95%;
        border-radius: 18px;
    }

    .berenjo-wheel__container {
        width: 240px;
        height: 240px;
    }

    #berenjo-wheel-canvas {
        width: 240px !important;
        height: 240px !important;
    }

    .berenjo-wheel-modal__header {
        padding: 20px 16px 12px;
    }

    .berenjo-wheel-modal__title {
        font-size: 18px;
    }

    .berenjo-wheel__prizes-preview {
        gap: 5px;
    }

    .berenjo-wheel__prize-tag {
        padding: 4px 8px;
        font-size: 11px;
    }

    .berenjo-cart-progress {
        padding: 14px 16px;
    }

    .berenjo-loyalty-card {
        padding: 18px;
    }
}

/* ===== Exit Intent Toast ===== */
.berenjo-exit-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    z-index: 99998;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    direction: rtl;
}

.berenjo-exit-toast.is-visible {
    transform: translateX(-50%) translateY(0);
}

.berenjo-exit-toast__icon {
    margin-left: 6px;
    font-size: 16px;
}


/* ===== Weight Discount Info (Max Tier) ===== */
.berenjo-weight-discount-info {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 12px 0;
    border: 1px solid #a5d6a7;
    direction: rtl;
    text-align: right;
}

.berenjo-weight-discount-info h4 {
    margin: 0 0 10px 0;
    color: #2e7d32;
    font-size: 15px;
    font-weight: 700;
}

.berenjo-weight-current {
    color: #27ae60;
    font-weight: 600;
    margin: 6px 0;
    font-size: 14px;
}

.berenjo-weight-next {
    color: #e67e22;
    font-weight: 600;
    margin: 6px 0;
    font-size: 14px;
}

.berenjo-weight-max {
    color: #9c27b0;
    font-weight: 700;
    margin: 6px 0;
    font-size: 14px;
}

.berenjo-weight-max-label {
    display: inline-block;
    background: rgba(156, 39, 176, 0.1);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 6px;
    color: #7b1fa2;
}

/* ===== Better integration with Berenjo theme ===== */
.berenjo-cart-progress,
.berenjo-smart-offer,
.berenjo-loyalty-card,
.berenjo-weight-discount-info {
    font-family: inherit;
    box-sizing: border-box;
}

/* Fix for cart totals table */
.berenjo-smart-offer-row td {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* Ensure proper RTL */
.berenjo-cart-progress *,
.berenjo-weight-discount-info *,
.berenjo-loyalty-card * {
    text-align: right;
}

/* ===== Max Tier Badge ===== */
.berenjo-max-tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #9c27b0, #e91e63);
    color: #fff;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(156, 39, 176, 0.3);
}
