/* Mobile make / model picker (assets/js/carpick.js) */

/* the native select must not open its own picker on touch devices */
.carpick-on .carpick-field { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.carpick-on .carpick-field select[data-carpick] { pointer-events: none; }
.carpick-lock, .carpick-lock body { overflow: hidden !important; }

.carpick {
    position: fixed; inset: 0; z-index: 100000;
    background: rgba(15, 23, 42, .45);
    opacity: 0; visibility: hidden;
    transition: opacity .2s ease, visibility 0s linear .2s;
}
.carpick.is-open { opacity: 1; visibility: visible; transition: opacity .2s ease; }

.carpick-panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 100%; height: 100dvh;
    background: #fff; color: #1f2937;
    display: flex; flex-direction: column;
    transform: translateY(24px); transition: transform .22s cubic-bezier(.2, .8, .2, 1);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.carpick.is-open .carpick-panel { transform: none; }
@media (min-width: 640px) {
    /* tablets: a centred card instead of the whole screen */
    .carpick-panel { left: 50%; right: auto; bottom: auto; top: 50%; width: 560px; height: 80vh; border-radius: 16px;
        transform: translate(-50%, -46%); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); overflow: hidden; }
    .carpick.is-open .carpick-panel { transform: translate(-50%, -50%); }
}

.carpick-head {
    display: flex; align-items: center; gap: 4px;
    min-height: 56px; padding: env(safe-area-inset-top, 0px) 4px 0;
    border-bottom: 1px solid #eef0f3;
}
.carpick-title { flex: 1; font-size: 18px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carpick-icon {
    width: 48px; height: 48px; border: 0; background: none; color: #1f2937;
    display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer;
}
.carpick-icon:active { background: #f1f3f6; }
.carpick-back[style*="none"] + .carpick-title { padding-left: 48px; } /* keep the title centred without a back button */

.carpick-search {
    position: relative; margin: 12px 16px 8px;
    display: flex; align-items: center;
    background: #f1f3f6; border-radius: 12px; height: 48px; padding: 0 8px 0 12px; color: #6b7280;
}
.carpick-search:focus-within { background: #fff; box-shadow: 0 0 0 2px #1172B6 inset; }
.carpick-search input {
    flex: 1; height: 100%; border: 0 !important; outline: 0; background: transparent !important;
    font-size: 16px !important; /* 16px: iOS does not zoom the page */
    margin: 0 0 0 8px !important; padding: 0 !important; box-shadow: none !important; color: #1f2937;
}
.carpick-search input::-webkit-search-cancel-button { display: none; }
.carpick-clear { display: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #d1d5db; color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }

.carpick-list { position: relative; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-bottom: 24px; }

.carpick-item {
    display: flex; align-items: center; width: 100%; min-height: 52px;
    padding: 0 20px; border: 0; border-bottom: 1px solid #f1f3f6; background: #fff;
    font-size: 16px; color: #1f2937; text-align: left; cursor: pointer;
}
.carpick-item span { flex: 1; }
.carpick-item:active { background: #f5f8fb; }
.carpick-item.is-selected { color: #1172B6; font-weight: 600; }
.carpick-item.is-selected::after {
    content: ''; width: 20px; height: 20px; flex: none;
    background: no-repeat center / 20px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%231172B6' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E");
}
.carpick-all { color: #1172B6; font-weight: 500; }
.carpick-group { font-weight: 600; background: #fafbfc; }
.carpick-sub { padding-left: 40px; min-height: 48px; font-size: 15px; }

.carpick-section { padding: 16px 20px 8px; font-size: 13px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .03em; }
.carpick-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; border-bottom: 1px solid #f1f3f6; }
.carpick-chip {
    width: auto; min-height: 40px; padding: 0 14px; border: 1px solid #e5e7eb; border-radius: 999px;
    font-size: 15px; background: #fff;
}
.carpick-chip.is-selected { border-color: #1172B6; background: #eaf3fa; }
.carpick-chip.is-selected::after { display: none; }

.carpick-letter {
    position: sticky; top: 0; z-index: 1;
    padding: 6px 20px; background: #f7f8fa; color: #6b7280; font-size: 13px; font-weight: 600;
}
.carpick-empty { padding: 40px 20px; text-align: center; color: #6b7280; font-size: 15px; }
