/* WMC Currency Switcher */

:root {
    --wmc-bg: #ffffff;
    --wmc-text: #1a1a2e;
    --wmc-active-bg: #2563eb;
    --wmc-active-text: #ffffff;
    --wmc-dd-bg: #ffffff;
    --wmc-dd-hover: #f0f4ff;
    --wmc-dd-selected: #e0e7ff;
    --wmc-border: #e5e7eb;
    --wmc-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    --wmc-trigger-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    --wmc-radius: 14px;
    --wmc-radius-sm: 10px;
    --wmc-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --wmc-z: 99999;
}

/* Base */

.wmc-switcher {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    z-index: var(--wmc-z);
}

/* Trigger */

.wmc-switcher__trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--wmc-bg);
    color: var(--wmc-text);
    border: 1px solid var(--wmc-border);
    border-radius: var(--wmc-radius);
    box-shadow: var(--wmc-trigger-shadow);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: all var(--wmc-transition);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    letter-spacing: 0.01em;
}

.wmc-switcher__trigger:hover {
    border-color: var(--wmc-active-bg);
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}

.wmc-switcher__trigger:focus-visible {
    outline: 2px solid var(--wmc-active-bg);
    outline-offset: 2px;
}

.wmc-switcher__trigger:active {
    transform: translateY(0);
}

.wmc-switcher__chevron {
    transition: transform var(--wmc-transition);
    flex-shrink: 0;
    opacity: 0.5;
}

.wmc-switcher__trigger[aria-expanded="true"] .wmc-switcher__chevron {
    transform: rotate(180deg);
    opacity: 1;
}

/* Dropdown */

.wmc-switcher__dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    min-width: 100%;
    width: max-content;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--wmc-dd-bg, var(--wmc-bg));
    border: 1px solid var(--wmc-border);
    border-radius: var(--wmc-radius);
    box-shadow: var(--wmc-shadow);
    overflow: hidden;
    animation: wmcSlideUp 0.25s ease-out;
}

.wmc-switcher__dropdown.wmc-open {
    display: block;
}

@keyframes wmcSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wmc-pos-top_left .wmc-switcher__dropdown,
.wmc-pos-top_right .wmc-switcher__dropdown {
    bottom: auto;
    top: calc(100% + 10px);
    animation: wmcSlideDown 0.25s ease-out;
}

@keyframes wmcSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Options */

.wmc-switcher__option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all var(--wmc-transition);
    white-space: nowrap;
    border-radius: var(--wmc-radius-sm);
    margin: 2px 0;
    font-weight: 500;
}

.wmc-switcher__option:hover {
    background: var(--wmc-dd-hover);
}

.wmc-switcher__option--active {
    background: var(--wmc-dd-selected);
    color: var(--wmc-active-text);
    font-weight: 600;
}

.wmc-switcher__option--active:hover {
    background: var(--wmc-dd-selected);
    filter: brightness(0.95);
}

/* Currency parts */

