/* ویجت قیمت ارزها - استایل پیشرفته با انیمیشن */
@font-face {
    font-family: 'Vazir';
    src: url('https://cdnjs.cloudflare.com/ajax/libs/vazir-font/30.1.0/Vazir-Regular.eot');
    src: url('https://cdnjs.cloudflare.com/ajax/libs/vazir-font/30.1.0/Vazir-Regular.eot?#iefix') format('embedded-opentype'),
         url('https://cdnjs.cloudflare.com/ajax/libs/vazir-font/30.1.0/Vazir-Regular.woff2') format('woff2'),
         url('https://cdnjs.cloudflare.com/ajax/libs/vazir-font/30.1.0/Vazir-Regular.woff') format('woff'),
         url('https://cdnjs.cloudflare.com/ajax/libs/vazir-font/30.1.0/Vazir-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazir', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --positive-color: #27ae60;
    --negative-color: #e74c3c;
    --gradient-blue: linear-gradient(135deg, #00c6fb 0%, #005bea 100%);
    --gradient-purple: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    --gradient-green: linear-gradient(135deg, #00b09b 0%, #96c93d 100%);
    --gradient-orange: linear-gradient(135deg, #f2994a 0%, #f2c94c 100%);
    --gradient-red: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    --card-shadow-hover: 0 15px 30px rgba(0, 0, 0, 0.15);
    --border-radius: 16px;
}

/* کانتینر اصلی با پس‌زمینه شفاف */
.currency-exchange-container {
    font-family: 'Vazir', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: transparent;
    max-width: 1200px;
    margin: 20px auto;
    overflow: visible;
    direction: rtl;
}

/* هدر */
.currency-exchange-header {
    background: var(--gradient-purple);
    color: #fff;
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(106, 17, 203, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

.currency-exchange-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    transform: rotate(30deg);
    z-index: 1;
}

.currency-exchange-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    position: relative;
    z-index: 2;
}

/* جستجو */
.currency-exchange-search {
    position: relative;
    width: 300px;
    z-index: 2;
}

.currency-exchange-search input {
    width: 100%;
    padding: 12px 15px;
    padding-right: 45px;
    border-radius: 30px;
    border: none;
    font-family: inherit;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.currency-exchange-search input:focus {
    outline: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.currency-exchange-search i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #777;
    font-size: 16px;
    transition: all 0.3s ease;
}

.currency-exchange-search input:focus + i {
    color: var(--secondary-color);
}

.last-update-container {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* گرید کارت‌ها */
.currency-exchange-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    padding: 10px;
    margin-bottom: 20px;
}

/* کارت ارز */
.currency-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 1;
    transform: translateZ(0);
    -webkit-font-smoothing: subpixel-antialiased;
    backface-visibility: hidden;
}

.currency-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--card-shadow-hover);
    z-index: 10;
}

.currency-card:nth-child(5n+1) .currency-card-header {
    background: var(--gradient-blue);
}

.currency-card:nth-child(5n+2) .currency-card-header {
    background: var(--gradient-purple);
}

.currency-card:nth-child(5n+3) .currency-card-header {
    background: var(--gradient-green);
}

.currency-card:nth-child(5n+4) .currency-card-header {
    background: var(--gradient-orange);
}

.currency-card:nth-child(5n+5) .currency-card-header {
    background: var(--gradient-red);
}

/* هدر کارت */
.currency-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.currency-card-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
    transform: rotate(30deg);
}

.currency-flag {
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    animation: pulse 3s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.currency-name-container {
    flex: 1;
    margin: 0 15px;
}

.currency-name-fa {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 5px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.currency-name-en {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

/* بدنه کارت */
.currency-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.price-container {
    padding: 12px 15px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.price-container:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
    background-color: #fff;
}

.price-label {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 8px;
    font-weight: 500;
}

.price-value {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.buy-price {
    color: var(--primary-color);
}

.sell-price {
    color: var(--secondary-color);
}

.currency-unit {
    font-size: 13px;
    color: #6c757d;
    margin-right: 3px;
}

/* فوتر کارت */
.currency-card-footer {
    padding: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 12px;
    color: #6c757d;
    text-align: left;
    background-color: #fff;
}

/* تغییرات */
.currency-change {
    display: flex;
    align-items: center;
    justify-content: center;
}

.change-percent {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    min-width: 80px;
    text-align: center;
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
}

.positive i, .negative i {
    margin-left: 5px;
    font-size: 12px;
}

/* فوتر */
.currency-exchange-footer {
    padding: 20px;
    background: var(--gradient-blue);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 198, 251, 0.2);
    color: #fff;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.currency-exchange-footer::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    transform: rotate(30deg);
}

.currency-exchange-disclaimer {
    position: relative;
    font-size: 14px;
    line-height: 1.5;
    z-index: 1;
}

/* ریسپانسیو */
@media (max-width: 991px) {
    .currency-exchange-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .currency-exchange-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }
    
    .currency-exchange-search {
        margin: 15px 0;
        width: 100%;
    }
    
    .last-update-container {
        width: 100%;
        margin-top: 15px;
    }
}

@media (max-width: 575px) {
    .currency-exchange-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .currency-card {
        margin-bottom: 5px;
    }
}

/* انیمیشن‌های به‌روزرسانی */
.flash-update {
    animation: flash-update 1.2s ease-out;
}

@keyframes flash-update {
    0% { transform: translateY(0) scale(1); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08); }
    20% { transform: translateY(-15px) scale(1.05); box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15); }
    40% { transform: translateY(0) scale(1); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08); }
    60% { transform: translateY(-8px) scale(1.02); box-shadow: 0 12px 25px rgba(0, 0, 0, 0.12); }
    100% { transform: translateY(0) scale(1); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08); }
}

