/**
 * Locale Switcher Page
 *
 * Styles the Location & Preferences page using the shared Jedi Theme
 * dark-commerce colour system.
 *
 * The secondary currency list is removed from the document flow while closed.
 * When opened, it returns to normal flow so the locale card expands naturally
 * to contain every enabled currency and its bottom border remains visible
 * beneath the final option.
 *
 * @package Jedi_Theme
 * @since   1.0.0
 */


/* ==========================================================================
   Page
   ========================================================================== */

.locale-page {
    padding: 20px 0 50px;

    color: var(--jr-text, #fff);
    background: transparent;
}


/* ==========================================================================
   Card
   ========================================================================== */

.locale-page .locale-card {
    max-width: 560px;
    margin: 0 auto;
    padding: 28px 22px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.025),
            transparent 42%
        ),
        radial-gradient(
            circle at 100% 0,
            rgba(111, 203, 255, 0.055),
            transparent 18rem
        ),
        rgba(7, 13, 21, 0.72);

    border: 1px solid rgba(152, 169, 192, 0.34);
    border-radius: 8px;
}


/* ==========================================================================
   Page heading
   ========================================================================== */

.locale-page .locale-card h1 {
    margin: 0 0 10px;

    color: var(--jr-text, #fff);

    font-size: 28px;
    line-height: 1.2;
}

.locale-page .locale-intro {
    margin: 0 0 28px;

    color: var(--jr-text-muted, #aeaeae);

    font-size: 14px;
    line-height: 1.6;
}


/* ==========================================================================
   Sections
   ========================================================================== */

.locale-page .locale-section {
    margin-top: 28px;
}

.locale-page .locale-section h2 {
    margin: 0 0 14px;
    padding-bottom: 10px;

    color: var(--jr-text, #fff);

    border-bottom: 1px solid rgba(152, 169, 192, 0.18);

    font-size: 18px;
}


/* ==========================================================================
   Region list
   ========================================================================== */

.locale-page .region-list {
    display: grid;
    gap: 10px;
}

.locale-page .region-btn {
    display: flex;

    width: 100%;
    padding: 14px;

    align-items: center;
    gap: 12px;

    color: var(--jr-text, #fff);
    background: rgba(255, 255, 255, 0.018);

    border: 1px solid var(
        --jr-border,
        rgba(152, 169, 192, 0.2)
    );

    border-radius: 7px;

    text-decoration: none;

    transition:
        background 0.18s ease,
        border-color 0.18s ease;
}

.locale-page .region-btn:hover {
    background: rgba(45, 166, 83, 0.07);
    border-color: rgba(69, 217, 107, 0.30);
}

.locale-page .region-btn.active {
    background: rgba(45, 166, 83, 0.10);
    border-color: rgba(45, 166, 83, 0.48);

    pointer-events: none;
}


/* ==========================================================================
   Region flags
   ========================================================================== */

.locale-page .region-btn .flag-image {
    display: inline-flex;

    width: 38px;
    min-width: 38px;
    max-width: 38px;

    height: 24px;
    min-height: 24px;
    max-height: 24px;

    aspect-ratio: 38 / 24;

    flex: 0 0 38px;

    align-items: center;
    justify-content: center;

    overflow: hidden;

    line-height: 0;
}

.locale-page .region-btn .flag-image img {
    display: block;

    width: 38px;
    min-width: 38px;
    max-width: 38px;

    height: 24px;
    min-height: 24px;
    max-height: 24px;

    aspect-ratio: 38 / 24;

    flex: 0 0 auto;

    object-fit: cover;
}

.locale-page .region-btn .region-name {
    color: var(--jr-text, #fff);

    font-size: 15px;
}


/* ==========================================================================
   Primary currencies
   ========================================================================== */

.locale-page .currency-list {
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 10px;
}

.locale-page .currency-btn {
    display: flex;

    min-height: 46px;

    align-items: center;
    justify-content: center;

    color: var(--jr-text, #fff);
    background: rgba(255, 255, 255, 0.018);

    border: 1px solid var(
        --jr-border,
        rgba(152, 169, 192, 0.2)
    );

    border-radius: 7px;

    font-size: 14px;
    font-weight: 600;

    text-decoration: none;

    transition:
        background 0.18s ease,
        border-color 0.18s ease;
}

.locale-page .currency-btn:hover {
    background: rgba(45, 166, 83, 0.07);
    border-color: rgba(69, 217, 107, 0.30);
}

.locale-page .currency-btn.active {
    background: rgba(45, 166, 83, 0.10);
    border-color: rgba(45, 166, 83, 0.48);

    pointer-events: none;
}


/* ==========================================================================
   Secondary currency section
   ========================================================================== */

.locale-page .secondary-currency-section {
    margin-top: 12px;
}

.locale-page .secondary-currency-dropdown {
    position: relative;
}


/* ==========================================================================
   Secondary currency trigger
   ========================================================================== */

.locale-page .secondary-currency-trigger {
    display: flex;

    width: 100%;
    min-height: 46px;

    padding: 10px 14px;

    align-items: center;
    justify-content: space-between;

    color: var(--jr-text, #fff);
    background: rgba(255, 255, 255, 0.018);

    border: 1px solid var(
        --jr-border,
        rgba(152, 169, 192, 0.2)
    );

    border-radius: 7px;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.18s ease,
        border-color 0.18s ease;
}

.locale-page .secondary-currency-trigger:hover {
    background: rgba(45, 166, 83, 0.07);
    border-color: rgba(69, 217, 107, 0.30);
}

.locale-page .secondary-currency-trigger.active {
    background: rgba(45, 166, 83, 0.10);
    border-color: rgba(45, 166, 83, 0.48);
}

.locale-page .secondary-currency-trigger .check {
    margin-left: 4px;

    color: var(--jr-green-light, #45d96b);

    font-size: 12px;
}


/* ==========================================================================
   Secondary currency menu - closed
   ========================================================================== */

.locale-page .secondary-currency-menu {
    display: none;

    position: static;

    width: 100%;
    margin-top: 6px;

    background: var(--jr-surface, #0f1620);

    border: 1px solid rgba(152, 169, 192, 0.34);
    border-radius: 7px;

    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.32);
}


/* ==========================================================================
   Secondary currency menu - open
   ========================================================================== */

.locale-page
.secondary-currency-dropdown:hover
.secondary-currency-menu,
.locale-page
.secondary-currency-dropdown:focus-within
.secondary-currency-menu {
    display: block;
}


/* ==========================================================================
   Secondary currency options
   ========================================================================== */

.locale-page .secondary-currency-menu a {
    display: block;

    padding: 12px 14px;

    color: var(--jr-text, #fff);

    font-size: 14px;
    font-weight: 600;

    text-decoration: none;

    transition: background 0.18s ease;
}

.locale-page .secondary-currency-menu a:hover {
    background: rgba(45, 166, 83, 0.07);
}

.locale-page .secondary-currency-menu a.active {
    color: var(--jr-green-bright, #b8f6c3);
    background: rgba(45, 166, 83, 0.10);

    pointer-events: none;
}


/* ==========================================================================
   Keyboard focus
   ========================================================================== */

.locale-page .region-btn:focus-visible,
.locale-page .currency-btn:focus-visible,
.locale-page .secondary-currency-trigger:focus-visible,
.locale-page .secondary-currency-menu a:focus-visible {
    outline: 2px solid rgba(69, 217, 107, 0.8);
    outline-offset: 2px;
}


/* ==========================================================================
   Mobile
   ========================================================================== */

@media (max-width: 480px) {

    .locale-page {
        padding-right: 14px;
        padding-left: 14px;
    }

    .locale-page .locale-card {
        padding: 24px 18px;
    }

    .locale-page .locale-card h1 {
        font-size: 24px;
    }

    .locale-page .currency-list {
        grid-template-columns: 1fr;
    }

}


/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    .locale-page .region-btn,
    .locale-page .currency-btn,
    .locale-page .secondary-currency-trigger,
    .locale-page .secondary-currency-menu a {
        transition: none;
    }

}