/* =========================================================
   Somepato Tags
   - tag list
   - tag detail
   - user tag list
========================================================= */

.sp-tags-main {
    padding: 0 16px 32px;
}

.sp-tags-main a {
    text-decoration: none;
}

.sp-tags-hero {
    padding: 18px 0 18px;
    border-bottom: 1px solid var(--sp-border, #e5e7eb);
}

.sp-tags-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.sp-tags-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-bottom: 8px;
    padding: 0 9px;
    border-radius: var(--sp-radius-pill, 999px);
    background: var(--sp-brand-soft, #fff3e8);
    color: var(--sp-brand-strong, #c2410c);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.sp-tags-title {
    margin: 0;
    color: var(--sp-text, #111827);
    font-size: 24px;
    font-weight: 850;
    line-height: 1.35;
    letter-spacing: -0.04em;
    word-break: keep-all;
}

.sp-tags-description {
    max-width: 620px;
    margin: 9px 0 0;
    color: var(--sp-muted, #6b7280);
    font-size: 14px;
    line-height: 1.7;
    letter-spacing: -0.01em;
    word-break: keep-all;
}

.sp-tags-count-card {
    flex: 0 0 auto;
    min-width: 72px;
    padding: 10px 12px;
    border-radius: 16px;
    background: #f8fafc;
    text-align: right;
}

.sp-tags-count-card strong {
    display: block;
    color: var(--sp-text, #111827);
    font-size: 20px;
    font-weight: 850;
    line-height: 1.1;
}

.sp-tags-count-card span {
    display: block;
    margin-top: 4px;
    color: var(--sp-muted, #6b7280);
    font-size: 12px;
    font-weight: 700;
}

.sp-tags-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
}

.sp-tags-filter-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid var(--sp-border, #e5e7eb);
    border-radius: var(--sp-radius-pill, 999px);
    background: #fff;
    color: var(--sp-text-subtle, #374151);
    font-size: 12px;
    font-weight: 750;
}

.sp-tags-filter-chip:hover,
.sp-tags-filter-chip.is-active {
    border-color: rgba(249, 115, 22, 0.24);
    background: var(--sp-brand-soft, #fff3e8);
    color: var(--sp-brand-strong, #c2410c);
}

.sp-tags-section-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    padding: 12px 0;
    border-bottom: 1px solid var(--sp-border, #e5e7eb);
}

.sp-tags-section-title-wrap {
    display: flex;
    align-items: baseline;
    min-width: 0;
    gap: 7px;
}

.sp-tags-section-title {
    margin: 0;
    color: var(--sp-text, #111827);
    font-size: 16px;
    font-weight: 850;
    line-height: 1.4;
    letter-spacing: -0.03em;
}

.sp-tags-section-count {
    color: var(--sp-muted, #6b7280);
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.sp-tags-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.sp-tags-search,
.sp-tags-select-form {
    display: flex;
    align-items: center;
    margin: 0;
}

.sp-tags-search {
    width: 260px;
}

.sp-tags-search input {
    width: 100%;
    min-width: 0;
    height: 36px;
    padding: 0 11px;
    border: 1px solid var(--sp-border, #e5e7eb);
    border-right: 0;
    border-radius: 12px 0 0 12px;
    background: #f8fafc;
    color: var(--sp-text, #111827);
    font-size: 13px;
}

.sp-tags-search input:focus {
    z-index: 1;
    border-color: var(--sp-brand, #f97316);
    background: #fff;
    outline: none;
    box-shadow: var(--sp-search-focus-ring, 0 0 0 3px rgba(249, 115, 22, 0.13));
}

.sp-tags-search button {
    width: 38px;
    height: 36px;
    flex: 0 0 38px;
    border: 1px solid var(--sp-border, #e5e7eb);
    border-radius: 0 12px 12px 0;
    background: #fff;
    color: var(--sp-muted, #6b7280);
    font-size: 13px;
}

.sp-tags-search button:hover {
    background: var(--sp-hover-bg, #f3f4f6);
    color: var(--sp-text, #111827);
}

.sp-tags-select {
    height: 36px;
    min-width: 86px;
    padding: 0 28px 0 11px;
    border: 1px solid var(--sp-border, #e5e7eb);
    border-radius: 12px;
    background-color: #fff;
    color: var(--sp-text-subtle, #374151);
    font-size: 13px;
    font-weight: 700;
}

.sp-tags-select:focus {
    border-color: var(--sp-brand, #f97316);
    outline: none;
    box-shadow: var(--sp-search-focus-ring, 0 0 0 3px rgba(249, 115, 22, 0.13));
}

.sp-tags-primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: var(--sp-radius-pill, 999px);
    background: var(--sp-brand, #f97316);
    color: #fff;
    font-size: 13px;
    font-weight: 850;
    white-space: nowrap;
}

.sp-tags-primary-btn:hover {
    background: var(--sp-brand-dark, #ea580c);
    color: #fff;
}

.sp-tags-result-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--sp-divider-soft, #f1f3f5);
    color: var(--sp-muted, #6b7280);
    font-size: 13px;
}

.sp-tags-result-note a {
    color: var(--sp-brand-dark, #ea580c);
    font-weight: 800;
}

.sp-tags-list {
    border-bottom: 1px solid var(--sp-border, #e5e7eb);
}

.sp-tag-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 0;
    border-bottom: 1px solid var(--sp-divider-soft, #f1f3f5);
    color: inherit;
}

.sp-tag-row:last-child {
    border-bottom: 0;
}

.sp-tag-row:hover .sp-tag-row-name {
    color: var(--sp-brand-dark, #ea580c);
}

.sp-tag-row-main {
    flex: 1 1 auto;
    min-width: 0;
}

.sp-tag-row-name {
    display: block;
    color: var(--sp-text, #111827);
    font-size: 15px;
    font-weight: 850;
    line-height: 1.45;
    letter-spacing: -0.025em;
    word-break: keep-all;
}

.sp-tag-row-desc {
    display: -webkit-box;
    margin: 4px 0 0;
    overflow: hidden;
    color: var(--sp-muted, #6b7280);
    font-size: 13px;
    line-height: 1.55;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.sp-tag-row-meta {
    flex: 0 0 auto;
    min-width: 58px;
    color: var(--sp-muted, #6b7280);
    font-size: 12px;
    line-height: 1.35;
    text-align: right;
    white-space: nowrap;
}

.sp-tag-row-meta strong {
    display: block;
    color: var(--sp-text, #111827);
    font-size: 15px;
    font-weight: 850;
}

.sp-tags-question-list {
    border-bottom: 1px solid var(--sp-border, #e5e7eb);
}

.sp-tags-question-list > article,
.sp-tags-question-list > div {
    border-bottom-color: var(--sp-divider-soft, #f1f3f5) !important;
}

.sp-tags-empty {
    padding: 46px 10px;
    border-bottom: 1px solid var(--sp-border, #e5e7eb);
    color: var(--sp-muted, #6b7280);
    text-align: center;
}

.sp-tags-empty strong {
    display: block;
    margin-bottom: 8px;
    color: var(--sp-text, #111827);
    font-size: 15px;
    font-weight: 850;
}

.sp-tags-empty p {
    margin: 0 0 12px;
    color: var(--sp-muted, #6b7280);
    font-size: 14px;
    line-height: 1.7;
}

.sp-tags-empty a {
    color: var(--sp-brand-dark, #ea580c);
    font-size: 13px;
    font-weight: 850;
}

.sp-tags-user-bar {
    width: min(220px, 100%);
    height: 5px;
    margin-top: 9px;
    overflow: hidden;
    border-radius: var(--sp-radius-pill, 999px);
    background: #f1f5f9;
}

.sp-tags-user-bar span {
    display: block;
    height: 100%;
    max-width: 100%;
    border-radius: inherit;
    background: var(--sp-brand, #f97316);
}

.sp-tags-user-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--sp-muted, #6b7280);
    font-size: 12px;
    white-space: nowrap;
}

.sp-tags-user-stats b {
    color: var(--sp-text, #111827);
    font-size: 13px;
    font-weight: 850;
}

.sp-tags-side-card {
    margin-bottom: 18px;
    padding: 16px;
    border-radius: 18px;
    background: #f8f9fa;
}

.sp-tags-side-card h2 {
    margin: 0 0 12px;
    color: var(--sp-text, #111827);
    font-size: 15px;
    font-weight: 850;
    line-height: 1.35;
    letter-spacing: -0.025em;
}

.sp-tags-side-card p {
    margin: 0;
    color: var(--sp-muted, #6b7280);
    font-size: 13px;
    line-height: 1.65;
    word-break: keep-all;
}

.sp-tags-side-list {
    display: grid;
    gap: 2px;
}

.sp-tags-side-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 34px;
    padding: 6px 0;
    color: var(--sp-text, #111827);
    font-size: 13px;
    font-weight: 750;
}

.sp-tags-side-link:hover,
.sp-tags-side-link.is-active {
    color: var(--sp-brand-dark, #ea580c);
}

.sp-tags-side-link span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-tags-side-link em {
    flex: 0 0 auto;
    color: var(--sp-muted, #6b7280);
    font-size: 12px;
    font-style: normal;
    font-weight: 650;
}

.sp-tags-side-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 40px;
    margin-top: 12px;
    border-radius: 12px;
    background: #212529;
    color: #fff;
    font-size: 13px;
    font-weight: 850;
}

.sp-tags-side-cta:hover {
    background: #111827;
    color: #fff;
}

@media (max-width: 991.98px) {
    .sp-tags-main {
        padding-right: 16px;
        padding-left: 16px;
    }

    .sp-tags-search {
        width: 220px;
    }
}

@media (max-width: 767.98px) {
    .sp-tags-main {
        padding-right: 14px;
        padding-left: 14px;
    }

    .sp-tags-hero {
        padding-top: 14px;
    }

    .sp-tags-hero-top,
    .sp-tags-section-bar,
    .sp-tag-row {
        align-items: stretch;
        flex-direction: column;
    }

    .sp-tags-title {
        font-size: 22px;
    }

    .sp-tags-count-card {
        width: 100%;
        text-align: left;
    }

    .sp-tags-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .sp-tags-search,
    .sp-tags-select-form,
    .sp-tags-select,
    .sp-tags-primary-btn {
        width: 100%;
    }

    .sp-tag-row-meta {
        text-align: left;
    }

    .sp-tags-user-stats {
        justify-content: space-between;
        white-space: normal;
    }
}

/* Add this to the bottom of static/css/tags.css */

.sp-tags-type-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--sp-border, #e5e7eb);
    overflow-x: auto;
    scrollbar-width: none;
}

.sp-tags-type-tabs::-webkit-scrollbar {
    display: none;
}

.sp-tags-type-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: var(--sp-radius-pill, 999px);
    background: #f8fafc;
    color: var(--sp-text-subtle, #374151);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    text-decoration: none;
}

.sp-tags-type-tab em {
    color: var(--sp-muted, #6b7280);
    font-size: 12px;
    font-style: normal;
    font-weight: 750;
}

.sp-tags-type-tab:hover,
.sp-tags-type-tab.is-active {
    background: var(--sp-brand-soft, #fff3e8);
    color: var(--sp-brand-strong, #c2410c);
}

.sp-tags-content-list {
    border-bottom: 1px solid var(--sp-border, #e5e7eb);
}

.sp-tags-content-card {
    border-bottom: 1px solid var(--sp-divider-soft, #f1f3f5);
    background: #fff;
}

.sp-tags-content-card:last-child {
    border-bottom: 0;
}

.sp-tags-content-link {
    display: flex;
    gap: 14px;
    padding: 15px 0;
    color: inherit;
    text-decoration: none;
}

.sp-tags-content-link:hover .sp-tags-content-title {
    color: var(--sp-brand-dark, #ea580c);
}

.sp-tags-content-thumb {
    width: 104px;
    height: 78px;
    flex: 0 0 104px;
    overflow: hidden;
    border-radius: 14px;
    background: #f3f4f6;
}

.sp-tags-content-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-tags-content-body {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
}

.sp-tags-content-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.sp-tags-content-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: var(--sp-radius-pill, 999px);
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 850;
    line-height: 1;
}

.sp-tags-content-badge.is-feed {
    background: #fff3e8;
    color: #c2410c;
}

.sp-tags-content-badge.is-post {
    background: #eef2ff;
    color: #4338ca;
}

.sp-tags-content-badge.is-question {
    background: #ecfdf5;
    color: #047857;
}

.sp-tags-content-meta {
    min-width: 0;
    overflow: hidden;
    color: var(--sp-muted, #6b7280);
    font-size: 12px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-tags-content-title {
    display: -webkit-box;
    overflow: hidden;
    color: var(--sp-text, #111827);
    font-size: 15px;
    font-weight: 850;
    line-height: 1.45;
    letter-spacing: -0.025em;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.sp-tags-content-summary {
    display: -webkit-box;
    margin-top: 5px;
    overflow: hidden;
    color: var(--sp-muted, #6b7280);
    font-size: 13px;
    line-height: 1.55;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.sp-tags-content-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 7px;
    color: var(--sp-muted, #6b7280);
    font-size: 12px;
    font-weight: 650;
}

.sp-tags-content-tags {
    min-width: 0;
    overflow: hidden;
    color: var(--sp-soft-muted, #9ca3af);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-tags-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 0 2px;
    color: var(--sp-muted, #6b7280);
    font-size: 13px;
    font-weight: 750;
}

.sp-tags-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--sp-border, #e5e7eb);
    border-radius: var(--sp-radius-pill, 999px);
    color: var(--sp-text-subtle, #374151);
    text-decoration: none;
}

.sp-tags-pagination a:hover {
    background: var(--sp-hover-bg, #f3f4f6);
    color: var(--sp-text, #111827);
}

@media (max-width: 767.98px) {
    .sp-tags-content-link {
        gap: 12px;
    }

    .sp-tags-content-thumb {
        width: 88px;
        height: 66px;
        flex-basis: 88px;
        border-radius: 12px;
    }

    .sp-tags-content-bottom {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
}
