/* ===================================
   CUSTOM SELECT/DROPDOWN - CROSS PLATFORM
   Konsisten di semua device & browser
   =================================== */

/* Reset Native Select Styles */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select,
.form-select.custom-select,
select.custom-select {
    /* Reset browser default styles */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    /* TRANSPARENT background agar inherit dari parent */
    background-color: transparent;

    /* PUTIH untuk terbaca di background biru - BUKAN HITAM! */
    color: inherit; /* Inherit warna dari Bootstrap form-control */

    /* Layout & Spacing */
    padding: 14px 45px 14px 16px;
    font-size: 16px; /* Cegah zoom di iOS */
    font-weight: 400; /* NORMAL weight - Sama dengan input text lain */
    line-height: 1.5;

    /* Cursor & Transition */
    cursor: pointer;
    transition: all 0.3s ease;

    /* Custom dropdown arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ffffff' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;

    /* Disable double arrow di IE/Edge */
    &::-ms-expand {
        display: none;
    }
}

/* Focus State */
.custom-select:focus,
.form-select.custom-select:focus,
select.custom-select:focus {
    outline: none;
}

/* Disabled State */
.custom-select:disabled,
.form-select.custom-select:disabled,
select.custom-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Option Styling - Dropdown list */
.custom-select option,
.form-select.custom-select option,
select.custom-select option {
    background-color: #ffffff;
    color: #000000; /* Hitam untuk dropdown list yang muncul */
    padding: 12px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;
}

/* Placeholder option */
.custom-select option[value=""],
.form-select.custom-select option[value=""] {
    color: #6b7280;
    font-style: italic;
}

/* Selected option */
.custom-select option:checked,
.form-select.custom-select option:checked,
select.custom-select option:checked {
    background-color: #0ea5e9;
    color: #ffffff;
    font-weight: 500;
}

/* Hover option */
.custom-select option:hover,
.form-select.custom-select option:hover,
select.custom-select option:hover {
    background-color: #e0f2fe;
    color: #000000;
}

/* iOS/Safari Specific Fixes */
@supports (-webkit-touch-callout: none) {
    .custom-select,
    .form-select.custom-select,
    select.custom-select {
        -webkit-appearance: none;
        min-height: 48px; /* Larger tap target */
    }
}

/* Android Chrome Fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .custom-select,
    .form-select.custom-select,
    select.custom-select {
        -webkit-appearance: none;
    }
}

/* Windows Specific */
@supports (-ms-ime-align: auto) {
    .custom-select option,
    .form-select.custom-select option,
    select.custom-select option {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Dark Mode - Optional override jika perlu */
@media (prefers-color-scheme: dark) {
    .custom-select option,
    .form-select.custom-select option,
    select.custom-select option {
        background-color: #ffffff;
        color: #000000;
    }
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .custom-select,
    .form-select.custom-select,
    select.custom-select {
        min-height: 52px;
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 16px 45px 16px 16px;
    }
}

/* Extra Small Mobile */
@media (max-width: 360px) {
    .custom-select,
    .form-select.custom-select,
    select.custom-select {
        font-size: 15px;
        padding: 14px 40px 14px 14px;
    }
}

/* Label Styling untuk Form Floating */
.form-floating > .custom-select ~ label,
.form-floating > .form-select.custom-select ~ label {
    opacity: 0.65;
    pointer-events: none;
}

/* Label naik saat focus */
.form-floating > .custom-select:focus ~ label,
.form-floating > .form-select.custom-select:focus ~ label {
    opacity: 1;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* Label naik saat ada value */
.form-floating > select.custom-select:not([value=""]):valid ~ label,
.form-floating > select.form-select.custom-select:not([value=""]):valid ~ label {
    opacity: 1;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* Padding adjustment untuk floating label */
.form-floating > select.custom-select,
.form-floating > select.form-select.custom-select {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}

/* Validation States */
.custom-select.is-valid,
.form-select.custom-select.is-valid {
    border-color: #10b981;
}

.custom-select.is-invalid,
.form-select.custom-select.is-invalid {
    border-color: #ef4444;
}

/* Loading State */
.custom-select.loading,
.form-select.custom-select.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Print Styles */
@media print {
    .custom-select,
    .form-select.custom-select,
    select.custom-select {
        border: 1px solid #000;
        background: #fff;
        color: #000;
    }
}
