/**
 * Currency Display Shortcode & Widget Styles
 * 
 * Styling for currency conversion shortcodes and Elementor widgets
 */

/* Base currency conversion styles */
.currency-conversion {
    display: inline-block;
    font-size: inherit;
    line-height: inherit;
}

/* Inline format (default) */
.currency-conversion.format-inline {
    display: inline;
}

.currency-conversion.format-inline .currency-separator {
    color: #999;
    font-size: 0.9em;
}

.currency-conversion.format-inline .currency-amount {
    font-weight: 500;
    color: #666;
}

/* Block format */
.currency-conversion.format-block {
    display: block;
    margin-top: 5px;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #007cba;
}

.currency-conversion.format-block .currency-label {
    font-size: 0.9em;
    color: #666;
}

.currency-conversion.format-block .currency-amount {
    font-weight: 600;
    color: #333;
}

/* Tooltip format */
.currency-conversion.format-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 5px;
    font-size: 1.2em;
    color: #007cba;
    transition: all 0.3s ease;
}

.currency-conversion.format-tooltip:hover {
    transform: scale(1.1);
    color: #005a87;
}

.currency-conversion.format-tooltip::after {
    content: attr(title);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.currency-conversion.format-tooltip::before {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.currency-conversion.format-tooltip:hover::after,
.currency-conversion.format-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Currency-specific styles */
.currency-conversion.currency-usd .currency-amount {
    color: #2e8b57;
}

.currency-conversion.currency-gbp .currency-amount {
    color: #8b0000;
}

.currency-conversion.currency-jpy .currency-amount {
    color: #ff6347;
}

.currency-conversion.currency-cad .currency-amount {
    color: #dc143c;
}

.currency-conversion.currency-aud .currency-amount {
    color: #228b22;
}

/* Flag styles */
.currency-conversion .currency-flag {
    margin-right: 5px;
    font-size: 1.1em;
}

/* Prefix and suffix styles */
.currency-prefix,
.currency-suffix {
    font-size: 0.9em;
    color: #888;
    font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .currency-conversion.format-block {
        padding: 6px 10px;
        margin-top: 3px;
    }

    .currency-conversion.format-tooltip {
        font-size: 1em;
    }

    .currency-conversion.format-tooltip::after {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}

/* WooCommerce product integration */
.woocommerce .price .currency-conversion {
    font-size: 0.9em;
}

.woocommerce .price .currency-conversion.format-inline {
    margin-left: 5px;
}

.woocommerce .price .currency-conversion.format-block {
    margin-top: 8px;
    margin-left: 0;
}

/* Variable product integration */
.woocommerce .woocommerce-variation-price .currency-conversion {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
}

/* Sale price integration */
.woocommerce .price del .currency-conversion {
    opacity: 0.7;
}

.woocommerce .price ins .currency-conversion {
    font-weight: 600;
}

/* Cart and checkout integration */
.woocommerce-cart .cart-subtotal .currency-conversion,
.woocommerce-checkout .order-total .currency-conversion {
    font-size: 0.8em;
    display: block;
    margin-top: 3px;
}

/* Elementor widget specific styles */
.elementor-widget-currency_conversion .currency-conversion {
    width: 100%;
}

.elementor-widget-currency_conversion .currency-conversion.format-block {
    text-align: center;
}

/* Admin preview styles */
.elementor-editor .currency-conversion {
    background-color: #f0f0f1;
    border: 1px dashed #c3c4c7;
    padding: 10px;
    border-radius: 3px;
}

.elementor-editor .currency-conversion::before {
    content: "Currency Conversion Preview";
    display: block;
    font-size: 0.8em;
    color: #646970;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading state */
.currency-conversion.loading {
    opacity: 0.6;
    position: relative;
}

.currency-conversion.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: currency-loading-spin 1s linear infinite;
}

@keyframes currency-loading-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Error state */
.currency-conversion.error {
    color: #d63638;
    font-style: italic;
}

.currency-conversion.error::before {
    content: "⚠ ";
    margin-right: 3px;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .currency-conversion.format-block {
        background-color: #2c3338;
        border-left-color: #72aee6;
        color: #f0f0f1;
    }

    .currency-conversion.format-tooltip::after {
        background-color: #f0f0f1;
        color: #2c3338;
    }

    .currency-conversion.format-tooltip::before {
        border-top-color: #f0f0f1;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .currency-conversion.format-block {
        border-width: 2px;
        border-style: solid;
    }

    .currency-conversion.format-tooltip {
        text-decoration: underline;
    }
}