/* Picker kota -> titik (agen) — form pencarian tiket (FrontEnd/Bookings/search-trip). */

.gx-picker {
    position: relative;
}

.gx-field {
    position: relative;
}

/* ---------------------------------------------------------------- field */

.gx-control {
    position: relative;
    display: flex;
    align-items: center;
    height: 50px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background-color: #f7fafc;
    cursor: text;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.gx-control:hover {
    border-color: #cbd5e0;
}

.gx-picker.is-open .gx-control,
.gx-control:focus-within {
    border-color: #dc2626;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, .1);
}

.gx-picker.has-error .gx-control {
    border-color: #dc2626;
    background-color: #fff5f5;
}

.gx-control-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #dc2626;
    font-size: 16px;
    pointer-events: none;
}

.gx-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0 42px 0 44px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500 !important;
    color: #1a202c;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.gx-input::placeholder {
    color: #64748b;
    font-weight: 400 !important;
    opacity: 1;
}

.gx-input::-ms-clear {
    display: none;
}

.gx-picker.has-value:not(.is-open) .gx-input {
    font-weight: 600 !important;
}

/* Nama pilihan yang terlalu panjang untuk satu baris: tampil dua baris di atas input. */
.gx-value {
    display: none;
}

.gx-picker.is-wrapped:not(.is-open) .gx-input {
    color: transparent;
}

.gx-picker.is-wrapped:not(.is-open) .gx-value {
    position: absolute;
    left: 44px;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 14px;
    font-weight: 600 !important;
    line-height: 1.22;
    color: #1a202c;
    overflow-wrap: anywhere;
    pointer-events: none;
}

.gx-caret {
    position: absolute;
    right: 16px;
    top: 50%;
    margin-top: -7px;
    color: #dc2626;
    font-size: 13px;
    line-height: 14px;
    pointer-events: none;
    transition: transform .2s ease;
}

.gx-picker.is-open .gx-caret {
    transform: rotate(180deg);
}

.gx-clear {
    display: none;
    position: absolute;
    right: 6px;
    top: 50%;
    width: 34px;
    height: 34px;
    margin-top: -17px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #4a5568;
    font-size: 16px;
    cursor: pointer;
}

.gx-clear:hover {
    background: #edf2f7;
    color: #1a202c;
}

.gx-picker.is-open.has-query .gx-clear {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gx-picker.is-open.has-query .gx-caret {
    display: none;
}

.gx-note {
    margin-top: 6px;
    font-size: 13.5px;
    line-height: 1.4;
    color: #4a5568;
}

.gx-note:empty {
    display: none;
}

.gx-note.is-error {
    color: #c53030;
    font-weight: 600 !important;
}

/* ---------------------------------------------------------------- panel */

.gx-sheet-head {
    display: none;
}

.gx-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 1030;
    min-width: 320px;
    overflow: hidden;
    border: 1px solid #cfd6df;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 42px rgba(26, 32, 44, .18), 0 3px 8px rgba(26, 32, 44, .08);
    text-align: left;
}

.gx-panel[hidden] {
    display: none !important;
}

@media (min-width: 1200px) {
    .gx-panel {
        min-width: 0; /* sama lebar dengan field */
    }
}

