/**
 * Custom Dropdown Styles
 */

.custom-dropdown-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    z-index: 1;
}

.custom-dropdown-button {
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    background: #ffffff;
    color: #111827;
    cursor: pointer;
    outline: none;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    position: relative;
}

.custom-dropdown-button:hover {
    background: #ffffff;
    border-color: #d1d5db;
}

.custom-dropdown-button:focus {
    background: #ffffff;
    border-color: #3c82f6;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.custom-dropdown-wrapper.open .custom-dropdown-button {
    background: #f9fafb;
    border-color: #3c82f6;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.custom-dropdown-button::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 8px;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: transform 0.2s ease;
    pointer-events: none;
}

.custom-dropdown-wrapper.open .custom-dropdown-button::after {
    transform: translateY(-50%) rotate(180deg);
}

.custom-dropdown-menu {
    position: fixed !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    max-height: 300px;
    overflow-y: auto;
    z-index: 999999 !important;
    display: none;
    margin-top: 0;
    pointer-events: auto !important;
}

/* This selector won't work anymore since menu is in body, but keeping for fallback */
.custom-dropdown-wrapper.open .custom-dropdown-menu {
    display: block;
}

.custom-dropdown-menu.open-above {
    margin-top: 0;
    margin-bottom: 0;
}

.custom-dropdown-option {
    padding: 10px 12px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    outline: none;
}

.custom-dropdown-option:hover,
.custom-dropdown-option:focus {
    background: #f3f4f6;
    outline: none;
}

.custom-dropdown-option.selected {
    background: #eef2ff;
    color: #3c82f6;
    font-weight: 500;
}

.custom-dropdown-option:first-child {
    border-radius: 8px 8px 0 0;
}

.custom-dropdown-option:last-child {
    border-radius: 0 0 8px 8px;
}

.custom-dropdown-option:only-child {
    border-radius: 8px;
}

/* Scrollbar styling for dropdown menu */
.custom-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.custom-dropdown-menu::-webkit-scrollbar-track {
    background: #f9fafb;
    border-radius: 3px;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Integration with header domain controls */
.header-domain-controls .custom-dropdown-wrapper {
    flex: 1;
    min-width: 0;
    position: relative;
}

.header-domain-controls.has-slug .custom-dropdown-button {
    border-radius: 6px 0 0 6px;
}

.header-domain-controls .custom-dropdown-menu {
    min-width: 180px;
    z-index: 999999 !important;
}

/* Domain menu is appended to body, so style it via menu class */
.domain-dropdown-menu {
    max-width: min(560px, calc(100vw - 24px));
}

.domain-dropdown-menu .custom-dropdown-option {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

