/**
 * Sunya Theme - Currency Switcher CSS
 * Stili per il selettore valuta (WCML)
 * Coerente con language-switcher.css (stessa famiglia BEM)
 *
 * @package Sunya
 * @since 1.1.0
 */

/* ==========================================================================
   WRAPPER
   ========================================================================== */

.sunya-currency {
    position: relative;
    display: inline-flex;
    align-items: center;
    font-size: 0.8125rem;
    line-height: 1.2;
}


/* ==========================================================================
   CURRENT (trigger button / static span)
   ========================================================================== */

.sunya-currency__current {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    white-space: nowrap;
}

button.sunya-currency__current:hover {
    opacity: 0.8;
    background-color: rgba(255, 255, 255, 0.1); /* velo sull'header, anche trasparente: resta bianco */
}

button.sunya-currency__current:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.sunya-currency__current--static {
    cursor: default;
}

.sunya-currency__current--static:hover {
    opacity: 1;
    background-color: transparent;
}


/* ==========================================================================
   SYMBOL & CODE
   ========================================================================== */

.sunya-currency__symbol {
    font-weight: 600;
}

.sunya-currency__code {
    text-transform: uppercase;
    letter-spacing: 0.03em;
}


/* ==========================================================================
   CHEVRON (dropdown arrow)
   ========================================================================== */

