/**
 * Coupon Widget Styles
 * 
 * استایل‌های ویجت کد تخفیف
 * 
 * @package Woolements
 * @since 1.0.0
 */


/* ==============================================
   پایه و ریست
============================================== */

.woolements-coupon-wrapper {
    position: relative;
    direction: rtl;
}

.woolements-coupon-wrapper * {
    box-sizing: border-box;
}


/* ==============================================
   حالت Inline
============================================== */

.woolements-coupon-wrapper:not(.woolements-coupon-popup) .woolements-coupon-container {
    position: relative;
    display: block;
}


/* ==============================================
   حالت Popup
============================================== */

.woolements-coupon-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.woolements-coupon-popup.active {
    display: flex;
}

.woolements-coupon-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1;
}

.woolements-coupon-popup .woolements-coupon-container {
    position: relative;
    z-index: 2;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: couponSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes couponSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* ==============================================
   کانتینر اصلی
============================================== */

.woolements-coupon-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
}


/* ==============================================
   دکمه بستن
============================================== */

.woolements-coupon-close {
    position: absolute;
    top: 15px;
    left: 15px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 8px;
    line-height: 1;
}

.woolements-coupon-close svg {
    display: block;
    width: 1em;
    height: 1em;
    fill: currentColor;
    transition: all 0.3s ease;
}

.woolements-coupon-close i {
    display: block;
    width: 1em;
    height: 1em;
    transition: all 0.3s ease;
}

.woolements-coupon-close:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
    transform: rotate(90deg);
}

.woolements-coupon-close:hover svg {
    fill: currentColor;
}


/* ==============================================
   عنوان
============================================== */

.woolements-coupon-title {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin: 0 0 15px 0;
    line-height: 1.4;
}


/* ==============================================
   توضیحات
============================================== */

.woolements-coupon-description {
    font-size: 16px;
    color: #666;
    margin: 0 0 25px 0;
    line-height: 1.6;
}


/* ==============================================
   مقدار تخفیف
============================================== */

.woolements-discount-amount {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 25px;
    margin: 0 0 20px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    flex-wrap: wrap;
}

.woolements-discount-label {
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
}

.woolements-discount-value {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}


/* ==============================================
   باکس کد تخفیف
============================================== */

.woolements-coupon-code-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    background: #f8f9fa;
    border: 2px dashed #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin: 0 0 25px 0;
}

.woolements-coupon-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.woolements-coupon-code {
    font-size: 24px;
    font-weight: bold;
    color: #ff6b6b;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
}

.woolements-coupon-copy-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.woolements-coupon-copy-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.woolements-coupon-copy-btn:active {
    transform: translateY(0);
}

.woolements-coupon-copy-btn.copied {
    background: #2196F3;
}


/* ==============================================
   تایمر - استایل 1 (باکس جداگانه)
============================================== */

.woolements-coupon-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 0 0 20px 0;
}

.woolements-coupon-timer.timer-style1 .woolements-timer-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    padding: 15px 20px;
    min-width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.woolements-coupon-timer.timer-style1 .woolements-timer-number {
    font-size: 32px;
    font-weight: bold;
    color: #ffffff;
    line-height: 1;
}

.woolements-coupon-timer.timer-style1 .woolements-timer-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
}


/* ==============================================
   تایمر - استایل 2 (خطی)
============================================== */

.woolements-coupon-timer.timer-style2 {
    background: #f8f9fa;
    border-radius: 50px;
    padding: 15px 30px;
    display: inline-flex;
}

.woolements-coupon-timer.timer-style2 .woolements-timer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 15px;
    border-right: 2px solid #e0e0e0;
}

.woolements-coupon-timer.timer-style2 .woolements-timer-item:last-child {
    border-right: none;
    padding-right: 0;
}

.woolements-coupon-timer.timer-style2 .woolements-timer-item:first-child {
    padding-left: 0;
}

.woolements-coupon-timer.timer-style2 .woolements-timer-number {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.woolements-coupon-timer.timer-style2 .woolements-timer-label {
    font-size: 13px;
    color: #666;
}


/* ==============================================
   تایمر - استایل 3 (دایره‌ای)
============================================== */

.woolements-coupon-timer.timer-style3 .woolements-timer-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3);
}

.woolements-coupon-timer.timer-style3 .woolements-timer-number {
    font-size: 24px;
    font-weight: bold;
    color: #ffffff;
    line-height: 1;
}

