/* styles/custom-select.css */
/* Apple HIG Compliant - Sections 14, 32, 37 */

.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
    max-width: 200px;
}

/* The Trigger: Apple HIG Button Style (Sections 26, 32) */
.custom-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    
    padding: 0 16px;
    font-size: 17px;
    font-weight: 500;
    color: var(--text-primary);
    min-height: 44px;
    background: var(--surface-secondary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1), background 0.2s ease, box-shadow 0.2s ease;
    
    width: 100%;
}

.custom-select-trigger span {
    margin: 0 auto;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.41px;
}

.custom-select-trigger:hover,
.custom-select-wrapper.open .custom-select-trigger {
    background: var(--surface);
    box-shadow: var(--shadow-elevated);
}

/* The Options Dropdown - Apple Context Menu Style (Section 14) */
.custom-options {
    position: absolute;
    bottom: calc(100% + 8px);
    
    width: 280px;
    left: 50%;
    margin-left: -140px;

    /* Apple Material */
    background: var(--glass-bg);
    backdrop-filter: var(--glass-vibrancy);
    -webkit-backdrop-filter: var(--glass-vibrancy);
    border: 0.5px solid var(--glass-border);
    border-radius: 16px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    
    /* Apple spring animation */
    transform: translateY(8px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    
    max-height: 320px;
    overflow-y: auto;
    box-shadow: var(--shadow-floating);
}

.custom-options::-webkit-scrollbar {
    width: 5px;
}
.custom-options::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 10px;
}

.custom-select-wrapper.open .custom-options {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

.custom-option {
    position: relative;
    display: block;
    padding: 12px 16px;
    font-size: 17px;
    font-weight: 400;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    border-bottom: 0.5px solid var(--glass-border);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.41px;
}

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

/* Active Item Highlight */
.custom-option:hover,
.custom-option.selected {
    background: var(--surface);
    color: var(--text-primary);
}

.custom-option.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent-blue);
    border-top-right-radius: 2px;
    border-bottom-right-radius: 2px;
}

@media (max-width: 768px) {
    .custom-select-wrapper { width: 100%; max-width: none; }
    
    .custom-options {
        width: calc(100vw - 32px);
        left: 16px;
        margin-left: 0;
        bottom: 16px;
        top: auto;
        transform: translateY(16px) scale(0.95);
        position: fixed;
        max-height: 60vh;
    }
    .custom-select-wrapper.open .custom-options { transform: translateY(0) scale(1); }
}

body.simple-mode #chapterSelectWrapper,
body.simple-mode #verseSelectWrapper,
body.simple-mode #translationAudioSelectWrapper,
body.simple-mode #reciterSelectWrapper {
    display: none !important;
}
