/**
 * BSEC Location Selector Widget Styles
 * Sleek, header-optimized location trigger connected to FluentCart Regional Pricing.
 * - Supports stacked (icon top, text below) on desktop and inline (icon left, text right)
 * - Automatically falls back to compact horizontal row on mobile (<= 768px)
 * - Static, steady UI without jarring hover jumps or animations
 */

:root {
    --bsec-loc-bg: transparent;
    --bsec-loc-bg-hover: transparent;
    --bsec-loc-border: transparent;
    --bsec-loc-icon: #EB9649;
    --bsec-loc-icon-hover: #EB9649;
    --bsec-loc-icon-size: 18px;
    --bsec-loc-badge-size: 38px;
    --bsec-loc-icon-bg: rgba(235, 150, 73, 0.08);
    --bsec-loc-icon-bg-hover: rgba(235, 150, 73, 0.08);
    --bsec-loc-icon-border: rgba(235, 150, 73, 0.25);
    --bsec-loc-prefix-color: #64748b;
    --bsec-loc-state-color: #0f172a;
    --bsec-loc-caret-color: #94a3b8;
    --bsec-loc-radius: 6px;
    --bsec-loc-prefix-size: 11px;
    --bsec-loc-state-size: 13px;
    --bsec-loc-max-width: none;
}

/* Root Wrapper */
.bsec-location-selector-root {
    display: inline-flex;
    align-items: center;
    position: relative;
    max-width: var(--bsec-loc-max-width, none);
    vertical-align: middle;
}

/* Trigger Button Base (No hover animation or jumps) */
.bsec-location-selector-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background-color: var(--bsec-loc-bg, transparent);
    border: 1px solid var(--bsec-loc-border, transparent);
    border-radius: var(--bsec-loc-radius, 6px);
    padding: 3px 5px;
    font-family: inherit;
    font-size: var(--bsec-loc-state-size, 13px);
    line-height: 1.25;
    color: var(--bsec-loc-state-color, #0f172a);
    cursor: pointer;
    text-align: left;
    outline: none;
    box-sizing: border-box;
    max-width: 100%;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s ease;
}

.bsec-location-selector-trigger:hover {
    opacity: 0.9;
}

.bsec-location-selector-trigger:focus-visible {
    outline: 2px solid var(--bsec-loc-icon, #EB9649);
    outline-offset: 2px;
}

/* Location Pin Icon Container (No bounce/translate) */
.bsec-location-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bsec-loc-icon, #EB9649);
    flex-shrink: 0;
    box-sizing: border-box;
}

.bsec-location-icon svg {
    display: block;
    width: var(--bsec-loc-icon-size, 18px);
    height: var(--bsec-loc-icon-size, 18px);
    flex-shrink: 0;
}

/* Circular Badge Style (Matching Account Widget circular icon badge) */
.bsec-location-icon.is-circle {
    width: var(--bsec-loc-badge-size, 38px);
    height: var(--bsec-loc-badge-size, 38px);
    border-radius: 50%;
    background-color: var(--bsec-loc-icon-bg, rgba(235, 150, 73, 0.08));
    border: 1px solid var(--bsec-loc-icon-border, rgba(235, 150, 73, 0.25));
}

/* Content Container */
.bsec-location-content {
    display: flex;
    min-width: 0;
}