.wmc-flag {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.wmc-flag-img {
    display: block;
    width: 24px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.wmc-flag-emoji {
    font-size: 20px;
    line-height: 1;
}

.wmc-symbol {
    font-weight: 700;
    font-size: 14px;
}

.wmc-code {
    font-weight: 600;
    letter-spacing: 0.04em;
    font-size: 13px;
}

.wmc-name {
    opacity: 0.6;
    font-size: 12px;
    font-weight: 400;
}

/* Flag/text spacing */

.wmc-switcher__option .wmc-flag + .wmc-symbol,
.wmc-switcher__option .wmc-flag + .wmc-code,
.wmc-switcher__trigger .wmc-flag + .wmc-symbol,
.wmc-switcher__trigger .wmc-flag + .wmc-code {
    margin-left: 2px;
}

/* Floating positions */

.wmc-floating {
    position: fixed;
}

.wmc-pos-bottom_right {
    bottom: 24px;
    right: 24px;
}

.wmc-pos-bottom_left {
    bottom: 24px;
    left: 24px;
}

.wmc-pos-top_right {
    top: 24px;
    right: 24px;
}

.wmc-pos-top_left {
    top: 24px;
    left: 24px;
}

/* Right-align for right-positioned */
.wmc-pos-bottom_right .wmc-switcher__dropdown,
.wmc-pos-top_right .wmc-switcher__dropdown {
    left: auto;
    right: 0;
}

/* Pill style */

.wmc-style-pill .wmc-switcher__trigger {
    border-radius: 50px;
    padding: 8px 18px 8px 12px;
}

.wmc-style-pill .wmc-switcher__dropdown {
    border-radius: 16px;
}

.wmc-style-pill .wmc-switcher__option {
    border-radius: 12px;
}

/* Dropdown style */

.wmc-style-dropdown .wmc-switcher__trigger {
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
}

.wmc-style-dropdown .wmc-switcher__dropdown {
    border-radius: 10px;
    padding: 4px;
}

.wmc-style-dropdown .wmc-switcher__option {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 8px;
}

/* Transparent style */

.wmc-style-transparent .wmc-switcher__trigger {
    background: transparent;
    border: none;
    box-shadow: none;
    color: inherit;
    border-radius: 8px;
    padding: 8px 14px;
}

.wmc-style-transparent .wmc-switcher__trigger:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    box-shadow: none;
    transform: none;
}

.wmc-style-transparent .wmc-switcher__trigger:focus-visible {
    outline: 1px solid currentColor;
    outline-offset: 2px;
}

.wmc-style-transparent .wmc-switcher__dropdown {
    background: var(--wmc-dd-bg, #1e1e30);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.wmc-style-transparent .wmc-switcher__option {
    color: rgba(255, 255, 255, 0.85);
}

.wmc-style-transparent .wmc-switcher__option:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #fff;
}

.wmc-style-transparent .wmc-switcher__option--active {
    background: rgba(255, 255, 255, 0.22) !important;
    color: #fff;
}

.wmc-style-transparent .wmc-switcher__option--active:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    filter: none;
}

/* Minimal style */

.wmc-style-minimal .wmc-switcher__trigger {
    background: transparent;
    border: none;
    box-shadow: none;
    color: inherit;
    padding: 6px 8px;
    font-weight: 500;
    gap: 6px;
}

.wmc-style-minimal .wmc-switcher__trigger:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border: none;
    box-shadow: none;
    transform: none;
}

.wmc-style-minimal .wmc-switcher__trigger:focus-visible {
    outline: 1px solid currentColor;
    outline-offset: 2px;
}

.wmc-style-minimal .wmc-switcher__dropdown {
    background: var(--wmc-dd-bg, #1e1e30);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    min-width: 180px;
}

.wmc-style-minimal .wmc-switcher__option {
    color: rgba(255, 255, 255, 0.85);
}

.wmc-style-minimal .wmc-switcher__option:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #fff;
}

.wmc-style-minimal .wmc-switcher__option--active {
    background: rgba(255, 255, 255, 0.22) !important;
    color: #fff;
}

.wmc-style-minimal .wmc-switcher__option--active:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    filter: none;
}

/* Light theme override */
.wmc-light .wmc-style-transparent .wmc-switcher__trigger:hover,
.wmc-light .wmc-style-minimal .wmc-switcher__trigger:hover {
    background: rgba(0, 0, 0, 0.04);
}

