/* SubTube search results -------------------------------------------------- */

.home-page .search-result-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    width: 100%;
    margin: 20px 0 0 !important;
    padding: 0;
}

.home-page .search-result-grid > * {
    width: auto;
    max-width: none;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.home-page #video-search .filter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.st-search-heading-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    align-items: flex-end;
    flex-direction: column;
}

.st-youtube-attribution {
    display: inline-flex;
    width: 140px;
    height: 50px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 7px;
    background: #0d1424;
}

.st-youtube-attribution img {
    display: block;
    width: 140px;
    height: 50px;
    object-fit: contain;
}

.st-youtube-attribution:focus-visible {
    outline: 3px solid rgba(85, 215, 255, 0.3);
    outline-offset: 3px;
}

.st-caption-filter {
    align-content: start;
}

.st-caption-toggle {
    position: relative;
    display: flex;
    gap: 9px;
    min-height: 44px;
    align-items: center;
    padding: 0 11px;
    border: 1px solid var(--st-border-strong);
    border-radius: 9px;
    color: var(--st-text);
    background: var(--st-surface-soft);
    cursor: pointer;
}

.st-caption-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.st-caption-toggle > span {
    position: relative;
    flex: 0 0 auto;
    width: 31px;
    height: 18px;
    border-radius: 999px;
    background: #344057;
    transition: background 160ms ease;
}

.st-caption-toggle > span::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d9e2ee;
    content: "";
    transition: transform 160ms ease;
}

