/* =============================================================================
   Custom Select Dropdown — custom-select.css
   Plugin: custom-survey-plugin
   Substitui visualmente os <select> nativos dentro de .ms-item.
   O .ms-item NÃO é alterado — apenas position:relative é garantido abaixo.
   ============================================================================= */

/* ── Contexto de posicionamento para o dropdown absoluto ─────────────────────
   Adiciona apenas position:relative ao .ms-item.
   Não altera nenhum estilo visual existente (cor, borda, padding, etc.).       */
.ms-item {
    position: relative;
}

/* ── Trigger ─────────────────────────────────────────────────────────────────
   Ocupa o mesmo espaço que o <select> nativo ocupava dentro do .ms-item.
   Herda o padding do .ms-item input/select existente (padding: 25px 0).        */
.cs-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 25px 40px 25px 0;
    font-size: 20px;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 1px;
    cursor: pointer;
    background: transparent;
    border: none;
    outline: none;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    min-width: 0;
}

.cs-trigger:focus {
    outline: none;
}

.cs-trigger:focus-visible {
    outline: 2px solid #A975F8;
    outline-offset: 2px;
    border-radius: 4px;
}

.cs-trigger__text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.cs-trigger__arrow {
    flex-shrink: 0;
    margin-left: 12px;
    transition: transform 0.3s ease;
    display: block;
}

.cs-trigger[aria-expanded="true"] .cs-trigger__arrow {
    transform: rotate(180deg);
}

/* ── Dropdown Panel ──────────────────────────────────────────────────────────
   Posicionado absolutamente abaixo do .ms-item.
   display:none por padrão; .cs-dropdown--open o torna visível.                 */
.cs-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(107, 96, 173, 0.18);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 0;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.cs-dropdown--open {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ── Options ─────────────────────────────────────────────────────────────────  */
.cs-dropdown__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cs-option {
    padding: 14px 20px;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    color: #57529B;
    cursor: pointer;
    border-top: 1px solid #F4F7FF;
    transition: background 0.15s ease, color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cs-option:first-child {
    border-top: none;
}

.cs-option:hover,
.cs-option--focused {
    background: #F4F7FF;
    color: #6B60AD;
}

.cs-option--selected {
    background: #EDE9FF;
    color: #6B60AD;
}

.cs-option--selected::after {
    content: '✓';
    color: #A975F8;
    font-weight: 700;
    margin-left: 8px;
    flex-shrink: 0;
}

/* ── Scrollbar customizada (webkit) ──────────────────────────────────────────  */
.cs-dropdown::-webkit-scrollbar {
    width: 6px;
}

.cs-dropdown::-webkit-scrollbar-track {
    background: #F4F7FF;
    border-radius: 3px;
}

.cs-dropdown::-webkit-scrollbar-thumb {
    background: #A975F8;
    border-radius: 3px;
}

.cs-dropdown::-webkit-scrollbar-thumb:hover {
    background: #8B5CF6;
}

/* ── Mobile Overlay ──────────────────────────────────────────────────────────  */
.cs-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s ease;
    /* Previne scroll do body enquanto overlay está aberto */
    touch-action: none;
}

.cs-overlay--visible {
    opacity: 1;
}

/* ── Bottom Sheet ────────────────────────────────────────────────────────────  */
.cs-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-radius: 20px 20px 0 0;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 201;
    padding: 12px 0 24px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    /* Garante que o bottom sheet fique acima do teclado virtual em mobile */
    padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.cs-bottom-sheet--open {
    transform: translateY(0);
}

.cs-bottom-sheet__handle {
    width: 40px;
    height: 4px;
    background: #E9E9F6;
    border-radius: 2px;
    margin: 0 auto 16px;
    flex-shrink: 0;
}

.cs-bottom-sheet__title {
    color: #6B60AD;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    padding: 0 20px 16px;
    border-bottom: 1px solid #F4F7FF;
    margin-bottom: 8px;
}

/* Opções dentro do bottom sheet herdam os estilos de .cs-option */
.cs-bottom-sheet .cs-option {
    padding: 16px 20px;
    font-size: 17px;
}

/* Scrollbar do bottom sheet */
.cs-bottom-sheet::-webkit-scrollbar {
    width: 4px;
}

.cs-bottom-sheet::-webkit-scrollbar-track {
    background: #F4F7FF;
}

.cs-bottom-sheet::-webkit-scrollbar-thumb {
    background: #A975F8;
    border-radius: 2px;
}