/* Prefix Label */
.bsec-location-prefix {
    font-size: var(--bsec-loc-prefix-size, 11px);
    font-weight: 500;
    color: var(--bsec-loc-prefix-color, #64748b);
    line-height: 1.15;
    letter-spacing: 0.01em;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* State Name Wrapper & Text */
.bsec-location-name-wrap {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
}

.bsec-location-state {
    font-size: var(--bsec-loc-state-size, 13px);
    font-weight: 700;
    color: var(--bsec-loc-state-color, #0f172a);
    line-height: 1.25;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Down Caret (No bounce/translate) */
.bsec-location-caret {
    color: var(--bsec-loc-caret-color, #94a3b8);
    flex-shrink: 0;
    margin-top: 1px;
}

/* Change Text Link */
.bsec-location-change {
    font-size: 11px;
    font-weight: 600;
    color: var(--bsec-loc-icon, #EB9649);
    text-decoration: underline;
    text-underline-offset: 2px;
    margin-left: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ====================================================
 * LAYOUT VARIATIONS (DESKTOP)
 * ==================================================== */

/* Stacked Layout: Icon on TOP, Text Below (Centered like Account Widget) */
.bsec-layout-stacked .bsec-location-selector-trigger,
.bsec-location-selector-root.bsec-layout-stacked .bsec-location-selector-trigger,
.bsec-location-selector-trigger.bsec-layout-stacked,
.brxe-bsec-location-selector.bsec-layout-stacked .bsec-location-selector-trigger {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 4px !important;
    padding: 2px 4px !important;
}

.bsec-layout-stacked .bsec-location-content,
.bsec-location-selector-root.bsec-layout-stacked .bsec-location-content,
.bsec-location-selector-trigger.bsec-layout-stacked .bsec-location-content,
.brxe-bsec-location-selector.bsec-layout-stacked .bsec-location-content {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 1px !important;
    line-height: 1.2 !important;
}

.bsec-layout-stacked .bsec-location-prefix,
.bsec-location-selector-root.bsec-layout-stacked .bsec-location-prefix,
.bsec-location-selector-trigger.bsec-layout-stacked .bsec-location-prefix {
    display: block !important;
    text-align: center !important;
    white-space: nowrap !important;
    margin: 0 !important;
    line-height: 1.2 !important;
}

.bsec-layout-stacked .bsec-location-name-wrap,
.bsec-location-selector-root.bsec-layout-stacked .bsec-location-name-wrap,
.bsec-location-selector-trigger.bsec-layout-stacked .bsec-location-name-wrap {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 3px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
}

.bsec-layout-stacked .bsec-location-state,
.bsec-location-selector-root.bsec-layout-stacked .bsec-location-state,
.bsec-location-selector-trigger.bsec-layout-stacked .bsec-location-state {
    text-align: center !important;
}

/* Inline / Row Layout: Icon on LEFT, Text on RIGHT (Horizontal) */
.bsec-layout-inline .bsec-location-selector-trigger,
.bsec-layout-row .bsec-location-selector-trigger,
.bsec-location-selector-root.bsec-layout-inline .bsec-location-selector-trigger,
.bsec-location-selector-root.bsec-layout-row .bsec-location-selector-trigger,
.bsec-location-selector-trigger.bsec-layout-inline,
.bsec-location-selector-trigger.bsec-layout-row,
.brxe-bsec-location-selector.bsec-layout-inline .bsec-location-selector-trigger,
.brxe-bsec-location-selector.bsec-layout-row .bsec-location-selector-trigger {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    gap: 8px !important;
    padding: 2px 6px !important;
}

.bsec-layout-inline .bsec-location-content,
.bsec-layout-row .bsec-location-content,
.bsec-location-selector-root.bsec-layout-inline .bsec-location-content,
.bsec-location-selector-root.bsec-layout-row .bsec-location-content,
.bsec-location-selector-trigger.bsec-layout-inline .bsec-location-content,
.bsec-location-selector-trigger.bsec-layout-row .bsec-location-content {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    text-align: left !important;
    gap: 1px !important;
    line-height: 1.2 !important;
}

.bsec-layout-inline .bsec-location-name-wrap,
.bsec-layout-row .bsec-location-name-wrap,
.bsec-location-selector-root.bsec-layout-inline .bsec-location-name-wrap,
.bsec-location-selector-root.bsec-layout-row .bsec-location-name-wrap,
.bsec-location-selector-trigger.bsec-layout-inline .bsec-location-name-wrap,
.bsec-location-selector-trigger.bsec-layout-row .bsec-location-name-wrap {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    gap: 3px !important;
}

/* ====================================================
 * APPEARANCE STYLES (No hover movement/flash)
 * ==================================================== */

/* Pill Appearance */
.bsec-style-pill .bsec-location-selector-trigger {
    background-color: var(--bsec-loc-bg, #ffffff);
    border: 1px solid var(--bsec-loc-border, #e2e8f0);
    border-radius: var(--bsec-loc-radius, 9999px);
    padding: 5px 12px;
}

/* Ghost Appearance (Default Header Style) */
.bsec-style-ghost .bsec-location-selector-trigger {
    background-color: var(--bsec-loc-bg, transparent);
    border: 1px solid var(--bsec-loc-border, transparent);
    border-radius: var(--bsec-loc-radius, 6px);
}

/* Underline Appearance */
.bsec-style-underline .bsec-location-selector-trigger {
    padding: 2px 4px;
    background: transparent;
    border: none;
}

.bsec-style-underline .bsec-location-state {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(235, 150, 73, 0.6);
}

/* ====================================================
 * MOBILE SCREEN OVERRIDE (<= 768px)
 * Always inline horizontally, even if stacked on desktop
 * ==================================================== */
@media (max-width: 768px) {
    .bsec-layout-stacked .bsec-location-selector-trigger,
    .bsec-location-selector-root.bsec-layout-stacked .bsec-location-selector-trigger,
    .bsec-location-selector-trigger.bsec-layout-stacked,
    .brxe-bsec-location-selector.bsec-layout-stacked .bsec-location-selector-trigger {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: left !important;
        gap: 6px !important;
        padding: 2px 4px !important;
    }

    .bsec-layout-stacked .bsec-location-content,
    .bsec-location-selector-root.bsec-layout-stacked .bsec-location-content,
    .bsec-location-selector-trigger.bsec-layout-stacked .bsec-location-content,
    .brxe-bsec-location-selector.bsec-layout-stacked .bsec-location-content {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: center !important;
        text-align: left !important;
        gap: 1px !important;
    }

    .bsec-layout-stacked .bsec-location-prefix,
    .bsec-location-selector-root.bsec-layout-stacked .bsec-location-prefix,
    .bsec-location-selector-trigger.bsec-layout-stacked .bsec-location-prefix {
        text-align: left !important;
        font-size: 10px !important;
    }

    .bsec-layout-stacked .bsec-location-name-wrap,
    .bsec-location-selector-root.bsec-layout-stacked .bsec-location-name-wrap,
    .bsec-location-selector-trigger.bsec-layout-stacked .bsec-location-name-wrap {
        justify-content: flex-start !important;
        text-align: left !important;
    }

    .bsec-layout-stacked .bsec-location-state,
    .bsec-location-selector-root.bsec-layout-stacked .bsec-location-state,
    .bsec-location-selector-trigger.bsec-layout-stacked .bsec-location-state {
        text-align: left !important;
        font-size: 12px !important;
        max-width: 140px !important;
    }

    .bsec-location-icon.is-circle {
        width: 32px !important;
        height: 32px !important;
    }
}