.sunya-currency__chevron {
    width: 10px;
    height: 6px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

button.sunya-currency__current[aria-expanded="true"] .sunya-currency__chevron {
    transform: rotate(180deg);
}


/* ==========================================================================
   DROPDOWN PANEL
   ========================================================================== */

.sunya-currency__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 140px;
    margin-top: 4px;
    padding: 0.375rem 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    background: var(--sunya-color-bg);
    color: var(--sunya-color-heading);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

/* Apertura via aria-expanded */
button.sunya-currency__current[aria-expanded="true"] + .sunya-currency__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Stili per il contenuto generato dallo shortcode WCML */
.sunya-currency__dropdown a,
.sunya-currency__dropdown .wcml-cs-item-toggle {
    display: block;
    padding: 0.4rem 0.875rem;
    color: var(--sunya-color-text);
    text-decoration: none;
    font-size: 0.8125rem;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sunya-currency__dropdown a:hover,
.sunya-currency__dropdown .wcml-cs-item-toggle:hover {
    background-color: var(--sunya-color-bg-alt);
    color: var(--sunya-color-heading);
}

/* Valuta attiva nel dropdown */
.sunya-currency__dropdown .wcml-cs-active-currency a,
.sunya-currency__dropdown .wcml-cs-active-currency .wcml-cs-item-toggle {
    font-weight: 600;
    color: var(--sunya-color-heading);
}

/* Reset stili di default WCML shortcode */
.sunya-currency__dropdown .wcml_currency_switcher,
.sunya-currency__dropdown ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sunya-currency__dropdown li {
    margin: 0;
    padding: 0;
}


/* ==========================================================================
   INLINE VARIANT
   ========================================================================== */

.sunya-currency__inline {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.sunya-currency__inline .wcml_currency_switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.sunya-currency__inline li {
    margin: 0;
    padding: 0;
}

.sunya-currency__inline a {
    padding: 0.25rem 0.375rem;
    border-radius: 3px;
    color: inherit;
    text-decoration: none;
    font-size: 0.8125rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.sunya-currency__inline a:hover {
    opacity: 1;
}

.sunya-currency__inline .wcml-cs-active-currency a {
    opacity: 1;
    font-weight: 600;
}


/* ==========================================================================
   CONTESTO: TOPBAR
   ========================================================================== */

.sunya-currency--topbar {
    margin-left: 0.5rem;
}

.sunya-currency--topbar .sunya-currency__current {
    color: inherit;
}

.sunya-currency--topbar .sunya-currency__dropdown {
    right: 0;
    left: auto;
}


/* ==========================================================================
   CONTESTO: HEADER ACTIONS
   ========================================================================== */

.sunya-currency--header {
    margin-right: 0.75rem;
    position: relative;
    z-index: 1001; /* sopra breadcrumb e admin bar (z-index: 99999) */
}

.sunya-currency--header .sunya-currency__current {
    color: inherit;
}

.sunya-currency--header .sunya-currency__dropdown {
    z-index: 1001;
}


/* ==========================================================================
   CONTESTO: MOBILE MENU
   ========================================================================== */

.sunya-currency--mobile {
    display: none;
    width: 100%;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 0.5rem;
}

.sunya-currency--mobile .sunya-currency__current {
    width: 100%;
    justify-content: space-between;
    padding: 0.5rem 0;
    color: inherit;
}

.sunya-currency--mobile .sunya-currency__dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: transparent;
    color: inherit;
    padding: 0;
    margin-top: 0;
    display: none;
}

/* Apertura dropdown nel mobile */
.sunya-currency--mobile button.sunya-currency__current[aria-expanded="true"] + .sunya-currency__dropdown {
    display: block;
}

.sunya-currency--mobile .sunya-currency__dropdown a,
.sunya-currency--mobile .sunya-currency__dropdown .wcml-cs-item-toggle {
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    color: inherit;
}

.sunya-currency--mobile .sunya-currency__dropdown a:hover,
.sunya-currency--mobile .sunya-currency__dropdown .wcml-cs-item-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}


/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 991px) {

    /* Nascondi in topbar/header su mobile, mostra nel menu mobile */
    .sunya-currency--topbar,
    .sunya-currency--header {
        display: none;
    }

    .sunya-currency--mobile {
        display: block;
    }
}

@media (min-width: 992px) {

    /* Nascondi versione mobile su desktop */
    .sunya-currency--mobile {
        display: none;
    }
}


/* ==========================================================================
   SEPARATORE tra lang e currency switcher (se adiacenti in topbar)
   ========================================================================== */

.sunya-lang + .sunya-currency,
.sunya-currency + .sunya-lang {
    margin-left: 0.25rem;
    padding-left: 0.5rem;
    border-left: 1px solid rgba(255, 255, 255, 0.2); /* separatore sull'header: resta bianco */
}


/* ==========================================================================
   CURRENCY SWITCHER - Singolo Prodotto (shortcode WCML nativo)
   ========================================================================== */

/** bordo su selettore multicurrency **/
.sunya-currency__current{
	border: solid 1px;
}

.sunya-currency--product {
    margin-bottom: 0.75rem;
}

/* Posizione sotto il prezzo: margin invertito */
.sunya-single__price + .sunya-currency--product {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

/** Font prezzo su pagina prodotto **/
.sunya-single__price {
	font-size: 1.8rem;
	font-weight: bold;
	margin-bottom: 0.1rem !important;
}

/* WCML native dropdown styling within product context */
.sunya-currency--product .wcml-dropdown {
    position: relative;
    display: inline-block;
}

.sunya-currency--product .wcml-dropdown > ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sunya-currency--product .wcml-cs-active-currency {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sunya-currency--product .wcml-cs-item-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--sunya-color-bg-alt);
    border: 1px solid var(--sunya-color-border);
    color: var(--sunya-color-text);
    padding: 0.4rem 0.75rem;
    border-radius: var(--sunya-radius-sm, 4px);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
    text-decoration: none;
}

.sunya-currency--product .wcml-cs-item-toggle:hover {
    border-color: var(--sunya-color-accent-ink);
}

.sunya-currency--product .wcml-cs-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    min-width: 140px;
    background: var(--sunya-color-bg);
    border: 1px solid var(--sunya-color-border);
    border-radius: var(--sunya-radius-sm, 4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    list-style: none !important;
    margin: 0.25rem 0 0 !important;
    padding: 0.25rem 0 !important;
}

.sunya-currency--product .wcml-cs-submenu li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sunya-currency--product .wcml-cs-submenu a {
    display: block;
    padding: 0.4rem 0.75rem;
    color: var(--sunya-color-text);
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.sunya-currency--product .wcml-cs-submenu a:hover {
    background: var(--sunya-color-bg-alt);
    color: var(--sunya-color-accent-ink);
}


/* ==========================================================================
   CURRENCY SWITCHER - Dropdown Items (API nativa)
   ========================================================================== */

ul.sunya-currency__dropdown,
.sunya-currency ul.sunya-currency__dropdown {
    list-style: none !important;
    margin: 0 !important;
    padding: 0.25rem 0 !important;
}

.sunya-currency__item,
ul.sunya-currency__dropdown > li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sunya-currency__link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    color: var(--sunya-color-text);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background-color 0.15s ease;
    white-space: nowrap;
}

.sunya-currency__link:hover {
    background: var(--sunya-color-bg-alt);
}

.sunya-currency__item--active .sunya-currency__link {
    font-weight: 600;
    color: var(--sunya-color-accent-ink);
}