.wmc-light .wmc-style-transparent .wmc-switcher__dropdown,
.wmc-light .wmc-style-minimal .wmc-switcher__dropdown {
    background: #fff;
    border-color: #e5e7eb;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.wmc-light .wmc-style-transparent .wmc-switcher__option,
.wmc-light .wmc-style-minimal .wmc-switcher__option {
    color: #1a1a2e;
}

.wmc-light .wmc-style-transparent .wmc-switcher__option:hover,
.wmc-light .wmc-style-minimal .wmc-switcher__option:hover {
    background: var(--wmc-dd-hover, rgba(0, 0, 0, 0.04));
    color: #1a1a2e;
}

.wmc-light .wmc-style-transparent .wmc-switcher__option--active,
.wmc-light .wmc-style-minimal .wmc-switcher__option--active {
    background: var(--wmc-dd-selected, #2563eb);
    color: #fff;
}

/* Inline / shortcode / widget */

.wmc-switcher:not(.wmc-floating) .wmc-switcher__dropdown {
    bottom: auto;
    top: calc(100% + 6px);
    animation: wmcSlideDown 0.25s ease-out;
}

.wmc-switcher:not(.wmc-floating) .wmc-switcher__trigger {
    box-shadow: none;
    border: 1px solid var(--wmc-border);
}

/* Override non-floating border for transparent/minimal */
.wmc-style-transparent.wmc-switcher .wmc-switcher__trigger,
.wmc-style-transparent .wmc-switcher__trigger {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.wmc-style-minimal.wmc-switcher .wmc-switcher__trigger,
.wmc-style-minimal .wmc-switcher__trigger {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Tablet */

@media (max-width: 1024px) {
    .wmc-pos-bottom_right,
    .wmc-pos-bottom_left {
        bottom: 20px;
    }
}

/* Mobile */

@media (max-width: 768px) {
    .wmc-pos-bottom_right { bottom: 16px; right: 16px; }
    .wmc-pos-bottom_left  { bottom: 16px; left: 16px; }
    .wmc-pos-top_right    { top: 16px; right: 16px; }
    .wmc-pos-top_left     { top: 16px; left: 16px; }

    .wmc-switcher__trigger {
        padding: 10px 16px 10px 12px;
        font-size: 14px;
        min-height: 44px;
    }

    .wmc-switcher__option {
        padding: 14px 16px;
        font-size: 15px;
        min-height: 48px;
    }

    .wmc-flag-img {
        width: 28px;
        height: 20px;
    }

    .wmc-floating .wmc-switcher__dropdown {
        position: fixed;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100%;
        max-height: 65vh;
        overflow-y: auto;
        border-radius: 20px 20px 0 0;
        padding: 6px 8px calc(env(safe-area-inset-bottom, 12px) + 12px) 8px;
        animation: wmcSlideSheet 0.3s ease-out;
        box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.2);
        background: var(--wmc-bg, #fff);
    }

    .wmc-style-transparent.wmc-floating .wmc-switcher__dropdown,
    .wmc-style-minimal.wmc-floating .wmc-switcher__dropdown {
        background: var(--wmc-dd-bg, #1e1e30);
    }

    .wmc-floating .wmc-switcher__dropdown::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: #d1d5db;
        border-radius: 2px;
        margin: 8px auto 12px;
    }

    @keyframes wmcSlideSheet {
        from { opacity: 0; transform: translateY(100%); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .wmc-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: calc(var(--wmc-z) - 1);
        animation: wmcFadeIn 0.2s ease-out;
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }

    @keyframes wmcFadeIn {
        from { opacity: 0; }
        to   { opacity: 1; }
    }
}

@media (max-width: 380px) {
    .wmc-name {
        display: none;
    }
}

/* Native select style */

.wmc-native-select {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid #555;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    appearance: auto;
    -webkit-appearance: auto;
    min-width: 140px;
}

.wmc-native-select:focus {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.wmc-native-floating {
    position: fixed;
    z-index: var(--wmc-z);
}

.wmc-native-pos-bottom_right { bottom: 24px; right: 24px; }
.wmc-native-pos-bottom_left  { bottom: 24px; left: 24px; }
.wmc-native-pos-top_right    { top: 24px; right: 24px; }
.wmc-native-pos-top_left     { top: 24px; left: 24px; }

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
    .wmc-switcher__dropdown,
    .wmc-switcher__chevron,
    .wmc-switcher__trigger,
    .wmc-switcher__option {
        animation: none !important;
        transition: none !important;
    }
}

/* Dark theme (.wmc-dark) */

.wmc-dark .wmc-switcher__trigger,
.wmc-dark.wmc-switcher .wmc-switcher__trigger {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.wmc-dark .wmc-switcher__trigger:hover,
.wmc-dark.wmc-switcher .wmc-switcher__trigger:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
}
