/* Custom select — جایگزین picker پیش‌فرض اندروید در WebView */
.diara-custom-select {
    position: relative;
    width: 100%;
}

.diara-custom-select__trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    color: #111827;
    font: inherit;
    font-weight: 500;
    text-align: right;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.diara-custom-select__trigger:focus-visible {
    outline: none;
    border-color: var(--color-primary, #5865f2);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary, #5865f2) 25%, transparent);
}

.diara-custom-select__trigger:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.diara-custom-select__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.diara-custom-select__label.is-placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.diara-custom-select__chevron {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #6b7280;
}

.diara-custom-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.dark .diara-custom-select__trigger {
    background: var(--color-custom-dark, #151d27);
    border-color: #374151;
    color: #f3f4f6;
}

.dark .diara-custom-select__label.is-placeholder {
    color: #6b7280;
}

/* Bottom sheet portal */
.diara-custom-select-portal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.diara-custom-select-portal.hidden {
    display: none;
}

.diara-custom-select-portal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.diara-custom-select-portal__sheet {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    max-height: min(72vh, 520px);
    border-radius: 16px 16px 0 0;
    background: #fff;
    box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
    animation: diaraCustomSelectSlideUp 0.22s ease;
}

.dark .diara-custom-select-portal__sheet {
    background: #111820;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45);
}

@keyframes diaraCustomSelectSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.diara-custom-select-portal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.dark .diara-custom-select-portal__header {
    border-bottom-color: #374151;
}

.diara-custom-select-portal__title {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.dark .diara-custom-select-portal__title {
    color: #f3f4f6;
}

.diara-custom-select-portal__close {
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 8px;
    cursor: pointer;
}

.diara-custom-select-portal__list {
    overflow-y: auto;
    padding: 8px;
    margin: 0;
    list-style: none;
}

.diara-custom-select-portal__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #111827;
    font: inherit;
    font-weight: 500;
    text-align: right;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.diara-custom-select-portal__option:hover,
.diara-custom-select-portal__option:focus-visible {
    background: #f3f4f6;
    outline: none;
}

.diara-custom-select-portal__option.is-selected {
    background: color-mix(in srgb, var(--color-primary, #5865f2) 12%, #fff);
    color: var(--color-primary, #5865f2);
}

.dark .diara-custom-select-portal__option {
    color: #e5e7eb;
}

.dark .diara-custom-select-portal__option:hover,
.dark .diara-custom-select-portal__option:focus-visible {
    background: #1f242c;
}

.dark .diara-custom-select-portal__option.is-selected {
    background: color-mix(in srgb, var(--color-primary, #5865f2) 18%, #111820);
}

.diara-custom-select-portal__check {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0;
    color: var(--color-primary, #5865f2);
}

.diara-custom-select-portal__option.is-selected .diara-custom-select-portal__check {
    opacity: 1;
}

@media (min-width: 640px) {
    .diara-custom-select-portal {
        align-items: center;
        padding: 16px;
    }

    .diara-custom-select-portal__sheet {
        border-radius: 16px;
        max-height: min(60vh, 480px);
    }
}
