/* Reusable custom dropdown component (.cr-dropdown). Renders a styleable
   trigger + options popover backed by a visually-hidden native <select>,
   so form validation + submission stay native. JS in /js/dropdown.js wires
   up open/close + selection. Used by contact.php; pattern is the same as
   user_area/savings.css's .month-dropdown but generalized.

   Markup contract:
     <div class="cr-dropdown">
         <button type="button" class="cr-dropdown-trigger" aria-haspopup="listbox" aria-expanded="false">
             <span class="cr-dropdown-current is-placeholder">Placeholder</span>
             <i class="fa-solid fa-chevron-down cr-dropdown-chevron"></i>
         </button>
         <ul class="cr-dropdown-options" role="listbox">
             <li class="cr-dropdown-option" role="option" data-value="...">Label</li>
             ...
         </ul>
         <select class="cr-dropdown-native" name="..." required>...</select>
     </div>

   Brand-color overrides (open/focus border, selected option bg, chevron tint)
   are injected by the consuming page's $style — keeps this file portable.
*/

.cr-dropdown {
    position: relative;
    width: 100%;
}

.cr-dropdown-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.cr-dropdown-trigger {
    width: 100%;
    height: 44px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: #0B0427;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    text-align: right;
}

.cr-dropdown-trigger:hover {
    border-color: #9ca3af;
}

.cr-dropdown.is-open .cr-dropdown-trigger,
.cr-dropdown-trigger:focus-visible {
    outline: none;
    border-color: #2020B3;
    box-shadow: 0 0 0 3px color-mix(in srgb, #2020B3 12%, transparent);
}

.cr-dropdown-current.is-placeholder {
    color: #9CA3AF;
    font-weight: 400;
}

.cr-dropdown-chevron {
    font-size: 12px;
    color: #6B7280;
    transition: transform 0.2s ease;
}

.cr-dropdown.is-open .cr-dropdown-chevron {
    transform: rotate(180deg);
    color: #2020B3;
}

.cr-dropdown-options {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    list-style: none;
    margin: 0;
    padding: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.04);
    max-height: 280px;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.cr-dropdown.is-open .cr-dropdown-options {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.cr-dropdown-option {
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #0B0427;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    text-align: right;
}

.cr-dropdown-option + .cr-dropdown-option {
    margin-top: 2px;
}

.cr-dropdown-option:hover {
    background: #f3f4f6;
}

.cr-dropdown-option.is-selected {
    background: #2020B3;
    color: #fff;
}

/* When the wrapping .input-container is flagged invalid by auth_form_validation.js,
   echo the red border onto the visible trigger. */
.input-container.is-invalid .cr-dropdown-trigger {
    border-color: #d92d20;
    box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.10);
}
