/* ============================================================
 * TP V4 — Pesquisa por Categoria (homepage interactive cross-search)
 * ============================================================ */

.tp4-catsearch { padding-block: var(--tp4-s-12) var(--tp4-s-12); background: linear-gradient(180deg, var(--tp4-c-gray-50), #fff); }
.tp4-catsearch__layout {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr;
    gap: 1.25rem;
    margin-block-end: 1.5rem;
}
@media (max-width: 1023px) { .tp4-catsearch__layout { grid-template-columns: 1fr; } }

.tp4-catsearch__col {
    background: #fff;
    border: 1px solid var(--tp4-border);
    border-radius: var(--tp4-r-lg);
    padding: 1.25rem;
    min-height: 280px;
    display: flex; flex-direction: column;
    box-shadow: var(--tp4-shadow-sm);
}
.tp4-catsearch__col-title {
    margin: 0 0 1rem; font-size: var(--tp4-fs-xs);
    text-transform: uppercase; letter-spacing: 0.08em; font-weight: var(--tp4-fw-bold);
    color: var(--tp4-text-muted);
}

/* Categorias visuais */
.tp4-catsearch__cats {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem;
}
.tp4-catsearch__cat {
    appearance: none; border: 1.5px solid var(--tp4-border); background: var(--tp4-c-gray-50);
    cursor: pointer; padding: 0.85rem 0.65rem;
    border-radius: var(--tp4-r-md);
    display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
    text-align: center;
    transition: all var(--tp4-dur) var(--tp4-ease-out);
}
.tp4-catsearch__cat:hover { border-color: var(--tp4-c-brand); background: #fff; transform: translateY(-2px); box-shadow: var(--tp4-shadow-sm); }
.tp4-catsearch__cat.is-selected { border-color: var(--tp4-c-brand); background: var(--tp4-c-brand-soft); }
.tp4-catsearch__cat-icon {
    width: 2.5rem; height: 2.5rem;
    background: var(--tp4-c-brand-soft); color: var(--tp4-c-brand);
    border-radius: var(--tp4-r-md);
    display: inline-flex; align-items: center; justify-content: center;
}
.tp4-catsearch__cat.is-selected .tp4-catsearch__cat-icon { background: var(--tp4-c-brand); color: #fff; }
.tp4-catsearch__cat-name { font-size: var(--tp4-fs-sm); font-weight: var(--tp4-fw-semi); color: var(--tp4-text); }

/* Hint */
.tp4-catsearch__hint {
    flex: 1 1 auto;
    display: flex; align-items: center; justify-content: center;
    text-align: center; color: var(--tp4-text-muted);
    font-size: var(--tp4-fs-sm);
    padding: 1.5rem 0.75rem;
}

/* Makes / Models grids */
.tp4-catsearch__makes, .tp4-catsearch__models {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem;
    max-height: 320px; overflow-y: auto;
    animation: tp4FadeIn 280ms var(--tp4-ease-out);
}
@keyframes tp4FadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tp4-catsearch__make, .tp4-catsearch__model {
    appearance: none; border: 1px solid var(--tp4-border); background: #fff;
    cursor: pointer; padding: 0.55rem 0.7rem;
    border-radius: var(--tp4-r-md);
    text-align: left; color: var(--tp4-text);
    font-size: var(--tp4-fs-sm); font-weight: var(--tp4-fw-medium);
    transition: all var(--tp4-dur) var(--tp4-ease-out);
    display: inline-flex; align-items: center; gap: 0.45rem;
}
.tp4-catsearch__make:hover, .tp4-catsearch__model:hover { border-color: var(--tp4-c-brand); background: var(--tp4-c-brand-soft); transform: translateX(2px); }
.tp4-catsearch__make.is-selected, .tp4-catsearch__model.is-selected { border-color: var(--tp4-c-brand); background: var(--tp4-c-brand-soft); color: var(--tp4-c-brand); }
.tp4-catsearch__make-mark {
    width: 1.5rem; height: 1.5rem;
    background: var(--tp4-c-gray-100); color: var(--tp4-text-soft);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: var(--tp4-fw-bold);
}
.tp4-catsearch__make.is-selected .tp4-catsearch__make-mark { background: var(--tp4-c-brand); color: #fff; }

/* Loading state */
.tp4-catsearch__loading {
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
    color: var(--tp4-text-muted); font-size: var(--tp4-fs-sm);
}
.tp4-catsearch__loading::before {
    content: ""; width: 14px; height: 14px;
    border: 2px solid var(--tp4-c-gray-200);
    border-top-color: var(--tp4-c-brand); border-radius: 50%;
    animation: tp4Spin 0.9s linear infinite; margin-right: 0.5rem;
}
@keyframes tp4Spin { to { transform: rotate(360deg); } }

/* Summary + CTA */
.tp4-catsearch__summary {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--tp4-c-brand) 0%, var(--tp4-c-brand-hover) 100%);
    color: #fff;
    border-radius: var(--tp4-r-lg);
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    flex-wrap: wrap;
    animation: tp4FadeIn 360ms var(--tp4-ease-out);
}
.tp4-catsearch__chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tp4-catsearch__chip {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: var(--tp4-r-pill);
    font-size: var(--tp4-fs-sm); font-weight: var(--tp4-fw-semi);
}
.tp4-catsearch__summary .tp4-btn--primary {
    background: #fff; color: var(--tp4-c-brand);
    border-color: #fff;
}
.tp4-catsearch__summary .tp4-btn--primary:hover { background: var(--tp4-c-gray-50); }
.tp4-catsearch__summary .tp4-btn--primary svg { color: var(--tp4-c-brand); }
