/* ============================================
   CATEGORY PAGE — category.css
   ============================================ */

/* ── Category Hero Banner ── */
.cat-hero {
    background: linear-gradient(135deg, var(--primary) 0%, #0f4f8a 60%, var(--secondary) 100%);
    padding: 40px 0 36px;
    position: relative;
    overflow: hidden;
}

.cat-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='29' stroke='rgba(255,255,255,0.05)' stroke-width='1'/%3E%3C/svg%3E") repeat;
    background-size: 60px 60px;
}

.cat-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    position: relative;
    z-index: 1;
}

.cat-breadcrumb a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: color 0.2s;
}

.cat-breadcrumb a:hover {
    color: #fff;
}

.cat-breadcrumb span {
    color: rgba(255, 255, 255, 0.55);
}

.cat-breadcrumb .sep {
    color: rgba(255, 255, 255, 0.35);
    font-size: 10px;
}

.cat-hero-content {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    position: relative;
    z-index: 1;
    margin-top: 15px;
}

.cat-hero-icon {
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #fff;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.cat-hero-title {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 8px;
    line-height: 1.2;
}

.cat-hero-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.65;
    margin: 0 0 20px;
    max-width: 680px;
}

.cat-hero-stats {
    display: flex;
    gap: 28px;
}

.cat-stat {
    text-align: center;
}

.cat-stat-num {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.cat-stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 3px;
    display: block;
}

/* ── Sub-category bar ── */
.subcat-bar {
    background: #fff;
    border-bottom: 1px solid var(--border-light);
    padding: 0;
    position: sticky;
    top: 68px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.subcat-scroll {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: none;
}

.subcat-scroll::-webkit-scrollbar {
    display: none;
}

.subcat-chip {
    white-space: nowrap;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid transparent;
    transition: var(--transition);
    flex-shrink: 0;
}

.subcat-chip:hover {
    background: var(--bg-light);
    color: var(--secondary);
    border-color: var(--border-color);
}

.subcat-chip.active {
    background: var(--secondary);
    color: #fff;
    border-color: var(--secondary);
}

/* ── Main content area ── */
.cat-main {
    padding-top: 20px;
    padding-bottom: 20px;
}

/* ── List toolbar ── */
.list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.list-count {
    font-size: 14px;
    color: var(--text-muted);
}

.list-count strong {
    color: var(--text-dark);
    font-weight: 700;
}

.list-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.list-search {
    position: relative;
}

.list-search i {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

.list-search input {
    padding: 8px 12px 8px 32px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    outline: none;
    width: 220px;
    font-family: var(--font-base);
    background: var(--bg-light);
    transition: var(--transition);
}

.list-search input:focus {
    border-color: var(--secondary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: var(--font-base);
    color: var(--text-dark);
    background: var(--bg-light);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.sort-select:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* ── WooCommerce Ordering & Count ── */
.woocommerce-ordering {
    display: inline-flex;
    align-items: center;
}

.woocommerce-ordering select.orderby {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: var(--font-base);
    color: var(--text-dark);
    background: var(--bg-light);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
}

.woocommerce-ordering select.orderby:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.woocommerce-result-count {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
    padding: 0;
}

/* ── Doc-type filter ── */
.doctype-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.doctype-chip {
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-base);
}

.doctype-chip i {
    margin-right: 5px;
}

.doctype-chip:hover {
    border-color: var(--secondary);
    color: var(--secondary);
    background: rgba(14, 165, 233, 0.05);
}

.doctype-chip.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Thesis item card ── */
.cat-thesis-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cat-thesis-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    transition: var(--transition);
    position: relative;
}

.cat-thesis-item:hover {
    border-color: var(--secondary);
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.1);
    transform: translateY(-1px);
}

.cat-thesis-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ef4444;
    flex-shrink: 0;
}

.cat-thesis-content {
    flex: 1;
    min-width: 0;
}

.cat-thesis-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.ct-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.ct-type {
    background: #eff6ff;
    color: #1d4ed8;
}

.ct-free {
    background: #f0fdf4;
    color: #16a34a;
}

.ct-premium {
    background: #fffbeb;
    color: #d97706;
}

.ct-format {
    background: var(--bg-light);
    color: var(--text-muted);
}

.cat-thesis-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 10px;
}

.cat-thesis-title a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.2s;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cat-thesis-title a:hover {
    color: var(--secondary);
}

