/* ========================================
   侧边栏小部件样式 - Sidebar Widgets
   ======================================== */

/* 侧边栏容器 */
.sidebar {
    position: sticky;
    top: 80px;
}

/* 通用侧边栏卡片 */
.sidebar-widget {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    animation: slideInLeft 0.5s ease backwards;
}

.sidebar-widget:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
}

[data-user-color-scheme="dark"] .sidebar-widget {
    background: rgba(37, 45, 56, 0.8);
    border-color: rgba(255, 255, 255, 0.05);
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 侧边栏标题 */
.sidebar-widget-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, #667eea, #764ba2) 1;
    position: relative;
}

.sidebar-widget-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

/* 目录小部件 (TOC) */
.toc {
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.toc::-webkit-scrollbar {
    width: 4px;
}

.toc::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 2px;
}

.toc-list {
    list-style: none;
    padding-left: 0;
}

.toc-item {
    margin: 5px 0;
}

.toc-link {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

.toc-link:hover {
    background: rgba(102, 126, 234, 0.1);
    border-left-color: #667eea;
    color: #667eea;
    padding-left: 18px;
}

.toc-link.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.15), transparent);
    border-left-color: #667eea;
    color: #667eea;
    font-weight: 600;
}

/* 嵌套目录 */
.toc-child {
    padding-left: 15px;
    margin-top: 5px;
}

.toc-child .toc-link {
    font-size: 0.9rem;
    padding: 6px 12px;
}

/* 个人信息小部件 */
.profile-widget {
    text-align: center;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 15px;
    padding: 4px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    animation: profileFloat 3s ease-in-out infinite;
}

@keyframes profileFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid white;
    object-fit: cover;
}

.profile-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.profile-bio {
    font-size: 0.9rem;
    color: var(--sec-text-color);
    margin-bottom: 15px;
    line-height: 1.5;
}

.profile-social {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.profile-social a {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transition: all 0.3s ease;
}

.profile-social a:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transform: translateY(-4px) rotate(15deg);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* 统计小部件 */
.stats-widget {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--sec-text-color);
    margin-top: 5px;
}

/* 最新文章小部件 */
.recent-posts-widget {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-post-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.recent-post-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(5px);
}

.recent-post-thumb {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    margin-right: 12px;
}

.recent-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.recent-post-item:hover .recent-post-thumb img {
    transform: scale(1.1);
}

.recent-post-info {
    flex: 1;
    min-width: 0;
}

.recent-post-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.recent-post-date {
    font-size: 0.8rem;
    color: var(--sec-text-color);
}

/* 标签云小部件 */
.tag-cloud-widget {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-cloud-widget a {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 1px solid rgba(102, 126, 234, 0.2);
    color: var(--text-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tag-cloud-widget a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.tag-cloud-widget a:hover::before {
    left: 100%;
}

.tag-cloud-widget a:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

/* 分类小部件 */
.category-widget {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    position: relative;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-radius: 10px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.category-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding-left: 20px;
}

.category-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 2px;
    transition: height 0.3s ease;
}

.category-link:hover::before {
    height: 20px;
}

.category-name {
    font-size: 0.95rem;
}

.category-count {
    font-size: 0.8rem;
    color: var(--sec-text-color);
    background: rgba(102, 126, 234, 0.1);
    padding: 3px 10px;
    border-radius: 12px;
}

.category-link:hover .category-count {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

/* 日历小部件 */
.calendar-widget {
    text-align: center;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-title {
    font-weight: 600;
    color: var(--text-color);
}

.calendar-nav button {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-nav button:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day-name {
    font-size: 0.8rem;
    color: var(--sec-text-color);
    padding: 8px 0;
}

.calendar-day {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    border-radius: 50%;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-day:hover {
    background: rgba(102, 126, 234, 0.1);
}

.calendar-day.today {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.calendar-day.has-post {
    position: relative;
}

.calendar-day.has-post::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #667eea;
}

/* 广告/推广位小部件 */
.ad-widget {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.ad-widget img {
    width: 100%;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.ad-widget:hover img {
    transform: scale(1.05);
}

/* 音乐播放器小部件 */
.music-widget {
    text-align: center;
}

.music-cover {
    width: 120px;
    height: 120px;
    margin: 0 auto 15px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);
}

.music-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.music-cover.playing {
    animation: rotateDisc 4s linear infinite;
}

@keyframes rotateDisc {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.music-info {
    margin-bottom: 15px;
}

.music-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.music-artist {
    font-size: 0.85rem;
    color: var(--sec-text-color);
}

.music-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.music-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.music-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.music-btn.play-btn {
    width: 50px;
    height: 50px;
}

.music-progress {
    margin-top: 15px;
}

.music-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.music-progress-current {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.music-time {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--sec-text-color);
    margin-top: 5px;
}

/* 天气小部件 */
.weather-widget {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.weather-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.weather-temp {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
}

.weather-desc {
    font-size: 0.9rem;
    color: var(--sec-text-color);
    text-transform: capitalize;
}

.weather-detail {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    font-size: 0.85rem;
    color: var(--sec-text-color);
}

/* 响应式适配 */
@media (max-width: 992px) {
    .sidebar {
        position: static;
    }

    .profile-widget {
        text-align: left;
    }

    .profile-avatar {
        margin: 0 auto 15px;
    }

    .stats-widget {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-widget {
        grid-template-columns: repeat(2, 1fr);
    }
}
