/* ============================================
   SEARCH PAGE STYLES (sp- prefix)
   ConvertICO.com - Browse & Search
   Loads AFTER custom_styles.css for cascade priority
   ============================================ */

/* Page wrapper */
.sp-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
    color: var(--text-primary);
}

/* ============================================
   BREADCRUMB
   ============================================ */
.sp-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.sp-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.sp-breadcrumb a:hover {
    color: var(--primary);
}

.sp-breadcrumb i {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

.sp-breadcrumb__current {
    color: var(--text-primary);
    font-weight: 600;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   HERO / SEARCH HEADER
   ============================================ */
.sp-hero {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 1.5rem;
    background: var(--bg-elevated);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.sp-hero__inner {
    max-width: 700px;
    margin: 0 auto;
}

.sp-hero__title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
    line-height: 1.2;
}

.sp-hero__title i {
    color: #e64e4e;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}

.sp-hero__subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0 0 1.5rem;
    line-height: 1.5;
}

.sp-hero__subtitle strong {
    color: var(--text-primary);
}

.sp-hero__form {
    max-width: 600px;
    margin: 0 auto;
}

.sp-hero__input-wrap {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px;
    transition: all 0.2s ease;
    min-width: 0;
}

.sp-hero__input-wrap:focus-within {
    border-color: #e64e4e;
    box-shadow: 0 0 0 4px rgba(230, 78, 78, 0.12);
}

.sp-hero__search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    margin: 0 12px;
    flex-shrink: 0;
}

.sp-hero__input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text-primary);
    padding: 12px 0;
    outline: none;
}

.sp-hero__input::placeholder {
    color: var(--text-muted);
}

.sp-hero__clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    border-radius: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sp-hero__clear:hover {
    background: rgba(230, 78, 78, 0.1);
    color: #e64e4e;
}

.sp-hero__clear i {
    width: 18px;
    height: 18px;
}

.sp-hero__submit {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 12px 22px;
    background: #e64e4e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.sp-hero__submit:hover {
    background: #d43d3d;
}

.sp-hero__submit:active {
    background: #b73333;
}

.sp-hero__submit i {
    width: 18px;
    height: 18px;
}

/* Popular searches chips */
.sp-popular {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 0.75rem;
}

.sp-popular__label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.sp-popular__label i {
    width: 14px;
    height: 14px;
    color: #339966;
}

.sp-popular__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.sp-popular__chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sp-popular__chip:hover {
    background: #3399cc;
    border-color: #3399cc;
    color: #fff;
    transform: translateY(-1px);
}

/* ============================================
   SECTION HEADERS
   ============================================ */
.sp-section-header {
    margin-bottom: 1.25rem;
    text-align: center;
}

.sp-section-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.sp-section-title i {
    width: 24px;
    height: 24px;
    color: #e64e4e;
}

.sp-section-sub {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

/* ============================================
   FEATURED TOOLS STRIP
   ============================================ */
.sp-featured {
    margin-bottom: 2.5rem;
}

.sp-featured__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.sp-featured__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
    min-width: 0;
}

.sp-featured__card:hover {
    border-color: var(--sp-tool-color);
    transform: translateY(-2px);
}

.sp-featured__icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--sp-tool-color) 12%, transparent);
    border-radius: 12px;
    flex-shrink: 0;
}

.sp-featured__icon i {
    width: 24px;
    height: 24px;
    color: var(--sp-tool-color);
}

.sp-featured__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.sp-featured__cat {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   CATEGORIES BROWSE
   ============================================ */
.sp-categories {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.sp-cat-block {
    background: var(--bg-elevated);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.sp-cat-block:hover {
    box-shadow: var(--shadow-md);
}

.sp-cat-block__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--card-secondary);
    border-bottom: 1px solid var(--border-color);
}

.sp-cat-block__icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--sp-cat-color) 14%, transparent);
    border-radius: 12px;
    flex-shrink: 0;
}

.sp-cat-block__icon i {
    width: 26px;
    height: 26px;
    color: var(--sp-cat-color);
}

.sp-cat-block__info {
    flex: 1;
    min-width: 0;
}

.sp-cat-block__name {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 0.15rem;
    line-height: 1.2;
}

