/* ========================================
   CUSTOM DROPDOWN STYLES
   Matching the SVG design with rounded border and arrow
   ======================================== */

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

.cff-dropdown-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.cff-dropdown-label .required {
    color: #dc2626;
    margin-left: 2px;
}

.cff-custom-dropdown {
    position: relative;
    display: inline-block;
    width: 100%;
}

.cff-dropdown-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 54px;
    padding: 0 20px;
    background: white;
    border: 1px solid #BFBFBF;
    border-radius: 19.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    color: #000;
    text-align: left;
    position: relative;
    box-sizing: border-box;
}

.cff-dropdown-button:hover {
    border-color: #9CA3AF;
}

.cff-dropdown-button:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.cff-dropdown-button[aria-expanded="true"] {
    border-color: #3B82F6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.cff-dropdown-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 10px;
}

.cff-dropdown-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.cff-dropdown-button[aria-expanded="true"] .cff-dropdown-arrow {
    transform: rotate(180deg);
}

.cff-dropdown-arrow svg {
    width: 14px;
    height: 8px;
}

.cff-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #BFBFBF;
    border-radius: 19.5px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.cff-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cff-dropdown-option {
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    border-bottom: 1px solid #F3F4F6;
    font-size: 16px;
    color: #000;
    position: relative;
}

.cff-dropdown-option:last-child {
    border-bottom: none;
}

/* Selected option: brand colour + a tick on the right (distinct from the focus state). */
.cff-dropdown-option[aria-selected="true"] {
    background-color: #ECEFF0; /* fallback */
    background-color: color-mix(in srgb, var(--color-primary) 8%, #fff);
    color: var(--color-primary);
    font-weight: 500;
}

.cff-dropdown-option[aria-selected="true"]::after {
    content: "\2713"; /* ✓ */
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary);
    font-weight: 700;
    line-height: 1;
}

.cff-dropdown-option:first-child {
    border-radius: 19.5px 19.5px 0 0;
}

.cff-dropdown-option:last-child {
    border-radius: 0 0 19.5px 19.5px;
}

.cff-dropdown-option:only-child {
    border-radius: 19.5px;
}

/* Focused / hovered option: strong, non-colour-only indicator.
   The 4px brand accent bar gives a ≥3:1 difference vs unfocused options
   (WCAG 1.4.11 Non-text Contrast, 1.4.1 Use of Color, 2.4.7 Focus Visible). */
.cff-dropdown-option:hover,
.cff-dropdown-option:focus {
    outline: none;
    background-color: #DDE3E5; /* fallback */
    background-color: color-mix(in srgb, var(--color-primary) 14%, #fff);
    color: #000;
    box-shadow: inset 4px 0 0 0 var(--color-primary); /* left accent bar */
}

/* High Contrast / forced-colors fallback: ensure a system focus ring is shown. */
@media (forced-colors: active) {
    .cff-dropdown-option:hover,
    .cff-dropdown-option:focus {
        outline: 3px solid Highlight;
        outline-offset: -3px;
    }
}

/* Hidden input for form submission */
.cff-dropdown-hidden-input {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .cff-dropdown-button {
        height: 48px;
        padding: 0 16px;
        font-size: 14px;
    }
    
    .cff-dropdown-option {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* Floating Label Styles */
.floating-input {
    position: relative;
}

.floating-label {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    padding: 0 4px;
    color: #6B7280;
    font-size: 16px;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1;
}

.floating-input:focus + .floating-label,
.floating-input:not(:placeholder-shown) + .floating-label,
.floating-input:valid + .floating-label,
.floating-label-active {
    top: 0;
    left: 16px;
    font-size: 12px;
    color: #374151;
    transform: translateY(-50%);
}

/* Dropdown floating label styles */
.cff-dropdown-label {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    padding: 0 4px;
    color: #6B7280;
    font-size: 16px;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1;
    margin: 0;
}

.cff-dropdown-label.floating-label-active {
    top: 0;
    left: 16px;
    font-size: 12px;
    color: #374151;
    transform: translateY(-50%);
}

.cff-dropdown-button {
    position: relative;
}

/* Searchable dropdown (e.g. Topics): filter options while typing */
.cff-dropdown-option-hidden {
    display: none !important;
}

.cff-dropdown-menu--searchable {
    display: flex;
    flex-direction: column;
    max-height: min(320px, 70vh);
    overflow: hidden;
    padding: 0;
}

.cff-dropdown-menu--searchable .cff-dropdown-search-wrap {
    flex-shrink: 0;
    padding: 10px 12px 8px;
    border-bottom: 1px solid #e5e7eb;
}

.cff-dropdown-search {
    width: 100%;
    box-sizing: border-box;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #BFBFBF;
    border-radius: 12px;
    font-size: 15px;
    color: #111827;
    background: #fff;
}

.cff-dropdown-search::placeholder {
    color: #9ca3af;
}

.cff-dropdown-search:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.cff-dropdown-menu--searchable .cff-dropdown-options-inner {
    max-height: 220px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.cff-dropdown-menu--searchable .cff-dropdown-options-inner .cff-dropdown-option:first-child {
    border-radius: 0;
}

/* Dark mode support removed - forcing light mode only */