.st-caption-toggle input:checked + span {
    background: linear-gradient(135deg, #7041e8, #8b5cf6);
}

.st-caption-toggle input:checked + span::after {
    background: #fff;
    transform: translateX(13px);
}

.st-caption-toggle input:focus-visible + span {
    outline: 3px solid rgba(85, 215, 255, 0.3);
    outline-offset: 2px;
}

.st-caption-toggle input:disabled ~ * {
    opacity: 0.52;
}

.st-caption-toggle strong {
    min-width: 0;
    overflow: hidden;
    font-size: 0.7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.st-filter-summary {
    display: flex;
    gap: 12px;
    min-height: 34px;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    color: #75859c;
    font-size: 0.68rem;
}

.st-filter-summary > span {
    display: inline-flex;
    gap: 7px;
    min-width: 0;
    align-items: center;
}

.st-filter-summary > span > i {
    flex: 0 0 auto;
    color: var(--st-primary-bright);
}

.st-filter-summary > span > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.st-filter-summary button,
.st-recent-searches header button {
    flex: 0 0 auto;
    padding: 4px 0;
    border: 0;
    color: #9e8de0;
    background: transparent;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.st-filter-summary button:hover,
.st-recent-searches header button:hover {
    color: #c4b5fd;
}

.st-filter-summary button[hidden],
.st-recent-searches[hidden],
.st-search-pagination[hidden],
.st-channel-video-context[hidden],
.st-search-error[hidden] {
    display: none !important;
}

.st-recent-searches {
    margin-top: 8px;
    padding: 11px 12px;
    border: 1px solid rgba(51, 65, 93, 0.52);
    border-radius: 11px;
    background: rgba(8, 14, 27, 0.34);
}

.st-recent-searches header {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    color: #7f8da2;
    font-size: 0.65rem;
    font-weight: 750;
}

.st-recent-searches header > span {
    display: inline-flex;
    gap: 7px;
    align-items: center;
}

.st-recent-searches header i {
    color: var(--st-cyan);
}

.st-recent-search-list {
    display: flex;
    gap: 7px;
    margin-top: 9px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
}

.st-recent-search-chip {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 6px;
    min-height: 32px;
    max-width: 220px;
    align-items: center;
    padding: 5px 10px;
    overflow: hidden;
    border: 1px solid rgba(71, 85, 105, 0.58);
    border-radius: 999px;
    color: #aab7c9;
    background: rgba(24, 33, 53, 0.65);
    font: inherit;
    font-size: 0.66rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.st-recent-search-chip:hover {
    border-color: rgba(167, 139, 250, 0.55);
    color: #f1edff;
    background: rgba(139, 92, 246, 0.11);
}

.st-filter-summary button:focus-visible,
.st-recent-searches header button:focus-visible,
.st-recent-search-chip:focus-visible,
.st-channel-video-context button:focus-visible,
.st-load-more:focus-visible {
    outline: 3px solid rgba(85, 215, 255, 0.3);
    outline-offset: 3px;
}

.st-recent-search-chip i {
    flex: 0 0 auto;
    color: var(--st-primary-bright);
}

.st-search-live {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

.st-channel-video-context {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(85, 215, 255, 0.22);
    border-radius: 12px;
    color: #b9c7d9;
    background: linear-gradient(135deg, rgba(85, 215, 255, 0.07), rgba(139, 92, 246, 0.07));
}

.st-channel-video-context > div {
    display: flex;
    gap: 10px;
    min-width: 0;
    align-items: center;
}

.st-channel-video-context > div > i {
    flex: 0 0 auto;
    color: var(--st-cyan);
    font-size: 1rem;
}

.st-channel-video-context span,
.st-channel-video-context strong,
.st-channel-video-context small {
    display: block;
}

.st-channel-video-context span {
    min-width: 0;
}

.st-channel-video-context strong {
    overflow: hidden;
    color: var(--st-text);
    font-size: 0.76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.st-channel-video-context small {
    margin-top: 3px;
    color: var(--st-text-muted);
    font-size: 0.64rem;
}

.st-channel-video-context button {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 6px;
    min-height: 36px;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid rgba(167, 139, 250, 0.34);
    border-radius: 9px;
    color: #d5ccfb;
    background: rgba(139, 92, 246, 0.09);
    font: inherit;
    font-size: 0.66rem;
    font-weight: 750;
    cursor: pointer;
}

.st-search-card {
    position: relative;
    display: flex;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    border: 1px solid rgba(71, 85, 105, 0.56);
    border-radius: 16px;
    color: var(--st-text);
    background:
        radial-gradient(circle at 100% 0, rgba(139, 92, 246, 0.1), transparent 38%),
        linear-gradient(145deg, rgba(24, 33, 53, 0.96), rgba(13, 20, 36, 0.98));
    box-shadow: 0 18px 42px rgba(1, 6, 18, 0.2);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.st-video-result {
    flex-direction: column;
}

.st-search-card:hover,
.st-search-card:focus-within {
    border-color: rgba(167, 139, 250, 0.7);
    box-shadow: 0 22px 48px rgba(1, 6, 18, 0.34), 0 0 0 1px rgba(139, 92, 246, 0.12);
    transform: translateY(-3px);
}

.st-search-card-media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    color: inherit;
    background: #080d19;
    text-decoration: none;
}

.st-search-card-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.st-search-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    padding: 18px;
}

.st-result-eyebrow {
    display: block;
    margin-bottom: 7px;
    color: var(--st-primary-bright);
    font-size: 0.64rem;
    font-weight: 850;
    letter-spacing: 0.16em;
}

.st-search-card h3 {
    display: -webkit-box;
    min-height: 2.8em;
    margin: 0;
    overflow: hidden;
    color: var(--st-text);
    font-size: 0.98rem;
    font-weight: 780;
    line-height: 1.4;
    letter-spacing: -0.012em;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.st-search-title-link,
.st-channel-title-link {
    color: inherit;
    text-decoration: none;
}

.st-search-title-link:hover,
.st-channel-title-link:hover {
    color: #d7ceff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.st-search-card-media:focus-visible,
.st-search-title-link:focus-visible,
.st-channel-avatar:focus-visible,
.st-channel-title-link:focus-visible {
    outline: 3px solid rgba(85, 215, 255, 0.3);
    outline-offset: -3px;
}

.st-result-channel {
    display: flex;
    gap: 7px;
    align-items: center;
    min-width: 0;
    margin: 10px 0 0;
    overflow: hidden;
    color: #b7c2d3;
    font-size: 0.76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.st-result-channel .bi {
    flex: 0 0 auto;
    color: var(--st-cyan);
}

.st-result-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 14px 0 17px;
    padding: 0;
    list-style: none;
}

.st-result-metrics li {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    min-height: 28px;
    padding: 5px 8px;
    border: 1px solid rgba(71, 85, 105, 0.5);
    border-radius: 999px;
    color: var(--st-text-muted);
    background: rgba(8, 14, 27, 0.48);
    font-size: 0.68rem;
    white-space: nowrap;
}

.st-result-metrics .bi {
    color: var(--st-primary-bright);
}

.st-search-action {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    min-height: 43px;
    padding: 9px 13px;
    border: 1px solid transparent;
    border-radius: 10px;
    outline: 0;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 780;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.st-search-action.is-primary {
    color: #fff;
    background: linear-gradient(135deg, #7647ee, #925cf6);
    box-shadow: 0 10px 24px rgba(124, 77, 255, 0.22);
}

.st-search-action.is-primary:hover {
    color: #fff;
    background: linear-gradient(135deg, #8254f4, #a16cff);
    box-shadow: 0 12px 28px rgba(124, 77, 255, 0.3);
    transform: translateY(-1px);
}

.st-search-action.is-secondary {
    border-color: rgba(85, 215, 255, 0.34);
    color: #bceeff;
    background: rgba(85, 215, 255, 0.07);
}

.st-search-action.is-secondary:hover {
    border-color: rgba(85, 215, 255, 0.65);
    color: #e5faff;
    background: rgba(85, 215, 255, 0.12);
}

.st-search-action:focus-visible {
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.34);
}

.st-search-action:disabled {
    opacity: 0.48;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.st-button-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: st-search-spin 700ms linear infinite;
}

.st-channel-result {
    flex-direction: column;
}

.st-channel-card-header {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 20px 18px 0;
}

.st-channel-avatar {
    display: block;
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    padding: 3px;
    border: 1px solid rgba(167, 139, 250, 0.6);
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.32), rgba(85, 215, 255, 0.2));
}

.st-channel-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 18px;
    object-fit: cover;
}

.st-channel-identity {
    min-width: 0;
}

.st-channel-identity .st-result-eyebrow {
    color: var(--st-cyan);
}

.st-channel-identity h3 {
    min-height: auto;
}

.st-channel-result .st-result-metrics {
    margin-top: 0;
}

.st-channel-description {
    display: -webkit-box;
    min-height: 4.5em;
    margin: 0 0 18px;
    overflow: hidden;
    color: var(--st-text-muted);
    font-size: 0.75rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.st-search-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: auto;
}

.st-search-card-actions.st-video-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.st-video-result .st-result-metrics {
    max-height: 63px;
    overflow: hidden;
}

.st-search-skeleton {
    display: flex;
    height: 100%;
    min-height: 340px;
    overflow: hidden;
    flex-direction: column;
    border: 1px solid rgba(71, 85, 105, 0.36);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(24, 33, 53, 0.72), rgba(13, 20, 36, 0.78));
}

.st-skeleton-media,
.st-skeleton-line {
    display: block;
    background: linear-gradient(90deg, rgba(54, 67, 91, 0.34) 20%, rgba(100, 116, 139, 0.24) 42%, rgba(54, 67, 91, 0.34) 64%);
    background-size: 240% 100%;
    animation: st-search-shimmer 1.25s ease-in-out infinite;
}

.st-skeleton-media {
    aspect-ratio: 16 / 9;
    width: 100%;
}

.st-skeleton-body {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.st-skeleton-line {
    width: 100%;
    height: 11px;
    border-radius: 999px;
}

.st-skeleton-line.is-short { width: 28%; height: 8px; }
.st-skeleton-line.is-title { width: 88%; height: 16px; }
.st-skeleton-line.is-meta { width: 62%; }
.st-skeleton-line.is-action { height: 43px; margin-top: 10px; border-radius: 10px; }

.st-search-skeleton.is-channel {
    min-height: 270px;
}

.st-search-skeleton.is-channel .st-skeleton-media {
    width: 72px;
    margin: 20px 18px 0;
    border-radius: 22px;
    aspect-ratio: 1;
}

.st-search-pagination {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.st-load-more {
    display: inline-flex;
    gap: 8px;
    min-width: 210px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border: 1px solid rgba(167, 139, 250, 0.42);
    border-radius: 11px;
    color: #d8cdfd;
    background: rgba(139, 92, 246, 0.09);
    font: inherit;
    font-size: 0.74rem;
    font-weight: 780;
    cursor: pointer;
}

.st-load-more:hover:not(:disabled) {
    border-color: rgba(167, 139, 250, 0.7);
    color: #fff;
    background: rgba(139, 92, 246, 0.16);
}

.st-load-more:disabled {
    opacity: 0.55;
    cursor: wait;
}

.st-search-state {
    grid-column: 1 / -1;
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: center;
    min-height: 132px;
    padding: 28px;
    border: 1px dashed rgba(71, 85, 105, 0.72);
    border-radius: 16px;
    color: var(--st-text-muted);
    background: rgba(13, 20, 36, 0.62);
    text-align: left;
}

.st-search-state-visual {
    display: grid;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(167, 139, 250, 0.34);
    border-radius: 13px;
    color: var(--st-primary-bright);
    background: var(--st-primary-soft);
    font-size: 1.05rem;
}

.st-search-state-copy {
    display: grid;
    gap: 4px;
}

.st-search-state-copy strong {
    color: var(--st-text);
    font-size: 0.88rem;
}

.st-search-state-copy > span {
    font-size: 0.75rem;
}

.st-search-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(167, 139, 250, 0.18);
    border-top-color: var(--st-primary-bright);
    border-radius: 50%;
    background: transparent;
    animation: st-search-spin 750ms linear infinite;
}

.home-page .st-search-error {
    gap: 9px;
    align-items: flex-start;
    margin: 16px 0 0;
    padding: 12px 14px;
    border: 1px solid rgba(251, 113, 133, 0.38);
    border-radius: 11px;
    color: #fecdd3;
    background: rgba(159, 18, 57, 0.14);
    font-size: 0.78rem;
}

.home-page .st-search-error::before {
    flex: 0 0 auto;
    color: var(--st-danger);
    font-family: "bootstrap-icons";
    content: "\f33a";
}

@keyframes st-search-spin {
    to { transform: rotate(360deg); }
}

@keyframes st-search-shimmer {
    to { background-position: -200% 0; }
}

@media (max-width: 1120px) {
    .home-page .search-result-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-page #video-search .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .home-page .search-result-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 13px;
        margin-top: 15px !important;
    }

    .st-search-card {
        border-radius: 14px;
    }

    .st-search-card-body {
        padding: 15px;
    }

    .st-search-card h3 {
        font-size: 0.93rem;
    }

    .st-channel-card-header {
        padding: 17px 15px 0;
    }

    .st-channel-avatar {
        width: 64px;
        height: 64px;
        border-radius: 19px;
    }

    .st-channel-avatar img {
        border-radius: 15px;
    }

    .st-search-card-actions {
        grid-template-columns: 1fr;
    }

    .st-search-card-actions.st-video-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-page #video-search .filter-grid {
        grid-template-columns: 1fr;
    }

    .st-search-heading-actions {
        width: 100%;
        align-items: flex-start;
    }

    .st-filter-summary {
        align-items: flex-start;
    }

    .st-channel-video-context {
        align-items: stretch;
        flex-direction: column;
    }

    .st-channel-video-context button {
        width: 100%;
        justify-content: center;
    }

    .st-search-skeleton {
        min-height: 320px;
        border-radius: 14px;
    }

    .st-load-more {
        width: 100%;
        min-height: 48px;
    }

    .st-search-state {
        min-height: 116px;
        padding: 22px 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .st-search-card,
    .st-search-action {
        transition: none;
    }

    .st-search-card:hover,
    .st-search-card:focus-within,
    .st-search-action:hover {
        transform: none;
    }

    .st-skeleton-media,
    .st-skeleton-line {
        animation: none;
        background: rgba(71, 85, 105, 0.38);
    }
}