.sp-cat-block__name a {
    color: var(--sp-cat-color);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.sp-cat-block__name a:hover {
    opacity: 0.85;
    text-decoration: underline;
}

.sp-cat-block__count {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.sp-cat-block__view-all {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.1rem;
    background: var(--sp-cat-color);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.sp-cat-block__view-all:hover {
    opacity: 0.9;
    transform: translateX(2px);
}

.sp-cat-block__view-all i {
    width: 16px;
    height: 16px;
}

/* Subcategories grid */
.sp-subcats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1px;
    background: #ecf7fb;
}

.sp-subcat {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1.25rem;
    background: var(--bg-elevated);
    text-decoration: none;
    transition: background 0.2s ease;
    min-width: 0;
}

.sp-subcat:hover {
    background: var(--card-secondary);
}

.sp-subcat__icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--sp-cat-color) 10%, transparent);
    border-radius: 8px;
    flex-shrink: 0;
}

.sp-subcat__icon i {
    width: 18px;
    height: 18px;
    color: var(--sp-cat-color);
}

.sp-subcat__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.sp-subcat__name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.925rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-subcat__count {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.sp-subcat__arrow {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sp-subcat:hover .sp-subcat__arrow {
    opacity: 1;
    transform: translateX(0);
    color: var(--sp-cat-color);
}

/* ============================================
   INFO SECTION (SEO content)
   ============================================ */
.sp-info-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.sp-info-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.sp-info-card__icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, #3399cc 12%, transparent);
    border-radius: 10px;
    margin-bottom: 0.75rem;
}

.sp-info-card__icon i {
    width: 22px;
    height: 22px;
    color: #3399cc;
}

.sp-info-card__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.sp-info-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.55;
}

/* Text links inside info content */
.sp-text-link {
    color: #3399cc;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.sp-text-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

[data-theme="dark"] .sp-text-link {
    color: #60a5fa;
}

[data-theme="dark"] .sp-text-link:hover {
    color: #93c5fd;
}

/* ============================================
   FILTERS BAR
   ============================================ */
.sp-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    background: var(--bg-elevated);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.sp-filters__left,
.sp-filters__right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.sp-filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sp-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.sp-filter-label i {
    width: 15px;
    height: 15px;
}

.sp-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sp-select:hover {
    border-color: #3399cc;
}

.sp-select:focus {
    outline: none;
    border-color: #3399cc;
    box-shadow: 0 0 0 3px rgba(51, 153, 204, 0.15);
}

.sp-active-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sp-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: color-mix(in srgb, #3399cc 12%, transparent);
    color: #3399cc;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

[data-theme="dark"] .sp-chip {
    color: #60a5fa;
}

.sp-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: inherit;
    transition: all 0.2s ease;
}

.sp-chip__remove:hover {
    background: #e64e4e;
    color: #fff;
}

.sp-chip__remove i {
    width: 12px;
    height: 12px;
}

.sp-clear-filters {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.sp-clear-filters:hover {
    color: #e64e4e;
    text-decoration: underline;
}

/* View toggle */
.sp-view-toggle {
    display: flex;
    background: var(--card-secondary);
    border-radius: 8px;
    padding: 4px;
}

.sp-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sp-view-btn:hover {
    color: var(--text-primary);
}

.sp-view-btn.active {
    background: var(--bg-elevated);
    color: #3399cc;
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .sp-view-btn.active {
    color: #60a5fa;
}

.sp-view-btn i {
    width: 18px;
    height: 18px;
}

/* ============================================
   RESULTS
   ============================================ */
.sp-results {
    min-height: 300px;
}

.sp-results-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Category section (grouped results) */
.sp-cat-section {
    background: var(--bg-elevated);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.sp-cat-section__header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.9rem 1.25rem;
    background: var(--card-secondary);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--sp-cat-color);
    margin: 0;
}

.sp-cat-section__header i {
    width: 20px;
    height: 20px;
}

.sp-cat-section__count {
    margin-left: auto;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
}

/* Tools grid */
.sp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1px;
    /* Grid bg matches the cards so empty trailing cells stay white (was
       --border-color, which painted leftover cells grey). Divider lines
       now come from each card's 1px box-shadow filling the gap. */
    background: var(--bg-elevated);
    overflow: hidden;
}

/* Tool card */
.sp-card {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1rem 1.1rem;
    background: var(--bg-elevated);
    text-decoration: none;
    transition: background 0.2s ease;
    position: relative;
    min-width: 0;
    box-shadow: 0 0 0 1px var(--border-color);
    cursor: pointer;
}

/* Whole card stays clickable: the name link stretches over the card,
   the category chip sits above it as its own link. */
.sp-card__link {
    color: inherit;
    text-decoration: none;
}

.sp-card__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.sp-card__link:focus-visible {
    outline: none;
}

.sp-card:has(.sp-card__link:focus-visible) {
    outline: 2px solid var(--sp-tool-color);
    outline-offset: -2px;
}

.sp-cat-section__link {
    color: inherit;
    text-decoration: none;
}

.sp-cat-section__link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sp-card:hover {
    background: var(--card-secondary);
}

.sp-card__icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--sp-tool-color) 12%, transparent);
    border-radius: 10px;
    flex-shrink: 0;
}

