/**
 * Synvia Currency Switcher v1.2.1 — Frontend Styles
 */

/* ── Container ─────────────────────────────────────────────── */
.synvia-currency-switcher {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 4px;
    line-height: 1;
}

/* ── Shared button base (buttons + mobile) ──────────────────── */
/* Both styles use the same dark square look */
.synvia-currency-btn,
.synvia-mobile-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #1a1a1a;
    color: #fff;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1;
    white-space: nowrap;
    user-select: none;
    overflow: visible;
    box-sizing: border-box;
    flex-direction: column;
    gap: 1px;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.synvia-currency-btn:hover,
.synvia-mobile-label:hover {
    opacity: 0.75;
    text-decoration: none;
    color: #fff;
}

/* Active/selected button — slightly lighter to show selection */
.synvia-currency-btn.synvia-active {
    background: #3a3a3a;
    color: #fff;
    opacity: 1;
    outline: 2px solid #fff;
    outline-offset: -3px;
}

/* Locked / disabled */
.synvia-currency-btn.synvia-disabled,
span.synvia-currency-btn {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Focus ring */
.synvia-currency-btn:focus-visible,
.synvia-mobile-label:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ── Dropdown ──────────────────────────────────────────────── */
.synvia-dropdown select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 1px solid currentColor;
    border-radius: 4px;
    padding: 5px 10px 5px 8px;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E") no-repeat right 8px center;
    background-size: 8px 5px;
    color: inherit;
    font: inherit;
    cursor: pointer;
    min-width: 90px;
    opacity: 1;
    transition: opacity 0.15s;
    padding-right: 28px;
}

.synvia-dropdown.synvia-locked select {
    opacity: 0.55;
    cursor: not-allowed;
}

.synvia-dropdown select:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ── Mobile style ──────────────────────────────────────────── */
.synvia-mobile {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    line-height: 0;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Currency code text — e.g. "CAD" */
.synvia-mobile-code {
    pointer-events: none;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1;
    color: #fff;
}

/* Tiny caret */
.synvia-mobile-caret {
    pointer-events: none;
    width: 7px;
    height: 7px;
    flex-shrink: 0;
    opacity: 0.7;
    stroke: #fff;
}

/* Invisible select covers the entire label as tap target */
.synvia-mobile-label select {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0 !important;
    cursor: pointer;
    font-size: 16px;
    border: none;
    background: transparent !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    margin: 0;
    padding: 0;
    /* Prevent ANY native arrow from showing — theme may override appearance */
    background-image: none !important;
}

.synvia-mobile.synvia-locked .synvia-mobile-label {
    opacity: 0.35;
    cursor: not-allowed;
}
.synvia-mobile.synvia-locked select {
    pointer-events: none;
}

/* BeBuilder vertical alignment fix */
.synvia-mobile,
.synvia-mobile * {
    box-sizing: border-box;
}

/* ── Cart-lock tooltip — shows on hover AND JS click trigger ── */
.synvia-mobile-label[data-locked-msg]::after,
.synvia-currency-btn[data-locked-msg]::after {
    content: attr(data-locked-msg);
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 5px 9px;
    border-radius: 5px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 99999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    line-height: 1.4;
}
.synvia-mobile-label[data-locked-msg]::before,
.synvia-currency-btn[data-locked-msg]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #111;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 99999;
}
/* Show on hover */
.synvia-mobile-label[data-locked-msg]:hover::after,
.synvia-currency-btn[data-locked-msg]:hover::after,
.synvia-mobile-label.synvia-show-tooltip::after,
.synvia-currency-btn.synvia-show-tooltip::after {
    opacity: 1 !important;
    display: block !important;
    visibility: visible !important;
}
.synvia-mobile-label[data-locked-msg]:hover::before,
.synvia-currency-btn[data-locked-msg]:hover::before,
.synvia-mobile-label.synvia-show-tooltip::before,
.synvia-currency-btn.synvia-show-tooltip::before {
    opacity: 1 !important;
    display: block !important;
    visibility: visible !important;
}

/* ── Anti-FOUC: reveal once CSS is loaded (overrides inline visibility:hidden) ── */
.synvia-currency-switcher.synvia-mobile,
.synvia-currency-switcher.synvia-buttons {
    visibility: visible !important;
}
