/**
 * Top-up Shortcode Styles
 *
 * @package Steam_Prices
 * @since 2.0.0
 */

/* Main container */
.topup-container {
    background: linear-gradient(to bottom, #ffffff, #f8f9fa);
    border-radius: 12px;
    padding: 28px;
    max-width: 500px;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e8;
}

/* Region selector section */
.topup-region-selector {
    margin-bottom: 20px;
}

.topup-region-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.topup-region-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
}

.topup-region-select:focus {
    outline: none;
    border-color: #4C75B8;
    box-shadow: 0 0 0 3px rgba(76, 117, 184, 0.1);
}

/* Amount selector section */
.topup-amount-selector {
    margin-bottom: 24px;
}

.topup-amount-selector label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 15px;
}

.topup-slider-wrapper {
    position: relative;
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 4px 0;
}

/* Slider styling */
.topup-slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #e0e0e0, #f0f0f0);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: background 0.2s;
}

.topup-slider:hover {
    background: linear-gradient(to right, #d5d5d5, #e8e8e8);
}

.topup-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5a8fd8, #4C75B8);
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 3px 6px rgba(76, 117, 184, 0.3);
    transition: all 0.2s ease;
}

.topup-slider::-webkit-slider-thumb:hover {
    background: linear-gradient(135deg, #4C75B8, #3a5490);
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(76, 117, 184, 0.4);
}

.topup-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5a8fd8, #4C75B8);
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 3px 6px rgba(76, 117, 184, 0.3);
    transition: all 0.2s ease;
}

.topup-slider::-moz-range-thumb:hover {
    background: linear-gradient(135deg, #4C75B8, #3a5490);
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(76, 117, 184, 0.4);
}

/* Amount input */
.topup-amount-input {
    width: 85px !important;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    background: #fff;
}

.topup-amount-input:focus {
    outline: none;
    border-color: #4C75B8;
    box-shadow: 0 0 0 4px rgba(76, 117, 184, 0.12);
    background: #fafbfc;
}

/* Currency symbol */
.topup-currency {
    font-weight: 500;
    color: #6c757d;
    font-size: 13px;
    white-space: nowrap;
}

/* Price display section */
.topup-price-display {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e3e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    direction: ltr;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.topup-price-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.topup-price-row:last-child {
    margin-bottom: 0;
}

.topup-price-label {
    font-weight: 600;
    color: #5a6c7d;
    font-size: 15px;
    direction: rtl;
}

.topup-price-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c5aa0;
    direction: rtl;
}

/* Make currency smaller than price */
.topup-price-value .woocommerce-Price-amount {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    direction: rtl;
}

.topup-price-value .woocommerce-Price-currencySymbol {
    font-size: 0.55em;
    font-weight: 500;
    color: #6c757d;
    margin-right: 3px;
    vertical-align: baseline;
}

/* Additional currency styling for consistency */
.topup-price-value bdi {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
}

.topup-price-value .amount {
    display: inline-flex;
    align-items: baseline;
}

/* Automatic Delivery Section */
.topup-automatic-delivery {
    margin: 20px 0;
    padding: 16px;
    background: linear-gradient(135deg, #e8f4fd 0%, #f0f7ff 100%);
    border-radius: 8px;
    border: 2px solid #c5ddf5;
    transition: all 0.2s ease;
}

.topup-automatic-delivery:hover {
    border-color: #4C75B8;
    box-shadow: 0 2px 6px rgba(76, 117, 184, 0.1);
}

.topup-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #2c3e50;
}

.topup-automatic-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #4C75B8;
}

.topup-automatic-info {
     margin-top: 12px;
     padding: 12px;
     background: rgba(255, 255, 255, 0.8);
     border-radius: 6px;
     font-size: 13px;
     color: #5a6c7d;
     border-left: 3px solid #4C75B8;
 }

 .topup-automatic-info strong {
     color: #ff6b6b;
     margin-top: 8px;
     display: block;
     font-size: 12px;
     line-height: 1.5;
 }

/* Loader state */
.topup-price-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4C75B8;
    border-radius: 50%;
    /* animation: spin 1s linear infinite; */ /* Animation removed */
}

/* Add to cart button */
.topup-add-to-cart-btn {
    width: auto !important;
    padding: 14px 32px;
    background-color: #4C75B8 !important;
    color: #ffffff !important;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(76, 117, 184, 0.3);
    position: relative;
    overflow: hidden;
    display: block !important;
    margin: 0 auto !important;
}

.topup-add-to-cart-btn:hover {
    background-color: #3a5490 !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 117, 184, 0.4);
}

.topup-add-to-cart-btn:active {
    background-color: #2d4470 !important;
    color: #ffffff !important;
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(76, 117, 184, 0.3);
}

.topup-add-to-cart-btn:disabled {
    background-color: #999999 !important;
    color: #ffffff !important;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

/* Error message */
.topup-error-message {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    color: #d63638;
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 4px solid #d63638;
    box-shadow: 0 2px 6px rgba(214, 54, 56, 0.1);
}

/* Success message */
.topup-success-message {
    background: linear-gradient(135deg, #f0fff4 0%, #e6f9ea 100%);
    color: #22863a;
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 4px solid #22863a;
    box-shadow: 0 2px 6px rgba(34, 134, 58, 0.1);
}

/* Loading indicator */
.topup-loading {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4C75B8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
}

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

/* RTL Support */
[dir="rtl"] .topup-region-selector label,
[dir="rtl"] .topup-amount-selector label,
[dir="rtl"] .topup-price-label {
    text-align: right;
}

[dir="rtl"] .topup-slider-wrapper {
    flex-direction: row-reverse;
}

[dir="rtl"] .topup-price-row {
    flex-direction: row-reverse;
    text-align: right;
}

[dir="rtl"] .topup-currency {
    margin-right: 5px;
    margin-left: 0;
}

[dir="rtl"] .topup-price-value {
    margin-left: 10px;
    margin-right: 0;
}

[dir="rtl"] .topup-error-message,
[dir="rtl"] .topup-success-message {
    border-left: none;
    border-right: 4px solid;
    text-align: right;
}

[dir="rtl"] .topup-error-message {
    border-right-color: #d63638;
}

[dir="rtl"] .topup-success-message {
    border-right-color: #22863a;
}

/* Persian number display support */
[dir="rtl"] .topup-amount-input {
    direction: ltr;
    text-align: center;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .topup-container {
        padding: 20px;
        max-width: 100%;
        border-radius: 10px;
    }

    .topup-slider-wrapper {
        flex-wrap: wrap;
        gap: 10px;
    }

    .topup-slider {
        width: 100%;
    }

    .topup-amount-input {
        width: 80px;
        padding: 8px 10px;
        font-size: 14px;
    }

    .topup-currency {
        font-size: 12px;
    }

    .topup-price-value {
        font-size: 24px;
    }

    .topup-price-label {
        font-size: 14px;
    }

    .topup-add-to-cart-btn {
        padding: 12px 20px;
        font-size: 15px;
    }

    .topup-region-select {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .topup-price-display {
        padding: 16px;
    }
}

/* Tablet responsive */
@media (max-width: 768px) {
    .topup-container {
        max-width: 100%;
    }
}
