/**
 * iVIEW Currency Switcher - Frontend Styles
 */

/* Base */
.iview-currency-switcher {
    display: inline-flex;
    align-items: center;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.iview-currency-flag {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.2);
}

.iview-currency-code {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.iview-currency-symbol {
    opacity: 0.7;
    font-weight: 400;
}

/* Dropdown */
.iview-currency-dropdown {
    position: relative;
    z-index: 99999999;
}

.iview-currency-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
    font-size: 14px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.iview-currency-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.iview-currency-toggle:focus {
    outline: none !important;
    box-shadow: none !important;
}

.iview-currency-arrow {
    width: 10px;
    height: 6px;
    transition: transform 0.2s ease;
}

.iview-currency-toggle[aria-expanded="true"] .iview-currency-arrow {
    transform: rotate(180deg);
}

.iview-currency-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 999999 !important;
    min-width: 100px;
    margin: 4px 0 0;
    padding: 4px 0;
    list-style: none;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.iview-currency-options-open {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

.iview-currency-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    white-space: nowrap;
}

.iview-currency-option:hover {
    background-color: #f5f5f5;
}

.iview-currency-option.iview-currency-active {
    background-color: #e8f5e0;
    color: #2d5016;
}

.iview-currency-option .iview-currency-code {
    color: #333;
}

.iview-currency-option.iview-currency-active .iview-currency-code {
    color: #2d5016;
}

/* Compact */
.iview-currency-compact .iview-currency-toggle {
    padding: 6px 10px;
    font-size: 13px;
}

.iview-currency-compact .iview-currency-flag {
    width: 18px;
    height: 13px;
}

/* Buttons */
.iview-currency-buttons {
    display: inline-flex;
    gap: 4px;
    background: #f0f0f0;
    padding: 4px;
    border-radius: 8px;
}

.iview-currency-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #666;
    font-family: inherit;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.iview-currency-btn:hover {
    background-color: rgba(255, 255, 255, 0.5);
    color: #333;
}

.iview-currency-btn:focus {
    outline: 2px solid #8bc53f;
    outline-offset: 2px;
}

.iview-currency-btn.iview-currency-active {
    background: linear-gradient(135deg, #8bc53f 0%, #6ba32e 100%);
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.iview-currency-btn.iview-currency-active .iview-currency-code {
    color: #fff;
}

/* Header */
header .elementor-section.elementor-section-boxed > .elementor-container,
.elementor-location-header .elementor-section.elementor-section-boxed > .elementor-container {
    max-width: 1240px;
}

.iview-currency-header-container {
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    min-width: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    position: relative !important;
    vertical-align: middle !important;
    z-index: 99999999 !important;
}

nav.elementor-nav-menu--main > .iview-currency-header-container,
.elementor-nav-menu__container > .iview-currency-header-container {
    display: inline-flex !important;
    margin-left: 10px !important;
}

.iview-currency-header-container .iview-currency-switcher {
    display: inline-flex !important;
    min-width: 60px !important;
    visibility: visible !important;
}

.iview-currency-header-container .iview-currency-toggle {
    display: inline-flex !important;
    min-width: 50px !important;
    min-height: auto !important;
    padding: 4px 10px !important;
    visibility: visible !important;
    background: rgba(151, 197, 54, 0.9) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    outline: none !important;
    box-shadow: none !important;
}

.iview-currency-header-container .iview-currency-toggle:hover {
    background: rgba(151, 197, 54, 1) !important;
}

.iview-currency-header-container .iview-currency-toggle:focus {
    outline: none !important;
    box-shadow: none !important;
}

.iview-currency-header-container .iview-currency-options {
    display: none;
    position: fixed !important;
    z-index: 2147483647 !important;
    min-width: 100px !important;
    margin: 0 !important;
    padding: 4px 0 !important;
    list-style: none !important;
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Hide interfering Elementor element when dropdown open */
body.iview-dropdown-open .elementor-element-5c8054f {
    height: 0;
}

body.iview-dropdown-open .elementor-element-5c8054f .elementor-element-populated {
    padding: 0;
}

/* Keep Contact Us link green */
body.iview-dropdown-open a[href="#contact-popup"].elementor-item {
    color: #97c524 !important;
}

.iview-currency-header-container .iview-currency-options.iview-currency-options-open {
    display: block !important;
}

.iview-currency-header-container .iview-currency-option {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 12px !important;
    margin: 0 !important;
    cursor: pointer !important;
    background: #fff !important;
    color: #333 !important;
    font-size: 13px !important;
    white-space: nowrap !important;
    list-style: none !important;
}

.iview-currency-header-container .iview-currency-option:hover {
    background: #f5f5f5 !important;
}

.iview-currency-header-container .iview-currency-option.iview-currency-active {
    background: #e8f5e0 !important;
    color: #2d5016 !important;
}

/* Dark header */
.site-header-dark .iview-currency-toggle,
.elementor-location-header[style*="dark"] .iview-currency-toggle,
header[class*="dark"] .iview-currency-toggle {
    color: #fff;
}

.site-header-dark .iview-currency-toggle:hover,
.elementor-location-header[style*="dark"] .iview-currency-toggle:hover,
header[class*="dark"] .iview-currency-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Price asterisk */
.iview-price-asterisk {
    font-size: 0.65em;
    color: #555;
    vertical-align: super;
    font-weight: 400;
    margin-left: 1px;
    opacity: 0.85;
}

/* Floating mobile button */
.iview-currency-floating {
    position: fixed;
    right: 0;
    top: 260px;
    z-index: 999999;
    display: none;
}

@media (max-width: 800px) {
    .iview-currency-floating {
        display: block;
    }
}

.iview-currency-floating .iview-currency-switcher {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    position: relative;
}

.iview-currency-floating .iview-currency-toggle {
    width: 70px;
    height: 50px;
    border-radius: 25px 0 0 25px !important;
    background: #97c536 !important;
    color: #fff !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 5px 0 8px !important;
    justify-content: center;
    align-items: center;
    display: flex !important;
    flex-direction: column;
    gap: 0 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.iview-currency-floating .iview-currency-toggle:hover,
.iview-currency-floating .iview-currency-toggle:active {
    background: #8bc53f !important;
}

.iview-currency-floating .iview-currency-flag,
.iview-currency-floating .iview-currency-arrow {
    display: none !important;
}

.iview-currency-floating .iview-currency-code {
    font-size: 15px !important;
    font-weight: 600 !important;
}

.iview-currency-floating .iview-currency-options {
    position: fixed !important;
    right: 15px !important;
    bottom: auto !important;
    left: auto !important;
    top: 180px !important;
    margin: 0 !important;
    min-width: 120px !important;
    background: #fff !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2) !important;
    padding: 8px 0 !important;
    display: none;
    list-style: none !important;
    z-index: 99999999 !important;
}

.iview-currency-floating .iview-currency-options.iview-currency-options-open {
    display: block !important;
}

.iview-currency-floating .iview-currency-option {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px 16px !important;
    color: #333 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    background: #fff !important;
    cursor: pointer !important;
}

.iview-currency-floating .iview-currency-option:hover {
    background: #f5f5f5 !important;
}

.iview-currency-floating .iview-currency-option.iview-currency-active {
    background: linear-gradient(135deg, rgba(151, 197, 54, 0.15) 0%, rgba(151, 197, 54, 0.1) 100%) !important;
    color: #5a8a1a !important;
}

.iview-currency-floating .iview-currency-option .iview-currency-flag {
    display: block !important;
    width: 24px !important;
    height: 18px !important;
    border-radius: 3px !important;
}

.iview-currency-floating .iview-currency-option .iview-currency-code {
    font-size: 14px !important;
    font-weight: 600 !important;
}

/* Hide desktop on mobile */
@media (max-width: 800px) {
    .iview-currency-header-container {
        display: none !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .iview-currency-toggle {
        padding: 6px 10px;
    }

    .iview-currency-flag {
        width: 18px;
        height: 13px;
    }

    .iview-currency-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .iview-currency-options {
        min-width: 120px;
    }
}

/* Price flash animation */
@keyframes iviewPriceFlash {
    0% { background-color: rgba(139, 197, 63, 0.3); }
    100% { background-color: transparent; }
}

[data-converted-currency] {
    animation: iviewPriceFlash 0.5s ease-out;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .iview-currency-options,
    .iview-currency-arrow,
    .iview-currency-btn,
    .iview-currency-toggle,
    [data-converted-currency] {
        transition: none;
        animation: none;
    }
}

@media (prefers-contrast: high) {
    .iview-currency-options {
        border: 2px solid #000;
    }
}