.gx-list {
    position: relative; /* offsetTop baris dihitung terhadap daftar (dipakai untuk menggulir) */
    max-height: 460px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.gx-section {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 16px;
    border-bottom: 1px solid #cfd6df;
    background: #eef1f5;
    color: #2d3748;
    font-size: 12.5px;
    font-weight: 700 !important;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.gx-section-count {
    flex: 0 0 auto;
    font-weight: 600 !important;
    letter-spacing: .02em;
    text-transform: none;
    color: #4a5568;
}

/* ----------------------------------------------------------------- rows */

.gx-row {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #dfe4ea;
    background: #ffffff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.gx-row:last-child {
    border-bottom: 0;
}

.gx-ico {
    flex: 0 0 20px;
    width: 20px;
    margin-top: 2px;
    text-align: center;
    font-size: 15px;
    line-height: 20px;
    color: #4a5568;
}

.gx-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gx-title {
    font-size: 15px;
    font-weight: 600 !important;
    line-height: 1.35;
    color: #1a202c;
    overflow-wrap: anywhere;
    word-wrap: break-word;
}

.gx-sub {
    font-size: 14px;
    font-weight: 400 !important;
    line-height: 1.45;
    color: #4a5568;
    overflow-wrap: anywhere;
    word-wrap: break-word;
}

/* Kota di daftar awal (belum mengetik): satu baris, jumlah titik di kanan. */
.gx-row--plain {
    align-items: center;
    min-height: 50px;
}

.gx-row--plain .gx-ico {
    margin-top: 0;
    color: #64748b;
}

/* Header grup kota (saat mengetik): latar abu, huruf besar tebal, bisa dipilih. */
.gx-row--group {
    background: #eef1f5;
    border-bottom-color: #cfd6df;
}

.gx-row--group .gx-title {
    font-size: 14px;
    font-weight: 700 !important;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.gx-row--group .gx-ico {
    color: #475569;
}

.gx-row--group + .gx-row--point {
    border-top: 0;
}

/* Titik (agen): nama tebal + alamat, sedikit menjorok di bawah kotanya. */
.gx-row--point {
    padding-left: 30px;
}

.gx-row--point .gx-title {
    font-weight: 700 !important;
}

.gx-row--point .gx-ico {
    color: #dc2626;
}

.gx-row--point + .gx-row--group,
.gx-row--point + .gx-row--plain {
    border-top: 1px solid #cfd6df;
    margin-top: -1px;
}

/* Sorotan keyboard / mouse (is-active ikut mouse yang bergerak). */
.gx-row.is-active {
    background: #fdeaea;
    box-shadow: inset 4px 0 0 #dc2626;
}

.gx-row--group.is-active {
    background: #fbdede;
}

.gx-check {
    flex: 0 0 auto;
    align-self: center;
    color: #dc2626;
    font-size: 14px;
}

.gx-toggle {
    flex: 0 0 auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: #eef1f5;
    color: #2d3748;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600 !important;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}

.gx-toggle:hover {
    border-color: #dc2626;
    color: #b91c1c;
}

.gx-toggle i {
    font-size: 11px;
    transition: transform .2s ease;
}

.gx-toggle[aria-expanded="true"] {
    border-color: #dc2626;
    color: #b91c1c;
    background: #fff5f5;
}

.gx-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

mark.gx-hl {
    padding: 0 1px;
    border-radius: 3px;
    background: #ffe27a;
    color: inherit;
    font-weight: inherit !important;
}

/* Tidak ada hasil / pesan / memuat. */
.gx-empty,
.gx-hint,
.gx-loading {
    padding: 22px 18px;
    text-align: center;
    color: #2d3748;
}

.gx-empty strong,
.gx-hint strong {
    display: block;
    margin-bottom: 4px;
    font-size: 15px;
    font-weight: 700 !important;
    color: #1a202c;
}

.gx-empty span,
.gx-hint span {
    display: block;
    font-size: 14px;
    line-height: 1.45;
    color: #4a5568;
}

.gx-empty::before {
    content: "\f002";
    display: block;
    margin-bottom: 8px;
    font-family: "Font Awesome 6 Free";
    font-weight: 900 !important;
    font-size: 20px;
    color: #a0aec0;
}

.gx-hint-btn {
    margin-top: 12px;
    padding: 8px 16px;
    border: 0;
    border-radius: 8px;
    background: #dc2626;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600 !important;
    cursor: pointer;
}

.gx-hint-btn:hover {
    background: #b91c1c;
}

.gx-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    color: #4a5568;
}

.gx-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top-color: #dc2626;
    border-radius: 50%;
    animation: gx-spin .7s linear infinite;
}

@keyframes gx-spin {
    to { transform: rotate(360deg); }
}

/* Tombol cari sejajar dengan kotak penumpang (desktop). */
@media (min-width: 992px) {
    .gx-submit-col {
        padding-top: 30px; /* tinggi .modern-label (22px) + margin-bottom 8px */
    }

    .gx-submit-col .modern-btn-search {
        min-height: 65px;
    }
}

/* ------------------------------------------------- HP: lembar layar penuh */

@media (max-width: 767px) {
    .gx-input {
        padding: 0 38px 0 40px;
        font-size: 16px; /* < 16px membuat iOS memperbesar halaman saat fokus */
    }

    .gx-control-icon {
        left: 14px;
    }

    .gx-picker.is-wrapped:not(.is-open) .gx-value {
        left: 40px;
        right: 36px;
    }

    .gx-caret {
        right: 14px;
    }

    html.gx-sheet-open,
    html.gx-sheet-open body {
        overflow: hidden !important;
    }

    html.gx-sheet-open .modern-form-card {
        animation: none;
    }

    .gx-picker.is-open .gx-field {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 2000;
        display: flex;
        flex-direction: column;
        background: #ffffff;
    }

    .gx-picker.is-open .gx-sheet-head {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 4px;
        height: 56px;
        padding: 0 8px;
        border-bottom: 1px solid #e2e8f0;
        background: #ffffff;
    }

    .gx-sheet-back {
        width: 44px;
        height: 44px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: transparent;
        color: #1a202c;
        font-size: 18px;
        cursor: pointer;
    }

    .gx-sheet-back:active {
        background: #edf2f7;
    }

    .gx-sheet-title {
        font-size: 17px;
        font-weight: 700 !important;
        color: #1a202c;
    }

    .gx-picker.is-open .gx-control {
        flex: 0 0 auto;
        margin: 12px 16px;
    }

    .gx-picker.is-open .gx-panel {
        position: static;
        flex: 1 1 auto;
        min-height: 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        border: 0;
        border-top: 1px solid #cfd6df;
        border-radius: 0;
        box-shadow: none;
    }

    .gx-picker.is-open .gx-list {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none !important;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .gx-row {
        padding-top: 13px;
        padding-bottom: 13px;
    }
}

/* ==================================================================
   Form tiket (Element/Bookings/search-ticket, .rs-ticket): picker mengisi
   seluruh sel "Dari"/"Ke" seperti select2 dulu; label sel tetap di atas.
   Panel desktop dirender di <body> (.gx-panel--portal) karena .rs-ticket-main
   memakai mask (takik) dan .rs-ticket memakai filter drop-shadow.
   ================================================================== */
.gx-panel--portal {
    right: auto;
    z-index: 1040;
}

.rs-ticket .gx-picker {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.rs-ticket .gx-field,
.rs-ticket .gx-control {
    height: 100%;
}

.rs-ticket .gx-control,
.rs-ticket .gx-control:hover,
.rs-ticket .gx-control:focus-within,
.rs-ticket .gx-picker.is-open .gx-control,
.rs-ticket .gx-picker.has-error .gx-control {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
}

.rs-ticket .gx-control-icon,
.rs-ticket .gx-caret {
    display: none;
}

.rs-ticket .gx-input {
    padding: 26px 30px 0 22px;
    color: var(--rs-ink, #1a202c);
    font-size: 17px;
    font-weight: 600 !important;
    text-overflow: ellipsis;
    cursor: pointer;
}

.rs-ticket .rs-field--to .gx-input {
    padding-right: 18px;
    padding-left: 34px;
}

.rs-ticket .gx-input::placeholder {
    color: #9aa1ad;
    font-size: 15px;
    font-weight: 500 !important;
}

.rs-ticket .rs-field.is-invalid .gx-input::placeholder {
    color: var(--rs-red, #dc2626);
}

.rs-ticket .gx-picker.is-open .gx-input {
    font-weight: 500 !important;
    cursor: text;
}

.rs-ticket .gx-picker.is-wrapped:not(.is-open) .gx-value {
    top: calc(50% + 13px);
    right: 30px;
    left: 22px;
    font-size: 15px;
}

.rs-ticket .rs-field--to .gx-picker.is-wrapped:not(.is-open) .gx-value {
    right: 18px;
    left: 34px;
}

.rs-ticket .gx-clear {
    right: 4px;
    margin-top: -4px;
}

/* Pesan picker di form tiket hanya untuk pembaca layar (aria-live), sama dengan .rs-field-error:
   secara visual field yang salah ditandai label + placeholder merah. */
.rs-ticket .gx-note {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Desktop sempit: jarak kiri sama dengan select2 tiket di modern-home.css */
@media (min-width: 992px) and (max-width: 1199px) {
    .rs-ticket .gx-input {
        padding-left: 18px;
        font-size: 16px;
    }

    .rs-ticket .rs-field--to .gx-input {
        padding-left: 30px;
    }

    .rs-ticket .gx-picker.is-wrapped:not(.is-open) .gx-value {
        left: 18px;
    }

    .rs-ticket .rs-field--to .gx-picker.is-wrapped:not(.is-open) .gx-value {
        left: 30px;
    }
}

/* Tablet & ponsel: tiket bertumpuk, titik rute di kiri (modern-home.css) */
@media (max-width: 991px) {
    .rs-ticket .rs-field--from .gx-input,
    .rs-ticket .rs-field--to .gx-input {
        padding-right: 64px;
        padding-left: 50px;
    }

    .rs-ticket .rs-field--from .gx-picker.is-wrapped:not(.is-open) .gx-value,
    .rs-ticket .rs-field--to .gx-picker.is-wrapped:not(.is-open) .gx-value {
        right: 64px;
        left: 50px;
    }

    .rs-ticket .gx-clear {
        right: 60px;
    }
}

@media (max-width: 767px) {
    /* Lembar layar penuh: position:fixed hanya mengikuti layar bila tidak ada leluhur ber-filter,
       ber-mask, atau ber-transform (animasi masuk tiket). Dimatikan selama lembar terbuka; tiket
       tertutup lembar, jadi tidak terlihat berubah. */
    html.gx-sheet-open .rs-ticket,
    html.gx-sheet-open .rs-ticket-main,
    html.gx-sheet-open .rs-ticket-stub,
    html.gx-sheet-open .rs-landing,
    html.gx-sheet-open .rs-landing-stage,
    html.gx-sheet-open .rs-landing-inner {
        -webkit-filter: none !important;
        filter: none !important;
        -webkit-mask: none !important;
        mask: none !important;
        transform: none !important;
        animation: none !important;
        /* .rs-landing-stage memakai isolation:isolate -> lembar (z 2000) tertahan di bawah navbar fixed */
        isolation: auto !important;
    }

    .rs-ticket .gx-picker.is-open .gx-field {
        height: auto;
    }

    .rs-ticket .gx-picker.is-open .gx-control {
        flex: 0 0 auto;
        height: 50px;
        margin: 12px 16px;
        border: 2px solid #dc2626;
        border-radius: 10px;
        background: #ffffff;
        box-shadow: 0 0 0 4px rgba(220, 38, 38, .1);
        cursor: text;
    }

    .rs-ticket .gx-picker.is-open .gx-control-icon {
        display: block;
    }

    .rs-ticket .rs-field .gx-picker.is-open .gx-input {
        padding: 0 38px 0 40px;
        font-size: 16px;
    }

    .rs-ticket .rs-field .gx-picker.is-open .gx-clear {
        right: 6px;
        margin-top: -17px;
    }
}