.sp-card__icon i {
    width: 22px;
    height: 22px;
    color: var(--sp-tool-color);
}

.sp-card__content {
    flex: 1;
    min-width: 0;
}

.sp-card__name {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.2rem;
}

.sp-card__star {
    width: 14px;
    height: 14px;
    color: #f1c40f;
    fill: #f1c40f;
    flex-shrink: 0;
}

.sp-card__desc {
    font-size: 0.83rem;
    line-height: 1.4;
    color: var(--text-muted);
    margin: 0;
    /* Was nowrap + ellipsis, which cut short, complete descriptions
       mid-word inside a ~200px box. Two lines fit every entry we ship. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sp-card__sub {
    display: inline-block;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--card-secondary);
    padding: 0.12rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.3rem;
    position: relative;
    z-index: 2;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
}

a.sp-card__sub:hover {
    color: var(--sp-tool-color);
    background: color-mix(in srgb, var(--sp-tool-color) 12%, transparent);
}

.sp-card__badge {
    position: absolute;
    top: 0.5rem;
    right: 2.5rem;
    padding: 0.18rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sp-card__badge--new {
    background: var(--success-light);
    color: var(--success-color);
}

.sp-card__badge--beta {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.sp-card__arrow {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.2s ease;
}

.sp-card:hover .sp-card__arrow {
    opacity: 1;
    transform: translateX(0);
    color: var(--sp-tool-color);
}

/* Highlight matched text */
.sp-card mark, .sp-grid mark {
    background: color-mix(in srgb, #f1c40f 35%, transparent);
    color: var(--text-primary);
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 700;
}

/* List view */
.sp-results-container.sp-list-view .sp-grid {
    grid-template-columns: 1fr;
}

.sp-results-container.sp-list-view .sp-card {
    padding: 0.75rem 1rem;
}

.sp-results-container.sp-list-view .sp-card__icon {
    width: 36px;
    height: 36px;
}

.sp-results-container.sp-list-view .sp-card__icon i {
    width: 18px;
    height: 18px;
}

.sp-results-container.sp-list-view .sp-card__desc {
    max-width: 420px;
}

/* ============================================
   NO RESULTS
   ============================================ */
.sp-no-results {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--bg-elevated);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.sp-no-results__icon {
    width: 80px;
    height: 80px;
    background: var(--card-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.sp-no-results__icon i {
    width: 38px;
    height: 38px;
    color: var(--text-muted);
}

.sp-no-results h2 {
    color: var(--text-primary);
    margin: 0 0 0.5rem;
    font-size: 1.4rem;
}

.sp-no-results > p {
    color: var(--text-secondary);
    margin: 0 0 1.5rem;
    font-size: 1rem;
}

/* Did you mean section */
.sp-did-you-mean {
    max-width: 520px;
    margin: 0 auto 1.5rem;
    padding: 1.25rem;
    background: var(--card-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.sp-did-you-mean h3 {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0 0 0.85rem;
}

.sp-did-you-mean h3 i {
    width: 18px;
    height: 18px;
    color: #f1c40f;
}

.sp-did-you-mean__list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sp-did-you-mean__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sp-did-you-mean__item:hover {
    border-color: var(--sp-tool-color);
    transform: translateX(2px);
}

.sp-did-you-mean__item i {
    width: 18px;
    height: 18px;
    color: var(--sp-tool-color);
}

.sp-no-results__suggestions {
    text-align: left;
    max-width: 400px;
    margin: 0 auto 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--card-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.sp-no-results__suggestions h3 {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.sp-no-results__suggestions ul {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

.sp-no-results__actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.sp-help-line {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

/* ============================================
   BUTTONS (scoped, sp-btn)
   ============================================ */
.sp-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.35rem;
    border-radius: 8px;
    font-size: 0.925rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    line-height: 1;
}

.sp-btn i {
    width: 17px;
    height: 17px;
}

.sp-btn--primary {
    background: #e64e4e;
    color: #fff;
}

.sp-btn--primary:hover {
    background: #d43d3d;
    color: #fff;
}

.sp-btn--secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.sp-btn--secondary:hover {
    background: var(--card-secondary);
    border-color: #3399cc;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sp-page {
        padding: 1rem 0.85rem 2rem;
    }

    .sp-hero {
        padding: 1.5rem 1rem;
    }

    .sp-hero__title {
        font-size: 1.4rem;
    }

    .sp-hero__title i {
        width: 24px;
        height: 24px;
    }

    .sp-hero__input {
        font-size: 0.95rem;
    }

    .sp-hero__submit span {
        display: none;
    }

    .sp-hero__submit {
        padding: 12px 14px;
    }

    .sp-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .sp-filters__left,
    .sp-filters__right {
        justify-content: space-between;
        width: 100%;
    }

    .sp-grid,
    .sp-subcats {
        grid-template-columns: 1fr;
    }

    .sp-featured__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sp-cat-block__header {
        flex-wrap: wrap;
    }

    .sp-cat-block__view-all {
        width: 100%;
        justify-content: center;
        margin-top: 0.25rem;
    }

    .sp-no-results__actions {
        flex-direction: column;
    }

    .sp-no-results__actions .sp-btn {
        width: 100%;
        justify-content: center;
    }

    .sp-section-title {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .sp-featured__grid {
        grid-template-columns: 1fr 1fr;
    }

    .sp-popular__chips {
        gap: 0.35rem;
    }

    .sp-popular__chip {
        font-size: 0.8rem;
        padding: 0.3rem 0.7rem;
    }
}

/* ============================================
   LIST VIEW
   The grid/list toggle shipped with markup and button styles but no
   behaviour and no list rules, so clicking "list" did nothing. These are
   the missing rules; the handler lives in search.php.
   ============================================ */
.sp-grid--list {
    grid-template-columns: 1fr;
}

.sp-grid--list .sp-card {
    align-items: center;
    padding: 0.7rem 1.1rem;
    gap: 1rem;
}

.sp-grid--list .sp-card__icon {
    width: 32px;
    height: 32px;
}

.sp-grid--list .sp-card__icon i,
.sp-grid--list .sp-card__icon svg {
    width: 17px;
    height: 17px;
}

/* One line per tool: name and description sit side by side */
.sp-grid--list .sp-card__content {
    display: flex;
    align-items: baseline;
    gap: 0.9rem;
    min-width: 0;
}

.sp-grid--list .sp-card__name {
    margin: 0;
    flex-shrink: 0;
    width: 220px;
}

.sp-grid--list .sp-card__desc {
    display: block;
    -webkit-line-clamp: none;
    line-clamp: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.sp-grid--list .sp-card__sub {
    margin-top: 0;
    margin-left: auto;
    flex-shrink: 0;
}

/* Fixed-width badge slot so the category chips line up down the column
   whether or not a row carries a NEW/BETA badge. The chip keeps its own
   background - stripping it left the text unreadable in dark mode. */
.sp-grid--list .sp-card__badge {
    position: static;
    flex-shrink: 0;
    min-width: 46px;
    text-align: center;
}

.sp-grid--list .sp-card__arrow {
    position: static;
    flex-shrink: 0;
    margin-left: 0.75rem;
}

/* Rows without a badge still need the slot, or their chip drifts right. */
.sp-grid--list .sp-card:not(:has(.sp-card__badge)) .sp-card__sub {
    margin-right: 46px;
}

/* Below the two-column breakpoint the list and grid converge, so keep the
   stacked card layout rather than squeezing a 220px name column. */
@media (max-width: 680px) {
    .sp-grid--list .sp-card__content {
        display: block;
    }
    .sp-grid--list .sp-card__name {
        width: auto;
    }
    .sp-grid--list .sp-card__desc {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    .sp-grid--list .sp-card__badge {
        position: absolute;
        top: 0.5rem;
        right: 2.5rem;
    }
}