.woolements-coupon-timer.timer-style3 .woolements-timer-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.9);
}


/* ==============================================
   تایمر - استایل 4 (مینیمال)
============================================== */

.woolements-coupon-timer.timer-style4 {
    gap: 10px;
}

.woolements-coupon-timer.timer-style4 .woolements-timer-item {
    background: transparent;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.woolements-coupon-timer.timer-style4 .woolements-timer-number {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    line-height: 1;
}

.woolements-coupon-timer.timer-style4 .woolements-timer-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* ==============================================
   تعداد باقی‌مانده
============================================== */

.woolements-coupon-usage {
    font-size: 14px;
    color: #666;
    margin: 15px 0 0 0;
}

.woolements-coupon-usage strong {
    color: #ff6b6b;
    font-size: 18px;
    font-weight: bold;
}


/* ==============================================
   Responsive Design
============================================== */

@media (max-width: 768px) {
    .woolements-coupon-container {
        padding: 20px;
    }
    .woolements-coupon-title {
        font-size: 22px;
    }
    .woolements-coupon-description {
        font-size: 14px;
    }
    .woolements-discount-amount {
        padding: 12px 20px;
        gap: 8px;
    }
    .woolements-discount-label {
        font-size: 14px;
    }
    .woolements-discount-value {
        font-size: 22px;
    }
    .woolements-coupon-code {
        font-size: 20px;
    }
    .woolements-coupon-code-box {
        flex-direction: column;
        gap: 10px;
    }
    .woolements-coupon-timer {
        gap: 10px;
    }
    .woolements-coupon-timer.timer-style1 .woolements-timer-item {
        min-width: 60px;
        padding: 12px 15px;
    }
    .woolements-coupon-timer.timer-style1 .woolements-timer-number {
        font-size: 24px;
    }
    .woolements-coupon-timer.timer-style2 {
        flex-wrap: wrap;
        padding: 10px 20px;
    }
    .woolements-coupon-timer.timer-style2 .woolements-timer-item {
        padding: 0 10px;
    }
    .woolements-coupon-timer.timer-style2 .woolements-timer-number {
        font-size: 22px;
    }
    .woolements-coupon-timer.timer-style3 .woolements-timer-item {
        width: 60px;
        height: 60px;
    }
    .woolements-coupon-timer.timer-style3 .woolements-timer-number {
        font-size: 18px;
    }
    .woolements-coupon-timer.timer-style4 .woolements-timer-item {
        padding: 10px 14px;
    }
    .woolements-coupon-timer.timer-style4 .woolements-timer-number {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .woolements-coupon-title {
        font-size: 18px;
    }
    .woolements-coupon-code {
        font-size: 18px;
        letter-spacing: 1px;
    }
    .woolements-coupon-timer.timer-style1 .woolements-timer-item,
    .woolements-coupon-timer.timer-style3 .woolements-timer-item {
        min-width: 50px;
        width: 50px;
        height: 50px;
        padding: 8px 10px;
    }
    .woolements-coupon-timer.timer-style1 .woolements-timer-number,
    .woolements-coupon-timer.timer-style3 .woolements-timer-number {
        font-size: 16px;
    }
    .woolements-coupon-timer.timer-style1 .woolements-timer-label,
    .woolements-coupon-timer.timer-style3 .woolements-timer-label {
        font-size: 9px;
    }
}


/* ==============================================
   انیمیشن‌ها
============================================== */

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.woolements-coupon-code {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.woolements-coupon-container>* {
    animation: fadeIn 0.5s ease-out backwards;
}

.woolements-coupon-container>*:nth-child(1) {
    animation-delay: 0.1s;
}

.woolements-coupon-container>*:nth-child(2) {
    animation-delay: 0.2s;
}

.woolements-coupon-container>*:nth-child(3) {
    animation-delay: 0.3s;
}

.woolements-coupon-container>*:nth-child(4) {
    animation-delay: 0.4s;
}

.woolements-coupon-container>*:nth-child(5) {
    animation-delay: 0.5s;
}


/* ==============================================
   انیمیشن‌های تایمر
============================================== */


/* تنظیمات پایه برای انیمیشن */

.woolements-timer-number {
    position: relative;
    display: inline-block;
    transition: all 0.3s ease;
}


/* 1. انیمیشن محو شدن (Fade) */

@keyframes timerFade {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.woolements-coupon-timer[data-animation="fade"] .woolements-timer-number.changing {
    animation: timerFade 0.5s ease;
}


/* 2. انیمیشن اسلاید به بالا (Slide Up) */

@keyframes timerSlideUp {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px);
        opacity: 0;
    }
    51% {
        transform: translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.woolements-coupon-timer[data-animation="slide-up"] .woolements-timer-number.changing {
    animation: timerSlideUp 0.5s ease;
}


/* 3. انیمیشن اسلاید به پایین (Slide Down) */

@keyframes timerSlideDown {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateY(20px);
        opacity: 0;
    }
    51% {
        transform: translateY(-20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.woolements-coupon-timer[data-animation="slide-down"] .woolements-timer-number.changing {
    animation: timerSlideDown 0.5s ease;
}


/* 4. انیمیشن زوم (Zoom) */

@keyframes timerZoom {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.woolements-coupon-timer[data-animation="zoom"] .woolements-timer-number.changing {
    animation: timerZoom 0.5s ease;
}


/* 5. انیمیشن چرخش (Flip) */

@keyframes timerFlip {
    0% {
        transform: rotateX(0deg);
    }
    50% {
        transform: rotateX(90deg);
        opacity: 0;
    }
    51% {
        transform: rotateX(-90deg);
        opacity: 0;
    }
    100% {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

.woolements-coupon-timer[data-animation="flip"] .woolements-timer-number.changing {
    animation: timerFlip 0.5s ease;
    transform-style: preserve-3d;
}


/* 6. انیمیشن پرش (Bounce) */

@keyframes timerBounce {
    0%,
    100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-15px);
    }
    50% {
        transform: translateY(0);
    }
    75% {
        transform: translateY(-8px);
    }
}

.woolements-coupon-timer[data-animation="bounce"] .woolements-timer-number.changing {
    animation: timerBounce 0.5s ease;
}


/* 7. انیمیشن تاب خوردن (Swing) */

@keyframes timerSwing {
    0%,
    100% {
        transform: rotate(0deg);
    }
    20% {
        transform: rotate(15deg);
    }
    40% {
        transform: rotate(-10deg);
    }
    60% {
        transform: rotate(5deg);
    }
    80% {
        transform: rotate(-5deg);
    }
}

.woolements-coupon-timer[data-animation="swing"] .woolements-timer-number.changing {
    animation: timerSwing 0.5s ease;
    transform-origin: center center;
}


/* 8. انیمیشن نبض (Pulse) */

@keyframes timerPulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    25%,
    75% {
        transform: scale(1.3);
        opacity: 0.7;
    }
    50% {
        transform: scale(0.9);
        opacity: 1;
    }
}

.woolements-coupon-timer[data-animation="pulse"] .woolements-timer-number.changing {
    animation: timerPulse 0.5s ease;
}


/* حالت بدون انیمیشن */

.woolements-coupon-timer[data-animation="none"] .woolements-timer-number.changing {
    animation: none;
}


/* افکت گلو برای انیمیشن‌ها (اختیاری) */

.woolements-timer-number.changing {
    text-shadow: 0 0 10px currentColor;
}


/* ==============================================
   حالت تم تیره (اختیاری)
============================================== */

@media (prefers-color-scheme: dark) {
    .woolements-coupon-container {
        background: #1e1e1e;
        color: #ffffff;
    }
    .woolements-coupon-title {
        color: #ffffff;
    }
    .woolements-coupon-description {
        color: #b0b0b0;
    }
    .woolements-discount-amount {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    .woolements-discount-label,
    .woolements-discount-value {
        color: #ffffff;
    }
    .woolements-coupon-code-box {
        background: #2a2a2a;
        border-color: #404040;
    }
    .woolements-coupon-close {
        color: #b0b0b0;
    }
    .woolements-coupon-close:hover {
        color: #ffffff;
        background: rgba(255, 255, 255, 0.1);
    }
    .woolements-coupon-timer.timer-style2 {
        background: #2a2a2a;
    }
    .woolements-coupon-timer.timer-style2 .woolements-timer-item {
        border-color: #404040;
    }
    .woolements-coupon-timer.timer-style2 .woolements-timer-number,
    .woolements-coupon-timer.timer-style4 .woolements-timer-number {
        color: #ffffff;
    }
    .woolements-coupon-timer.timer-style4 .woolements-timer-item {
        border-color: #404040;
    }
}