/**
 * 小工具样式
 *
 * @package Flavor_Starter
 * @since 1.0.0
 */

/* ==========================================================================
   基础小工具样式
   ========================================================================== */

.widget {
    background: var(--color-bg);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.widget + .widget {
    margin-top: var(--spacing-lg);
}

.widget-title {
    margin: 0 0 var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-primary);
}

/* ==========================================================================
   作者信息小工具
   ========================================================================== */

.widget-author .author-widget-content {
    text-align: center;
}

.widget-author .author-avatar {
    margin-bottom: var(--spacing-md);
}

.widget-author .author-avatar img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--color-primary);
}

.widget-author .author-name {
    margin: 0 0 var(--spacing-sm);
    font-size: var(--font-size-lg);
}

.widget-author .author-name a {
    color: var(--color-text);
}

.widget-author .author-name a:hover {
    color: var(--color-primary);
}

.widget-author .author-bio {
    margin: 0 0 var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    line-height: 1.6;
}

.widget-author .author-social {
    margin-top: var(--spacing-md);
}

.widget-author .social-links {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget-author .social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--color-bg-alt);
    border-radius: 50%;
    color: var(--color-text-light);
    transition: all var(--transition-fast);
}

.widget-author .social-links a:hover {
    background: var(--color-primary);
    color: #fff;
}

/* ==========================================================================
   热门文章小工具
   ========================================================================== */

.widget-popular-posts .popular-posts-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget-popular-posts .popular-post-item {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--color-border-light);
}

.widget-popular-posts .popular-post-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.widget-popular-posts .popular-post-item:first-child {
    padding-top: 0;
}

.widget-popular-posts .post-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.widget-popular-posts .post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-fast);
}

.widget-popular-posts .post-thumb:hover img {
    transform: scale(1.1);
}

.widget-popular-posts .post-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.widget-popular-posts .post-title {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.widget-popular-posts .post-title:hover {
    color: var(--color-primary);
}

.widget-popular-posts .post-date {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--spacing-xs);
}

/* ==========================================================================
   社交关注小工具
   ========================================================================== */

.widget-social .social-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
}

.widget-social .social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    color: var(--color-text);
    transition: all var(--transition-fast);
}

.widget-social .social-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.widget-social .social-icon {
    font-size: 1.2em;
}

/* 社交平台特定颜色 */
.widget-social .social-weixin:hover {
    background: #07c160;
    color: #fff;
}

.widget-social .social-weibo:hover {
    background: #e6162d;
    color: #fff;
}

.widget-social .social-twitter:hover {
    background: #1da1f2;
    color: #fff;
}

.widget-social .social-facebook:hover {
    background: #1877f2;
    color: #fff;
}

.widget-social .social-instagram:hover {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: #fff;
}

.widget-social .social-github:hover {
    background: #333;
    color: #fff;
}

.widget-social .social-youtube:hover {
    background: #ff0000;
    color: #fff;
}

.widget-social .social-rss:hover {
    background: #f26522;
    color: #fff;
}

/* ==========================================================================
   搜索小工具
   ========================================================================== */

.widget_search .search-form {
    display: flex;
    gap: var(--spacing-sm);
}

.widget_search .search-field {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.widget_search .search-field:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.widget_search .search-submit {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: #fff;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.widget_search .search-submit:hover {
    background: var(--color-primary-dark);
}

/* ==========================================================================
   分类和标签小工具
   ========================================================================== */

.widget_categories ul,
.widget_archive ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget_categories li,
.widget_archive li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--color-border-light);
}

.widget_categories li:last-child,
.widget_archive li:last-child {
    border-bottom: none;
}

.widget_categories a,
.widget_archive a {
    color: var(--color-text);
    font-size: var(--font-size-sm);
}

.widget_categories a:hover,
.widget_archive a:hover {
    color: var(--color-primary);
}

/* 文章计数 */
.widget_categories li::after,
.widget_archive li::after {
    content: attr(data-count);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    background: var(--color-bg-alt);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
}

/* 标签云 */
.widget_tag_cloud .tagcloud {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.widget_tag_cloud .tagcloud a {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs) !important;
    color: var(--color-text-light);
    background: var(--color-bg-alt);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.widget_tag_cloud .tagcloud a:hover {
    color: #fff;
    background: var(--color-primary);
}

/* ==========================================================================
   最近文章小工具
   ========================================================================== */

.widget_recent_entries ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget_recent_entries li {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--color-border-light);
}

.widget_recent_entries li:last-child {
    border-bottom: none;
}

.widget_recent_entries a {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    line-height: 1.5;
}

.widget_recent_entries a:hover {
    color: var(--color-primary);
}

.widget_recent_entries .post-date {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--spacing-xs);
}

/* ==========================================================================
   最近评论小工具
   ========================================================================== */

.widget_recent_comments ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget_recent_comments li {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--color-border-light);
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
}

.widget_recent_comments li:last-child {
    border-bottom: none;
}

.widget_recent_comments a {
    color: var(--color-text);
    font-weight: 500;
}

.widget_recent_comments a:hover {
    color: var(--color-primary);
}

/* ==========================================================================
   日历小工具
   ========================================================================== */

.widget_calendar table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.widget_calendar caption {
    padding: var(--spacing-sm);
    font-weight: 600;
    text-align: center;
}

.widget_calendar th,
.widget_calendar td {
    padding: var(--spacing-xs);
    text-align: center;
}

.widget_calendar th {
    font-weight: 500;
    color: var(--color-text-light);
}

.widget_calendar td {
    color: var(--color-text);
}

.widget_calendar td a {
    display: block;
    padding: var(--spacing-xs);
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-sm);
}

.widget_calendar #today {
    background: var(--color-bg-alt);
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   页脚小工具区域
   ========================================================================== */

.footer-widgets .widget {
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.footer-widgets .widget-title {
    color: #fff;
    border-bottom-color: var(--color-primary);
}

.footer-widgets .widget a {
    color: rgba(255, 255, 255, 0.8);
}

.footer-widgets .widget a:hover {
    color: #fff;
}

.footer-widgets .widget_categories li,
.footer-widgets .widget_archive li,
.footer-widgets .widget_recent_entries li,
.footer-widgets .widget_recent_comments li {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.footer-widgets .widget_tag_cloud .tagcloud a {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.footer-widgets .widget_tag_cloud .tagcloud a:hover {
    background: var(--color-primary);
    color: #fff;
}

/* ==========================================================================
   响应式调整
   ========================================================================== */

@media (max-width: 767.98px) {
    .sidebar {
        margin-top: var(--spacing-2xl);
    }
    
    .widget-social .social-buttons {
        grid-template-columns: 1fr;
    }
}