.cat-thesis-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.cat-thesis-meta span,
.cat-thesis-meta a {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cat-thesis-meta a:hover {
    color: var(--secondary);
}

.cat-thesis-meta i {
    font-size: 11px;
}

/* ── Action buttons ── */
.cat-thesis-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.btn-view-detail {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    white-space: nowrap;
}

.btn-view-detail:hover {
    background: var(--secondary);
    color: #fff;
    border-color: var(--secondary);
}

.btn-dl-free,
.btn-dl-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: var(--font-base);
}

.btn-dl-free {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
}

.btn-dl-free:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-dl-premium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.btn-dl-premium:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* ── Sidebar filter list ── */
.sidebar-filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-filter-list li {
    border-bottom: 1px solid var(--border-light);
}

.sidebar-filter-list li:last-child {
    border-bottom: none;
}

.sidebar-filter-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 4px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}

.sidebar-filter-list li a:hover {
    color: var(--secondary);
}

.sidebar-filter-list li.active a {
    color: var(--secondary);
    font-weight: 600;
}

/* ── Cat about box ── */
.cat-about-text p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 10px;
}

.cat-about-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cat-about-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-dark);
    padding: 5px 0;
}

.cat-about-list li i {
    color: var(--secondary);
    font-size: 10px;
}

/* ── Category icon small ── */
.cat-icon-sm {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-category-list a {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.sidebar-category-list a .cat-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.sidebar-category-list a .cat-left span:last-child {
    font-size: 13.5px;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-category-list .cat-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 2px 9px;
    flex-shrink: 0;
}

.sidebar-category-list li {
    border-bottom: 1px solid var(--border-light);
}

.sidebar-category-list li:last-child {
    border-bottom: none;
}

.sidebar-category-list li a {
    padding: 10px 4px;
    text-decoration: none;
    transition: var(--transition);
}

.sidebar-category-list li a:hover .cat-left span:last-child {
    color: var(--secondary);
}

/* ── Active mega cat ── */
.mega-item.active-cat {
    background: rgba(14, 165, 233, 0.06);
    border-color: rgba(14, 165, 233, 0.2);
}

.mega-item.active-cat .mega-item-name {
    color: var(--secondary);
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
    .cat-hero-content {
        flex-direction: column;
        gap: 16px;
    }

    .cat-hero-stats {
        gap: 20px;
    }

    .cat-thesis-item {
        flex-wrap: wrap;
    }

    .cat-thesis-actions {
        flex-direction: row;
        width: 100%;
    }

    .btn-view-detail,
    .btn-dl-free,
    .btn-dl-premium {
        flex: 1;
        justify-content: center;
    }

    .list-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .list-controls {
        width: 100%;
    }

    .list-search input {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .cat-breadcrumb {
        white-space: nowrap;
        overflow-x: auto;
        padding-bottom: 5px;
        scrollbar-width: none;
        -ms-overflow-style: none;
        display: block;
    }

    .cat-breadcrumb::-webkit-scrollbar {
        display: none;
    }

    .cat-breadcrumb a,
    .cat-breadcrumb span,
    .cat-breadcrumb .sep {
        display: inline-block;
        vertical-align: middle;
    }

    .cat-hero-title {
        font-size: 22px;
    }

    .cat-hero-stats {
        gap: 14px;
    }

    .doctype-bar {
        gap: 4px;
    }

    .doctype-chip {
        font-size: 12px;
        padding: 5px 10px;
    }

    .cat-thesis-item {
        padding: 5px;
        align-items: flex-start;
    }

    .cat-thesis-icon {
        height: auto;
        align-self: stretch;
        width: 44px;
        border-radius: 8px;
    }

    .cat-thesis-actions {
        display: none !important;
    }

    .cat-thesis-title {
        font-size: 14px;
        margin-bottom: 5px;
    }

    .cat-thesis-meta {
        display: flex;
        align-items: center;
        width: 100%;
    }

    .btn-save-card {
        width: 32px;
        height: 32px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
        background: rgba(239, 68, 68, 0.05);
        border: 1px solid rgba(239, 68, 68, 0.1);
        border-radius: 8px;
        color: #ef4444;
    }

    .btn-save-card.is-saved {
        background: #ef4444;
        color: #fff;
    }

    .subcat-bar {
        display: none;
    }
}