/* انیمیشن‌های ورود عناصر */
.currency-exchange-header {
    animation: slideDown 0.6s ease-out forwards;
}

.currency-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تاخیر در انیمیشن کارت‌ها */
.currency-card:nth-child(1) { animation-delay: 0.1s; }
.currency-card:nth-child(2) { animation-delay: 0.2s; }
.currency-card:nth-child(3) { animation-delay: 0.3s; }
.currency-card:nth-child(4) { animation-delay: 0.4s; }
.currency-card:nth-child(5) { animation-delay: 0.5s; }
.currency-card:nth-child(6) { animation-delay: 0.6s; }
.currency-card:nth-child(7) { animation-delay: 0.7s; }
.currency-card:nth-child(8) { animation-delay: 0.8s; }
.currency-card:nth-child(9) { animation-delay: 0.9s; }
.currency-card:nth-child(10) { animation-delay: 1s; }
.currency-card:nth-child(11) { animation-delay: 1.1s; }
.currency-card:nth-child(12) { animation-delay: 1.2s; }
.currency-card:nth-child(13) { animation-delay: 1.3s; }
.currency-card:nth-child(14) { animation-delay: 1.4s; }
.currency-card:nth-child(15) { animation-delay: 1.5s; }
.currency-card:nth-child(16) { animation-delay: 1.6s; }
.currency-card:nth-child(17) { animation-delay: 1.7s; }
.currency-card:nth-child(18) { animation-delay: 1.8s; }

/* اثر موج در هدر کارت‌ها */
.currency-card-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, transparent 20%, rgba(255,255,255,0) 70%);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    mix-blend-mode: overlay;
}

.currency-card:hover .currency-card-header::after {
    opacity: 1;
    background-position: center;
    transform: scale(1.5);
}

/* انیمیشن پس‌زمینه فوتر */
.currency-exchange-footer {
    animation: gradientAnimation 10s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* استایل دکمه به‌روزرسانی دستی */
.manual-refresh-button {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 3px 10px;
    margin-right: 10px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.manual-refresh-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.manual-refresh-button i {
    font-size: 10px;
}

/* بهبود استایل آیکون به‌روزرسانی */
.update-icon {
    margin-right: 5px;
    color: #ffeb3b;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* بهبود استایل شمارش معکوس */
.next-update-countdown {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#countdown-timer {
    min-width: 40px;
    display: inline-block;
    text-align: center;
}

.countdown-ending {
    animation: blink 0.8s infinite alternate;
}

@keyframes blink {
    from { opacity: 1; color: #ffeb3b; }
    to { opacity: 0.5; color: #ff5252; }
}

/* بهبود اعلان به‌روزرسانی */
.update-notification {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 0;
    max-width: 350px;
    min-width: 250px;
    overflow: hidden;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
}

.update-notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification-content {
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 10px;
    font-size: 14px;
}

.update-notification.success {
    border-top: 5px solid #27ae60;
}

.update-notification.error {
    border-top: 5px solid #e74c3c;
}

.update-notification.success i {
    color: #27ae60;
    font-size: 20px;
}

.update-notification.error i {
    color: #e74c3c;
    font-size: 20px;
}