/* Blog Sidebar ToC Block - Frontend Styles */

.kss-blog-sidebar:not(#fakeID) {
    display: block;
    width: 100%;
    max-width: 350px;
    box-sizing: border-box;
    
    /* Dynamic styles via CSS Custom Properties */
    background-color: var(--sidebar-bg-color, #ffffff);
    border: 1px solid var(--sidebar-border-color, #e5e5e5);
    border-radius: var(--sidebar-border-radius, 8px);
    padding: var(--sidebar-padding-top, 24px) var(--sidebar-padding-right, 24px) var(--sidebar-padding-bottom, 24px) var(--sidebar-padding-left, 24px)!important;
    font-size: var(--sidebar-font-size, 14px);
}

.kss-blog-sidebar__inner {
    width: 100%;
}

/* Full Width Mode */
.kss-blog-sidebar--full-width {
    max-width: unset!important;
    float: none;
    margin-left: 0;
    margin-right: 0;
}

/* Positions */
.kss-blog-sidebar--left {
    float: left;
    margin-right: 30px;
}

.kss-blog-sidebar--right {
    float: right;
    margin-left: 30px;
}

/* Sticky Behavior */
.kss-blog-sidebar--sticky {
    position: sticky;
}

/* Farbschemata */
.kss-blog-sidebar--light {
    color: var(--kss-color-black, #212529);
}

.kss-blog-sidebar--dark {
    color: var(--kss-color-white, #ffffff);
}

/* ========== Widget Base Styles ========== */
.kss-sidebar-widget {
    width: 100%;
    margin-bottom: var(--sidebar-widget-spacing, 24px);
}

.kss-sidebar-widget:last-child {
    margin-bottom: 0;
}

.kss-sidebar-widget__title {
    margin: 0;
    padding: 0;
    line-height: 1.4;
    font-size: var(--sidebar-heading-size, 16px);
    margin-bottom: 12px;
    font-weight: bold;
}

.kss-sidebar-widget__content {
    line-height: 1.6;
}

/* ========== Table of Contents ========== */
.kss-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kss-toc-item {
    margin-bottom: 8px;
    line-height: 1.5;
}

.kss-toc-item--level-2 {
    margin-left: 0;
}

.kss-toc-item--level-3 {
    margin-left: 16px;
    font-size: 0.95em;
}

.kss-toc-item--level-4 {
    margin-left: 32px;
    font-size: 0.9em;
}

.kss-toc-item--level-5 {
    margin-left: 48px;
    font-size: 0.85em;
}

.kss-toc-item--level-6 {
    margin-left: 64px;
    font-size: 0.8em;
}

.kss-toc-link {
    text-decoration: none;
    color: inherit;
    display: block;
    padding: 4px 0;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    padding-left: 12px;
}

.kss-toc-link:hover,
.kss-toc-link:focus {
    color: var(--kss-primary-color, #0073aa);
    border-left-color: var(--kss-primary-color, #0073aa);
    padding-left: 16px;
}

.kss-toc-link.active {
    color: var(--kss-primary-color, #0073aa);
    border-left-color: var(--kss-primary-color, #0073aa);
    font-weight: 600;
}

/* ========== Author Box ========== */
.kss-author-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.kss-author-box__avatar {
    margin-bottom: 12px;
}

.kss-author-box__avatar img {
    border-radius: 50%;
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.kss-author-box__name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 8px;
}

.kss-author-box__bio {
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 12px;
    color: var(--kss-copy-text-color-secondary, #666);
}

.kss-author-box__social {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.kss-author-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    text-decoration: none;
    color: inherit;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.kss-author-link:hover {
    background-color: var(--kss-primary-color, #0073aa);
    color: white;
}

.kss-author-link i {
    font-size: 0.9em;
}

/* ========== Meta Information ========== */
.kss-post-meta__item {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.5;
}

.kss-post-meta__item:last-child {
    margin-bottom: 0;
}

.kss-post-meta__item i {
    color: var(--kss-primary-color, #0073aa);
    width: 16px;
    text-align: center;
}

.kss-post-meta__item strong {
    font-weight: 600;
}

/* ========== Search Box ========== */
.kss-search-form {
    width: 100%;
}

.kss-search-box {
    display: flex;
    gap: 8px;
    width: 100%;
}

.kss-search-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--kss-border-color, #e5e5e5);
    border-radius: 4px;
    font-size: inherit;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.kss-search-input:focus {
    outline: none;
    border-color: var(--kss-primary-color, #0073aa);
}

.kss-search-button {
    padding: 10px 16px;
    background-color: var(--kss-primary-color, #0073aa);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.kss-search-button:hover {
    background-color: var(--kss-primary-color-hover, #005a87);
}

.kss-search-button i {
    font-size: 0.95em;
}

/* ========== Categories ========== */
.kss-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kss-category-item {
    margin-bottom: 8px;
}

.kss-category-item:last-child {
    margin-bottom: 0;
}

.kss-category-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    padding: 6px 0;
    transition: color 0.2s ease;
}

.kss-category-link:hover {
    color: var(--kss-primary-color, #0073aa);
}

.kss-category-link i {
    font-size: 0.9em;
    opacity: 0.7;
}

.kss-category-count {
    font-size: 0.85em;
    opacity: 0.6;
}

/* ========== Tags ========== */
.kss-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kss-tag {
    display: inline-block;
    padding: 6px 12px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    text-decoration: none;
    color: inherit;
    font-size: 0.9em;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.kss-tag:hover {
    background-color: var(--kss-primary-color, #0073aa);
    color: white;
    border-color: var(--kss-primary-color, #0073aa);
}

.kss-blog-sidebar--dark .kss-tag {
    background-color: rgba(255, 255, 255, 0.1);
}

.kss-blog-sidebar--dark .kss-tag:hover {
    background-color: var(--kss-primary-color, #0073aa);
}

/* ========== Related Posts ========== */
.kss-related-posts {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kss-related-post {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    width: fit-content;
}

.kss-related-post:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.kss-related-post__thumb {
    margin-bottom: 8px;
}

.kss-related-post__thumb a {
    display: block;
    overflow: hidden;
    border-radius: 4px;
}

.kss-related-post__image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.kss-related-post__thumb:hover .kss-related-post__image {
    transform: scale(1.05);
}

.kss-related-post__title {
    display: block;
    text-decoration: none;
    color: inherit;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 4px;
    transition: color 0.2s ease;
}

.kss-related-post__title:hover {
    color: var(--kss-primary-color, #0073aa);
}

.kss-related-post__date {
    font-size: 0.85em;
    opacity: 0.6;
}

/* ========== Dark Color Scheme Adjustments ========== */
.kss-blog-sidebar--dark .kss-author-box__bio,
.kss-blog-sidebar--dark .kss-post-meta__item {
    color: rgba(255, 255, 255, 0.8);
}

.kss-blog-sidebar--dark .kss-search-input {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.kss-blog-sidebar--dark .kss-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.kss-blog-sidebar--dark .kss-author-link {
    background-color: rgba(255, 255, 255, 0.1);
}

.kss-blog-sidebar--dark .kss-related-post {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* ========== Responsive Design ========== */
@media (max-width: 1024px) {
    .kss-blog-sidebar {
        max-width: 300px;
    }
}

@media (max-width: 768px) {
    .kss-blog-sidebar--left,
    .kss-blog-sidebar--right {
        float: none;
        margin: 20px auto;
        max-width: 100%;
    }
    
    .kss-blog-sidebar--sticky {
        position: relative !important;
        top: auto !important;
    }
}

/* ========== Scrollbar Styling (für lange ToC) ========== */
.kss-toc-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.kss-toc-list::-webkit-scrollbar {
    width: 6px;
}

.kss-toc-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.kss-toc-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.kss-toc-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Dark theme scrollbar */
.kss-blog-sidebar--dark .kss-toc-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.kss-blog-sidebar--dark .kss-toc-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.kss-blog-sidebar--dark .kss-toc-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========== Animations ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kss-sidebar-widget {
    animation: fadeIn 0.3s ease;
}
