/**
 * Country Select Dropdown Styles - Public Signup Forms
 * For use with iframe_signup_2018.ctp layout
 *
 * The signup form uses a stacked layout: label on top, input below (full width)
 */

/* Ensure parent containers don't clip dropdown */
#container,
#content_iframe,
form,
fieldset,
fieldset#basicDataFieldSetSection {
    overflow: visible !important;
}

/* Section wrapper - match other form sections */
section.country-select-section {
    overflow: visible !important;
    position: relative !important;
    z-index: 100 !important;  /* Higher than following sections */
    clear: both;
    width: 100%;
}

/* Container for the input and dropdown */
section.country-select-section > div.country-select-container,
.country-select-container {
    overflow: visible !important;
    position: relative !important;
    width: 100%;
    padding: 0 !important;
    float: none !important;
    height: auto !important;
}

/* Label styling - match other form labels (stacked on top) */
section.country-select-section > label {
    display: block;
    float: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin-bottom: 5px;
    font-size: inherit;
    font-weight: inherit;
    cursor: pointer;
}

/* Search input styling - match other form inputs */
.country-search-input {
    background-color: #fff !important;
    cursor: text !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    padding: 6px 30px 6px 8px !important;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 2px;
}

/* Dropdown container */
.country-dropdown,
div.country-dropdown,
#SignupCountryDropdown {
    display: none;
    position: absolute !important;
    z-index: 99999 !important;
    background: #fff !important;
    border: 1px solid #ccc !important;
    max-height: 200px;
    min-height: 50px;  /* Ensure it has some height */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    top: 100% !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
    border-radius: 0 0 4px 4px;
    float: none !important;
    clear: none !important;
    margin: 0 !important;
    padding: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* CSS fallback: show dropdown when input is focused */
.country-select-container:focus-within > .country-dropdown,
.country-select-container:focus-within > div,
.country-search-input:focus + .country-dropdown,
.country-search-input:focus + div,
.country-search-input:focus ~ .country-dropdown,
.country-search-input:focus ~ div.country-dropdown,
section.country-select-section:focus-within .country-dropdown {
    display: block !important;
}

/* Focus states handled by inline styles + JS */

/* Country options */
.country-option {
    padding: 10px 12px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    background: #fff !important;
    border-bottom: 1px solid #f0f0f0 !important;
    float: none !important;
    clear: none !important;
    width: auto !important;
    height: auto !important;
}

.country-option:last-child {
    border-bottom: none !important;
}

.country-option:hover,
.country-option.highlighted {
    background: #f5f5f5 !important;
}

.country-option.selected {
    background: #e8f4fd !important;
}

/* Country flag image */
.country-flag {
    width: 20px;
    height: 14px;
    object-fit: cover;
    border: 1px solid #ddd;
    min-width: 20px;
    border-radius: 2px;
    display: inline-block !important;
    float: none !important;
}

/* Country name text */
.country-name {
    flex: 1;
    font-size: 14px;
    display: inline !important;
    float: none !important;
}
