/* ── Search form container ──────────────────────────────────── */
.container {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

/* ── Text input ─────────────────────────────────────────────── */
input[type=text] {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1.5px solid var(--c-border);
    border-radius: 8px;
    box-sizing: border-box;
    outline: none;
    background: var(--c-bg);
    color: var(--c-text);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input[type=text]:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
    background: var(--c-surface);
}

input[type=text]::placeholder {
    color: var(--c-muted);
}

/* ── Button ─────────────────────────────────────────────────── */
button {
    background-color: var(--c-primary);
    border: none;
    color: #fff;
    text-align: center;
    padding: 10px 22px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color 0.2s, transform 0.1s;
}

button:hover {
    background-color: var(--c-primary-dk);
}

button:active {
    transform: scale(0.97);
}

/* ── Checkbox row ───────────────────────────────────────────── */
div.checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--c-muted);
    font-size: 0.9em;
    white-space: nowrap;
    margin: 0;
}

div.checkbox input[type=checkbox] {
    accent-color: var(--c-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ── Mode toggle (站牌 / 路線) ──────────────────────────────── */
.mode-toggle {
    display: flex;
    border: 1.5px solid var(--c-border);
    border-radius: 8px;
    overflow: hidden;
}

.mode-btn {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.mode-btn input[type=radio] {
    display: none;
}

.mode-btn span {
    padding: 8px 16px;
    font-size: 0.95em;
    font-weight: 500;
    color: var(--c-muted);
    background: var(--c-bg);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.mode-btn input[type=radio]:checked + span {
    background: var(--c-primary);
    color: #fff;
}

/* ── Fuzzy search hint (route mode) ─────────────────────────── */
.fuzzy-hint-cell {
    text-align: center;
    color: var(--c-muted);
    font-size: 0.85em;
}

.fuzzy-hint-cell a {
    color: var(--c-primary);
    text-decoration: none;
}

.fuzzy-hint-cell a:hover {
    text-decoration: underline;
}

/* ── Page nav (favorites link) ───────────────────────────────── */
#page-nav {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

#fav-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1.5px solid var(--c-primary);
    border-radius: 20px;
    color: var(--c-primary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

#fav-link:hover {
    background: var(--c-primary);
    color: #fff;
}

/* ── Recent searches chips ───────────────────────────────────── */
#recent-searches {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.recent-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px 4px 10px;
    border: 1.5px solid var(--c-border);
    border-radius: 20px;
    background: var(--c-surface);
    font-size: 0.85rem;
    color: var(--c-text);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    white-space: nowrap;
}

.recent-chip:hover {
    border-color: var(--c-primary);
    background: var(--c-primary-lt);
}

.chip-mode {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 4px;
    margin-right: 2px;
}

.chip-mode-stop  { background: #dbeafe; color: #1d4ed8; }
.chip-mode-route { background: #dcfce7; color: #15803d; }

.chip-del {
    background: none;
    border: none;
    padding: 0 2px;
    margin: 0;
    color: var(--c-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    font-weight: 400;
    transform: none;
    transition: color 0.15s;
}

.chip-del:hover {
    color: #ef4444;
}

/* ── Inline map button (route results) ───────────────────────── */
.map-btn-inline {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    border: 1px solid var(--c-primary);
    border-radius: 10px;
    color: var(--c-primary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    vertical-align: middle;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.map-btn-inline:hover {
    background: var(--c-primary);
    color: #fff;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media screen and (max-width: 700px) {
    input[type=text] { font-size: 16px; }
    button { font-size: 15px; padding: 10px 16px; }
}

@media screen and (min-width: 700px) {
    input[type=text] { font-size: 17px; }
    button { font-size: 16px; }
}
