﻿.market-selector {
    position: relative;
    z-index: 1000;
    font-family: "DM Sans", sans-serif;
}

.market-selector-button {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 178px;
    min-height: 48px;
    padding: 7px 13px;
    border: 1px solid rgba(15, 40, 70, 0.14);
    border-radius: 14px;
    background: linear-gradient( 180deg, #ffffff 0%, #f5f8fc 100% );
    color: #0a213d;
    cursor: pointer;
    box-shadow: 0 5px 18px rgba(7, 27, 51, 0.08);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

    .market-selector-button:hover {
        border-color: rgba(23, 105, 224, 0.45);
        box-shadow: 0 9px 25px rgba(7, 27, 51, 0.13);
        transform: translateY(-1px);
    }

    .market-selector-button:focus-visible {
        outline: 3px solid rgba(23, 105, 224, 0.22);
        outline-offset: 2px;
    }

.market-selector.open .market-selector-button {
    border-color: #1769e0;
    box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.13), 0 10px 28px rgba(7, 27, 51, 0.13);
}

.market-selector-flag,
.market-option-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 50%;
    background: #eef3f8;
    line-height: 1;
}

.market-selector-flag {
    width: 32px;
    height: 32px;
    font-size: 23px;
    box-shadow: inset 0 0 0 1px rgba(7, 27, 51, 0.08);
}

.market-selector-current {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.market-selector-country {
    display: block;
    width: 100%;
    overflow: hidden;
    color: #0a213d;
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-selector-currency {
    margin-top: 2px;
    color: #6d7d91;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-transform: uppercase;
}

.market-selector-chevron {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    fill: none;
    stroke: #51647b;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    transition: transform 180ms ease;
}

.market-selector.open .market-selector-chevron {
    transform: rotate(180deg);
}

.market-selector-menu {
    position: absolute;
    top: calc(100% + 11px);
    right: 0;
    width: min(330px, calc(100vw - 28px));
    overflow: hidden;
    border: 1px solid rgba(15, 40, 70, 0.12);
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 24px 70px rgba(7, 27, 51, 0.2);
    transform-origin: top right;
    animation: marketMenuOpen 160ms ease-out;
}

.market-selector-heading {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 19px 20px 15px;
    border-bottom: 1px solid #e8edf3;
    background: linear-gradient( 135deg, #071b33 0%, #123f70 100% );
    color: #ffffff;
}

    .market-selector-heading span {
        font-size: 0.92rem;
        font-weight: 800;
    }

    .market-selector-heading small {
        color: rgba(255, 255, 255, 0.7);
        font-size: 0.72rem;
    }

.market-selector-options {
    max-height: min(420px, 65vh);
    overflow-y: auto;
    padding: 8px;
}

.market-selector-form {
    margin: 0;
}

.market-selector-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 12px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: #17243a;
    cursor: pointer;
    text-align: left;
    transition: background-color 150ms ease, transform 150ms ease;
}

    .market-selector-option:hover {
        background: #f0f6fd;
        transform: translateX(2px);
    }

    .market-selector-option:focus-visible {
        outline: 2px solid #1769e0;
        outline-offset: -2px;
    }

    .market-selector-option.selected {
        background: linear-gradient( 90deg, #eaf3ff 0%, #f4f8ff 100% );
    }

.market-option-flag {
    width: 38px;
    height: 38px;
    font-size: 27px;
    box-shadow: inset 0 0 0 1px rgba(7, 27, 51, 0.07);
}

.market-option-details {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

    .market-option-details strong {
        overflow: hidden;
        color: #102844;
        font-size: 0.86rem;
        font-weight: 800;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .market-option-details small {
        color: #758499;
        font-size: 0.72rem;
        font-weight: 600;
    }

.market-option-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #1769e0;
    color: #ffffff;
}

    .market-option-check svg {
        width: 14px;
        height: 14px;
        fill: none;
        stroke: currentColor;
        stroke-linecap: round;
        stroke-linejoin: round;
        stroke-width: 2.3;
    }

@keyframes marketMenuOpen {
    from {
        opacity: 0;
        transform: translateY(-7px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 1160px) {
    .cb-nav-market {
        margin-left: auto;
    }

    .market-selector-button {
        min-width: 0;
        padding: 7px 10px;
    }

    .market-selector-current {
        display: none;
    }

    .market-selector-chevron {
        display: none;
    }
}

@media (max-width: 520px) {
    .market-selector-menu {
        position: fixed;
        top: 76px;
        right: 14px;
        left: 14px;
        width: auto;
        max-height: calc(100vh - 95px);
    }

    .market-selector-options {
        max-height: calc(100vh - 180px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .market-selector-menu {
        animation: none;
    }

    .market-selector-button,
    .market-selector-option,
    .market-selector-chevron {
        transition: none;
    }
}
