/* ==================== SIDEBAR ==================== */
.sidebar {}

/* Banner Widget */
.widget-banner {
    margin-bottom: 28px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: box-shadow var(--transition);
}
.widget-banner:hover { box-shadow: var(--shadow-md); }
.widget-banner a { display: block; }
.widget-banner img {
    display: block;
    width: 100%;
    height: auto;
}

.widget {
    margin-bottom: 28px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px;
    transition: box-shadow var(--transition);
}
.widget:hover { box-shadow: var(--shadow-md); }

.widget-title {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dark);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary);
}

.widget-post {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.widget-post:last-child { border-bottom: none; }

.widget-post-thumb {
    flex-shrink: 0;
    width: 72px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-light);
}
.widget-post-thumb img { width: 100%; height: 100%; object-fit: cover; }

.widget-post-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.widget-post-title a { color: inherit; }
.widget-post-title a:hover { color: var(--primary); }

.widget-categories ul { list-style: none; }
.widget-categories li {
    border-bottom: 1px solid var(--border);
}
.widget-categories li:last-child { border-bottom: none; }
.widget-categories a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 0;
    color: var(--text-body);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition);
}
.widget-categories a:hover { color: var(--primary); padding-left: 6px; }
.widget-categories .count {
    background: var(--bg-light);
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* Widget Category Tree */
.cat-tree {
    list-style: none;
    margin: 0;
    padding: 0;
}
.cat-tree-item {
    border-bottom: 1px solid var(--border);
}
.cat-tree-item:last-child { border-bottom: none; }

/* Head row */
.cat-tree-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

/* Folder / file icon */
.cat-tree-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--bg-light);
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all 0.2s;
}
.cat-tree-item.active > .cat-tree-head .cat-tree-icon {
    background: var(--primary-glow);
    color: var(--primary);
}

/* Link */
.cat-tree-link {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-body);
    font-size: 0.86rem;
    font-weight: 500;
    transition: color 0.2s;
    min-width: 0;
}
.cat-tree-link:hover { color: var(--primary); }
.cat-tree-item.active > .cat-tree-head .cat-tree-link {
    color: var(--primary);
    font-weight: 600;
}

/* Category name */
.cat-tree-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Count badge */
.cat-tree-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--bg-light);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
    line-height: 1;
}
.cat-tree-item.active > .cat-tree-head .cat-tree-count {
    background: var(--primary-glow);
    color: var(--primary);
}

/* Toggle chevron */
.cat-tree-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
    border-radius: 6px;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
}
.cat-tree-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-glow);
}
.cat-tree-toggle svg { transition: transform 0.25s ease; }
.cat-tree-item.open > .cat-tree-head .cat-tree-toggle svg { transform: rotate(180deg); }
.cat-tree-item.open > .cat-tree-head .cat-tree-toggle {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-glow);
}

/* Children sub-list */
.cat-tree-children {
    display: none;
    margin-left: 15px;
    padding-left: 14px;
    padding-bottom: 8px;
    border-left: 2px solid var(--border);
}
.cat-tree-item.open > .cat-tree-children { display: block; }

.cat-tree-child a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 400;
    transition: color 0.2s;
}
.cat-tree-child a:hover { color: var(--primary); }
.cat-tree-child.active a {
    color: var(--primary);
    font-weight: 600;
}
.cat-tree-child .cat-tree-count {
    height: 18px;
    min-width: 20px;
    font-size: 0.65rem;
}
