/* =========================================================================
   1. CORE SEARCH BAR STYLES (ZERO-CLS OPTIMIZED)
   ========================================================================= */

.xe-psb-wrapper {
    position: relative;
    width: 100%;
    max-width: 480px; /* Constrains search bar to match the converter width */
    margin: 0 auto 24px auto; /* Centers the search bar horizontally */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    z-index: 99999;
    box-sizing: border-box;
    contain: layout style;
}

.xe-psb-input-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    background: #ffffff;
    border: 1px solid #0F172A;
    padding: 16px 14px;
    border-radius: 25px;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.xe-psb-input-container:focus-within {
    border-color: #2563eb;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15);
}

.xe-psb-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 14px;
    color: #64748b;
    margin-right: 8px;
    flex-shrink: 0;
    user-select: none;
}

.xe-psb-input {
    flex: 1 1 auto;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #0f172a !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: normal !important;
}

.xe-psb-input::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.xe-psb-clear-btn {
    display: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #94a3b8;
    background: #f1f5f9;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    text-align: center;
    line-height: 22px;
    flex-shrink: 0;
    margin-left: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
    user-select: none;
}

.xe-psb-clear-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Floating Dropdown Overlay */
.xe-psb-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    width: 320px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    max-height: 350px;
    overflow-y: auto;
    display: none;
    z-index: 999999;
    -webkit-overflow-scrolling: touch;
}

.xe-psb-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    min-height: 44px;
    text-decoration: none !important;
    color: #1e293b !important;
    border-bottom: 1px solid #f1f5f9;
    box-sizing: border-box;
    transition: background-color 0.15s ease;
}

.xe-psb-item:last-child {
    border-bottom: none;
}

.xe-psb-item:hover, .xe-psb-item.active {
    background-color: #f1f5f9;
}

.xe-psb-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.xe-psb-flag {
    width: 24px;
    height: 17px;
    border-radius: 3px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.xe-psb-text-group {
    display: flex;
    align-items: baseline;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xe-psb-code {
    font-weight: 700;
    font-size: 14px;
    color: #0f172a;
}

.xe-psb-name {
    font-size: 12px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xe-psb-arrow {
    font-size: 12px;
    color: #2563eb;
    font-weight: 600;
    flex-shrink: 0;
    margin-left: 8px;
}

.xe-psb-empty {
    padding: 14px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}

/* =========================================================================
   2. DESKTOP NAVIGATION (PINNED TO FAR RIGHT)
   ========================================================================= */

@media (min-width: 769px) {
    .gp-nav-search-mobile {
        display: none !important;
    }

    .main-navigation .inside-navigation {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
    }

    .gp-nav-search-desktop {
        margin-left: auto !important;
        margin-right: 0 !important;
        display: flex !important;
        align-items: center !important;
        padding-right: 15px !important;
        order: 9999 !important;
        width: 240px !important;
        min-height: 42px !important;
        flex-shrink: 0 !important;
    }

    .gp-nav-search-desktop .xe-psb-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 42px !important;
        margin: 0 !important;
    }

    .gp-nav-search-desktop .xe-psb-input-container {
        height: 42px !important;
        border-radius: 25px !important;
        padding: 7px;
    }
}


/* =========================================================================
   3. MOBILE NAVIGATION (SNUG AT THE BOTTOM OF THE NAV MENU ONLY)
   ========================================================================= */

@media (max-width: 768px) {
    .gp-nav-search-desktop {
        display: none !important;
    }

    .gp-nav-search-mobile {
        display: none !important;
    }

    .slideout-navigation .gp-nav-search-mobile {
        display: block !important;
        width: 100% !important;
        padding: 12px 16px 20px 16px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        clear: both !important;
        order: 99 !important;
        flex-grow: 0 !important;
        pointer-events: auto !important;
    }

    .gp-nav-search-mobile .xe-psb-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 42px !important;
        margin: 0 !important;
    }

    .gp-nav-search-mobile .xe-psb-input-container {
        height: 42px !important;
        border-radius: 25px !important;
        padding: 7px;
    }

    .gp-nav-search-mobile .xe-psb-dropdown {
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }
}