﻿/* =======================================
   Currency Selector - Scoped CSS
   Prefix: cs- to prevent conflicts
   ======================================= */

/* Increase specificity with html body prefix to override any potential conflicts */



html body .cs-currency-selector {
    position: relative;
    display: inline-block;
    width: 220px;
    user-select: none;
    z-index: 1049;
    vertical-align: middle;
}

html body .cs-dropdown-panel {
    width: auto;
    min-width: 100%;
    max-width: 220px;
}



/* Selected option styling */
html body .cs-selected-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border: 1px solid rgb(0 0 0 / 20%);
    color: inherit;
    padding: 10px 18px;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.5s;
    min-height: 38px;
    box-sizing: border-box;
}

    html body .cs-selected-option:hover,
    html body .cs-selected-option.hover {
        background-color: var(--secondary-color);
        color: var(--white);
    }

    html body .cs-selected-option > div {
        display: flex;
        align-items: center;
        overflow: hidden;
        white-space: nowrap;
    }

/* Arrow indicator */
html body .cs-arrow-down {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 8px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.2s;
}

/* Dropdown panel */
html body .cs-dropdown-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 100%;
    min-width: 220px;
    background-color: white !important;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 1051;
    overflow: hidden;
    color: #333 !important;
    border: 1px solid #ddd;
}

/* Search container */
html body .cs-search-container {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

html body .cs-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

    html body .cs-search-input:focus {
        outline: none;
        border-color: #007bff;
    }

/* Options container */
html body .cs-options-container {
    max-height: 250px;
    overflow-y: auto;
    padding: 4px 0;
}

/* Option styling */
html body .cs-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    color: #333;
}

    html body .cs-option:last-child {
        border-bottom: none;
    }

    html body .cs-option:hover {
        background-color: #1e4d7b30;
    }

    html body .cs-option.cs-active {
        background-color: var(--secondary-color);
        font-weight: 500;
        color: var(--white);
    }

/* No results message */
html body .cs-no-results {
    padding: 12px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* Loading state */
html body .cs-loading-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    height: 38px;
    color: inherit;
    opacity: 0.7;
}

/* Currency symbol styling */
html body .cs-currency-symbol {
    display: inline-block;
    width: 25px;
    text-align: center;
    margin-right: 8px;
    font-weight: 500;
    font-size: 14px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Currency symbol specific styling */
html body .cs-symbol-usd,
html body .cs-symbol-USD {
    font-weight: 600;
}

html body .cs-symbol-eur,
html body .cs-symbol-EUR {
    font-weight: 600;
}

html body .cs-symbol-gbp,
html body .cs-symbol-GBP {
    font-weight: 600;
}

/* Common currency symbols with specific styling */
html body .cs-symbol-jpy,
html body .cs-symbol-JPY,
html body .cs-symbol-cny,
html body .cs-symbol-CNY {
    font-family: sans-serif;
}

html body .cs-symbol-rub,
html body .cs-symbol-RUB {
    font-family: "Open Sans", sans-serif !important;
}

html body .cs-symbol-inr,
html body .cs-symbol-INR {
    font-family: "Open Sans", sans-serif !important;
}

/* Fix for conflicts with other components */
html body .cs-currency-selector input.invalid,
html body .cs-currency-selector input.is-invalid,
html body .cs-currency-selector .invalid,
html body .cs-currency-selector .is-invalid {
    border-color: #ced4da !important;
    background-image: none !important;
}

html body .cs-currency-selector .validation-message,
html body .cs-currency-selector .field-validation-error {
    display: none !important;
}

/* Add these to increase specificity and prevent conflicts */
.cs-currency-selector .cs-option .cs-currency-symbol,
.cs-currency-selector .cs-selected-option .cs-currency-symbol {
    display: inline-block !important;
    min-width: 16px !important;
    text-align: center !important;
    margin-right: 8px !important;
    font-weight: 500 !important;
    vertical-align: middle !important;
}

/* Ensure dropdown styling is properly scoped */
.cs-currency-selector .cs-dropdown-panel {
    z-index: 1051 !important;
    background-color: white !important;
    color: #333 !important;
}

/* Dark mode support */
/*@media (prefers-color-scheme: dark) {
    html body .cs-dropdown-panel {
        background-color: #2b2b2b !important;
        border-color: #444 !important;
        color: #eee !important;
    }

    html body .cs-search-input {
        background-color: #333 !important;
        border-color: #555 !important;
        color: #eee !important;
    }

    html body .cs-option {
        color: #eee !important;
        border-bottom-color: #444 !important;
    }

        html body .cs-option:hover {
            background-color: #3a3a3a !important;
        }

        html body .cs-option.cs-active {
            background-color: #004080 !important;
        }
}*/

/* Mobile responsiveness */
@media screen and (max-width: 576px) {
    html body .cs-dropdown-panel {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        top: auto !important;
        bottom: 0 !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        max-height: 50vh !important;
    }

    html body .cs-options-container {
        max-height: calc(50vh - 57px) !important;
    }
}
