/* Subject / Class / City pickers of the tutor search (Views/Tuition/_SearchFields.cshtml, Scripts/tuition-pick.js).
   Uses the .tu colours from tuition.css. Prefix tp-. */

/* ---------------------------------------------------------------- the field in the search bar */
.tp-field { position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr) 18px; grid-template-rows: auto auto; column-gap: 11px; align-items: center; align-content: center;
    margin: 0; min-width: 0; min-height: 56px; padding: 6px 14px 6px 8px; border-radius: 13px; cursor: pointer; transition: background .15s, box-shadow .15s; }
.tp-field + .tp-field { margin-left: 5px; }
.tp-field + .tp-field::before { content: ''; position: absolute; left: -3px; top: 13px; bottom: 13px; border-left: 1px solid var(--tu-line); }
.tp-field:hover, .tp-field.is-open { background: var(--tu-soft); }
.tp-field:focus-within, .tp-field.is-open { box-shadow: 0 0 0 2px var(--tu-brand) inset; }
.tp-ico { grid-row: 1 / 3; width: 38px; height: 38px; border-radius: 12px; display: grid !important; place-items: center; font-size: 1rem !important; color: var(--tu-brand); background: rgba(13, 148, 136, .1); transition: background .15s, color .15s; }
.tp-field.has-value .tp-ico { background: #0d9488; color: #fff; }
html[data-theme="dark"] .tp-ico { background: rgba(45, 212, 191, .14); }
.tp-cap { align-self: end; font-size: .74rem; line-height: 1.25; font-weight: 700; color: var(--tu-ink2); }
.tp-field select, .tp-val { grid-column: 2; align-self: start; min-width: 0; margin: 0; padding: 0; border: 0; background: transparent; color: var(--tu-ink); font-size: 1rem; line-height: 1.35; font-weight: 700; }
.tp-field select { width: 100%; height: 22px; -webkit-appearance: none; appearance: none; cursor: pointer; }
.tp-field select:focus { outline: none; }
.tp-field option, .tp-field optgroup { background: var(--tu-card); color: var(--tu-ink); font-weight: 400; }
.tp-val { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-field:not(.has-value) .tp-val { font-weight: 600; color: var(--tu-ink2); }
.tp-field::after { content: '\f107'; font-family: FontAwesome; grid-column: 3; grid-row: 1 / 3; justify-self: center; font-size: 1.2rem; color: var(--tu-ink2); pointer-events: none; transition: transform .18s; }
.tp-field.is-open::after { transform: rotate(180deg); color: var(--tu-brand); }
.tp-field.has-value.is-ready::after { visibility: hidden; }   /* the clear button takes its place */
.tp-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; clip-path: inset(50%); }
.tp-btn { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; border-radius: inherit; background: transparent; cursor: pointer; }
.tp-btn:focus { outline: none; }
.tp-x { position: absolute; right: 8px; top: 50%; width: 30px; height: 30px; margin-top: -15px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--tu-ink2); font-size: .9rem; cursor: pointer; }
.tp-x:hover { background: var(--tu-line); color: var(--tu-ink); }
.tp-x:focus-visible { outline: 3px solid #2563eb; outline-offset: -2px; }
.tp-x[hidden] { display: none; }

/* ---------------------------------------------------------------- the panel (one, at the end of <body>) */
.tp-layer[hidden] { display: none; }
.tp-back { display: none; }
.tp-panel { position: absolute; z-index: 990; display: flex; flex-direction: column; overflow: hidden; border-radius: 18px; background: var(--tu-card); color: var(--tu-ink);
    border: 1px solid var(--tu-line); box-shadow: 0 30px 70px -24px rgba(2, 6, 23, .55); animation: tpIn .14s ease-out; }
@keyframes tpIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.tp-panel.is-up { animation-name: tpUp; }
@keyframes tpUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tp-head { display: none; }
.tp-find { position: relative; padding: 12px 12px 8px; }
.tp-find[hidden] { display: none; }
.tp-find i { position: absolute; z-index: 1; left: 27px; top: 50%; margin-top: -5px; font-size: .9rem; color: var(--tu-ink2); pointer-events: none; }
.tp-panel .tp-find input { width: 100%; height: 42px; margin: 0; padding: 0 14px 0 40px !important; border: 1.5px solid var(--tu-line); border-radius: 12px; background: var(--tu-soft); color: var(--tu-ink); font-size: .95rem; box-shadow: none; }
.tp-panel:focus { outline: none; }
html[data-theme="dark"] .tp-panel { color-scheme: dark; }
.tp-find input::placeholder { color: var(--tu-ink2); opacity: 1; }
.tp-find input:focus { outline: none; border-color: var(--tu-brand); background: var(--tu-card); box-shadow: 0 0 0 3px rgba(13, 148, 136, .16); }
.tp-find input::-webkit-search-cancel-button { cursor: pointer; }
.tp-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 12px 12px; scrollbar-width: thin; }
.tp-find[hidden] + .tp-list { padding-top: 12px; }
.tp-list:focus { outline: none; }
.tp-group { margin: 0; padding: 0; }
.tp-group[hidden], .tp-opt[hidden] { display: none !important; }
.tp-group > b { display: block; padding: 10px 4px 6px; font-size: .74rem; font-weight: 800; color: var(--tu-ink2); }
.tp-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.tp-opt { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 42px; padding: 6px 10px 6px 6px; border-radius: 11px; font-size: .92rem; line-height: 1.25; font-weight: 600; color: var(--tu-ink); cursor: pointer; }
.tp-opt > i:first-child { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: .85rem; color: var(--c, var(--tu-brand)); background: var(--tu-soft); }
html[data-theme="dark"] .tp-opt > i:first-child { color: color-mix(in srgb, var(--c, var(--tu-brand)) 55%, #fff); }
.tp-opt span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tp-opt mark { padding: 0; background: rgba(245, 158, 11, .32); color: inherit; border-radius: 3px; }
.tp-tick { display: none; flex: none; color: var(--tu-brand); font-size: .85rem; }
.tp-opt.is-active { background: var(--tu-soft); box-shadow: 0 0 0 2px var(--tu-brand) inset; }
.tp-opt[aria-selected="true"] { background: rgba(13, 148, 136, .12); color: var(--tu-brand2); }
html[data-theme="dark"] .tp-opt[aria-selected="true"] { background: rgba(45, 212, 191, .16); color: #5eead4; }
.tp-opt[aria-selected="true"] .tp-tick { display: inline-block; }
.tp-any .tp-items { grid-template-columns: 1fr; }
.tp-any .tp-opt > i:first-child { color: var(--tu-ink2); }
/* class: chips */
.tp-panel[data-kind="class"] .tp-group:not(.tp-any) .tp-items { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tp-panel[data-kind="class"] .tp-group:not(.tp-any) .tp-opt { justify-content: center; padding: 6px 4px; text-align: center; border: 1px solid var(--tu-line); }
.tp-panel[data-kind="class"] .tp-group:not(.tp-any) .tp-tick { display: none; }
.tp-panel[data-kind="class"] .tp-group:not(.tp-any) .tp-opt span { flex: none; max-width: 100%; }
.tp-panel[data-kind="class"] .tp-group:not(.tp-any) .tp-opt[aria-selected="true"] { background: #0d9488; border-color: #0d9488; color: #fff; }
.tp-panel[data-kind="class"] .tp-group.is-wide .tp-items { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
/* city: popular ones as pills */
.tp-group.is-quick .tp-items { display: flex; flex-wrap: wrap; gap: 8px; }
.tp-group.is-quick .tp-opt { min-height: 38px; padding: 5px 14px; border: 1px solid var(--tu-line); border-radius: 999px; }
.tp-group.is-quick .tp-opt > i:first-child, .tp-group.is-quick .tp-tick { display: none; }
.tp-panel[data-kind="city"] .tp-group:not(.is-quick):not(.tp-any) .tp-items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tp-panel[data-kind="city"] .tp-group:not(.is-quick):not(.tp-any) .tp-opt { padding-left: 10px; }
.tp-none { margin: 0; padding: 22px 12px; text-align: center; font-size: .92rem; color: var(--tu-ink2); }
.tp-none[hidden] { display: none; }

/* ---------------------------------------------------------------- small screens */
@media (min-width: 576px) { .tp-field + button { margin-left: 8px; } }
@media (min-width: 576px) and (max-width: 991px) { .th-fields .tp-field + button { margin: 4px 0 0; } }
@media (min-width: 576px) and (max-width: 767px) { .th-fields .tp-ico { display: none !important; } .th-fields .tp-field { grid-template-columns: minmax(0, 1fr) 18px; padding-left: 12px; } .th-fields select, .th-fields .tp-val, .th-fields .tp-cap { grid-column: 1; } .th-fields .tp-field::after { grid-column: 2; } }
@media (max-width: 767px) {   /* a sheet from the bottom */
    .tp-back { display: block; position: fixed; inset: 0; z-index: 10060; background: rgba(2, 6, 23, .55); }
    .tp-panel { position: fixed; z-index: 10061; left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto !important; max-height: 82vh !important; max-height: 82dvh !important; border-radius: 22px 22px 0 0; border-width: 1px 0 0; animation-name: tpSheet; animation-duration: .2s; padding-bottom: env(safe-area-inset-bottom); }
    @keyframes tpSheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
    .tp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 4px; }
    .tp-head b { font: 800 1.05rem/1.2 'Montserrat', 'Montserrat Fallback', sans-serif; }
    .tp-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--tu-soft); color: var(--tu-ink); font-size: 1rem; cursor: pointer; }
    .tp-close:focus-visible { outline: 3px solid #2563eb; }
    .tp-panel .tp-find input { font-size: 16px; }   /* iOS zooms into smaller boxes */
    .tp-opt { min-height: 46px; }
    .tp-panel[data-kind="class"] .tp-group:not(.tp-any) .tp-items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tp-panel[data-kind="city"] .tp-group:not(.is-quick):not(.tp-any) .tp-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    html.tp-locked { overflow: hidden; }
}
@media (max-width: 575px) {
    .tp-field + .tp-field { margin-left: 0; }
    .tp-field + .tp-field::before { left: 14px; right: 14px; top: 0; bottom: auto; border-left: 0; border-top: 1px solid var(--tu-line); }
    .tp-field + button { margin-top: 4px; }
    .tp-panel[data-kind="subject"] .tp-items { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .tp-panel { animation: none !important; } .tp-field, .tp-field::after, .tp-ico { transition: none; } }
@media (max-width: 767px) {   /* the find-tutors bar is stacked up to here */
    .ts-fields .tp-field + .tp-field { margin-left: 0; }
    .ts-fields .tp-field + .tp-field::before { left: 14px; right: 14px; top: 0; bottom: auto; border-left: 0; border-top: 1px solid var(--tu-line); }
    .ts-fields .tp-field + button { margin: 4px 0 0; }
}
