/* 布局组件样式 - 前端页面使用 */
/* 与主模板完美融合的自适应样式系统 */

/* 基础组件容器 - 继承主模板样式 */
.layout-widget {
    /* 使用CSS变量实现动态样式同步 */
    background: var(--detected-surface, var(--bg-primary, #ffffff));
    border-radius: var(--detected-radius, var(--radius-lg, 12px));
    padding: var(--detected-widget-padding, var(--spacing-xxl, 25px));
    margin-bottom: var(--detected-item-spacing, var(--spacing-xxl, 30px));
    box-shadow: var(--detected-shadow, var(--shadow-md, 0 2px 10px rgba(0,0,0,0.05)));
    border: 1px solid var(--detected-border-light, var(--border-light, #e9ecef));
    font-family: var(--detected-font-family, var(--font-family));
    color: var(--detected-text-primary, var(--text-primary, #333));
    transition: all var(--detected-transition, var(--transition-normal, 0.3s ease));
    position: relative;
    overflow: hidden;
}

/* 组件悬停效果 - 与主模板保持一致 */
.layout-widget:hover {
    box-shadow: var(--shadow-hover, 0 8px 30px rgba(0,0,0,0.15));
    transform: translateY(-2px);
    border-color: var(--detected-primary, var(--primary-color, #007bff));
}

/* 文章列表组件 - 完全继承主模板文章样式 */
.widget-article-list {
    /* 继承layout-widget的所有样式 */
    background: var(--detected-surface, var(--bg-primary, #ffffff));
    border-radius: var(--detected-radius, var(--radius-lg, 12px));
    padding: var(--detected-widget-padding, var(--spacing-xxl, 25px));
    margin-bottom: var(--detected-item-spacing, var(--spacing-xxl, 30px));
    box-shadow: var(--detected-shadow, var(--shadow-md, 0 2px 10px rgba(0,0,0,0.05)));
    border: 1px solid var(--detected-border-light, var(--border-light, #e9ecef));
    transition: all var(--detected-transition, var(--transition-normal, 0.3s ease));
}

/* 组件标题 - 完全继承主模板标题样式 */
.widget-article-list .widget-title,
.widget-recent-articles .widget-title,
.widget-popular-articles .widget-title,
.widget-category-nav .widget-title,
.widget-hot-tags .widget-title,
.widget-search-box .widget-title,
.widget-ad .widget-title,
.widget-custom-html .widget-title {
    font-size: var(--detected-title-size, var(--font-size-xl, 20px));
    font-weight: var(--detected-title-weight, 600);
    margin-bottom: var(--spacing-lg, 20px);
    color: var(--detected-text-primary, var(--text-primary, #333));
    position: relative;
    padding-bottom: var(--spacing-sm, 10px);
    line-height: var(--detected-line-height, 1.4);
    font-family: var(--detected-font-family, var(--font-family));
}

/* 组件标题装饰线 - 使用检测到的主色调 */
.widget-article-list .widget-title::after,
.widget-recent-articles .widget-title::after,
.widget-popular-articles .widget-title::after,
.widget-category-nav .widget-title::after,
.widget-hot-tags .widget-title::after,
.widget-search-box .widget-title::after,
.widget-ad .widget-title::after,
.widget-custom-html .widget-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(45deg, 
        var(--detected-primary, var(--primary-color, #007bff)), 
        var(--detected-primary-hover, var(--primary-hover, #0056b3))
    );
    border-radius: var(--radius-sm, 2px);
    transition: width var(--detected-transition, var(--transition-normal, 0.3s ease));
}

/* 标题悬停效果 */
.widget:hover .widget-title::after {
    width: 60px;
}

.widget-article-list .article-item {
    border-bottom: 1px solid #eee;
    padding: 20px 0;
    transition: transform 0.3s ease;
}

.widget-article-list .article-item:last-child {
    border-bottom: none;
}

.widget-article-list .article-item:hover {
    transform: translateY(-1px);
}

.widget-article-list .article-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 600;
}

.widget-article-list .article-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.widget-article-list .article-title a:hover {
    color: #007bff;
}

.widget-article-list .article-meta {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.widget-article-list .meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.widget-article-list .meta-item i {
    color: #999;
    font-size: 12px;
}

.widget-article-list .meta-item a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}

.widget-article-list .meta-item a:hover {
    color: #007bff;
}

.widget-article-list .article-excerpt {
    margin: 10px 0;
    color: #666;
    line-height: 1.6;
    font-size: 14px;
}

.widget-article-list .article-tags {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.widget-article-list .tag-link {
    display: inline-block;
    padding: 4px 8px;
    background: #f8f9fa;
    color: #666;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.3s;
}

.widget-article-list .tag-link:hover {
    background: #007bff;
    color: white;
}

/* 分类导航组件 - 继承基础样式 */
.widget-category-nav {
    /* 继承layout-widget的所有基础样式 */
    background: var(--detected-surface, var(--bg-primary, #ffffff));
    border-radius: var(--detected-radius, var(--radius-lg, 12px));
    padding: var(--detected-widget-padding, var(--spacing-xxl, 20px));
    margin-bottom: var(--detected-item-spacing, var(--spacing-xxl, 30px));
    box-shadow: var(--detected-shadow, var(--shadow-md, 0 2px 10px rgba(0,0,0,0.05)));
    border: 1px solid var(--detected-border-light, var(--border-light, #e9ecef));
    transition: all var(--detected-transition, var(--transition-normal, 0.3s ease));
}

/* 分类导航列表 - 继承主模板列表样式 */
.widget-category-nav .category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget-category-nav .category-item {
    margin-bottom: var(--spacing-sm, 8px);
}

.widget-category-nav .category-link {
    display: block;
    padding: var(--spacing-sm, 8px) var(--spacing-md, 12px);
    color: var(--detected-text-secondary, var(--text-secondary, #666));
    text-decoration: none;
    border-radius: var(--detected-radius, var(--radius-sm, 6px));
    transition: all var(--detected-transition, var(--transition-normal, 0.3s ease));
    position: relative;
    overflow: hidden;
    font-family: var(--detected-font-family, var(--font-family));
}

/* 分类链接悬停效果 - 与主模板链接保持一致 */
.widget-category-nav .category-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(45deg, 
        var(--detected-primary, var(--primary-color, #007bff)), 
        var(--detected-primary-hover, var(--primary-hover, #0056b3))
    );
    transition: width var(--detected-transition, var(--transition-normal, 0.3s ease));
}

.widget-category-nav .category-link:hover {
    background: var(--bg-secondary, #f8f9fa);
    color: var(--detected-primary, var(--primary-color, #007bff));
    transform: translateX(var(--spacing-xs, 5px));
}

.widget-category-nav .category-link:hover::before {
    width: 3px;
}

/* 热门标签组件 */
.widget-hot-tags {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.widget-hot-tags .widget-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    position: relative;
    padding-bottom: 8px;
}

.widget-hot-tags .widget-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background: #007bff;
    border-radius: 1px;
}

.widget-hot-tags .tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.widget-hot-tags .tag {
    display: inline-block;
    padding: 6px 12px;
    background: #f8f9fa;
    color: #666;
    text-decoration: none;
    border-radius: 20px;
    font-size: 13px;
    transition: all 0.3s;
}

.widget-hot-tags .tag:hover {
    background: #007bff;
    color: white;
    transform: translateY(-2px);
}

/* 搜索框组件 */
.widget-search-box {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.widget-search-box .widget-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    position: relative;
    padding-bottom: 8px;
}

.widget-search-box .widget-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background: #007bff;
    border-radius: 1px;
}

.widget-search-box .search-form {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 25px;
    padding: 5px;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease;
}

.widget-search-box .search-form:focus-within {
    border-color: #007bff;
}

.widget-search-box .search-input {
    border: none;
    background: transparent;
    padding: 8px 15px;
    font-size: 14px;
    outline: none;
    width: 100%;
}

.widget-search-box .search-btn {
    background: #007bff;
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.widget-search-box .search-btn:hover {
    background: #0056b3;
}

/* 广告位组件 */
.widget-ad {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-align: center;
}

.widget-ad .widget-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    position: relative;
    padding-bottom: 8px;
}

.widget-ad .widget-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: #007bff;
    border-radius: 1px;
}

.widget-ad .ad-content {
    display: block;
    color: #666;
    text-decoration: none;
    transition: all 0.3s;
}

.widget-ad .ad-content:hover {
    transform: translateY(-2px);
}

.widget-ad .ad-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Google Adsense 广告样式 */
.widget-ad .adsbygoogle {
    margin: 0 auto;
    text-align: center;
}

.widget-ad .ad-error {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    margin: 10px 0;
}

.widget-ad .ad-placeholder {
    color: #6c757d;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    padding: 20px;
    font-size: 14px;
    font-style: italic;
}

/* 广告加载状态 */
.widget-ad .ad-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    color: #6c757d;
    font-size: 14px;
}

.widget-ad .ad-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 热门文章组件 - 文章列表样式 */
.widget-popular-articles {
    margin-bottom: 30px;
    padding: 25px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.widget-popular-articles .widget-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
    position: relative;
    padding-bottom: 10px;
}

.widget-popular-articles .widget-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(45deg, #007bff, #0056b3);
    border-radius: 2px;
}

.widget-popular-articles .article-item {
    padding: 20px 0;
    border-bottom: 1px solid #eee;
    transition: transform 0.3s ease;
}

.widget-popular-articles .article-item:last-child {
    border-bottom: none;
}

.widget-popular-articles .article-item:hover {
    transform: translateY(-1px);
}

.widget-popular-articles .article-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 600;
}

.widget-popular-articles .article-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.widget-popular-articles .article-title a:hover {
    color: #007bff;
}

.widget-popular-articles .article-meta {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.widget-popular-articles .meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.widget-popular-articles .meta-item i {
    color: #999;
    font-size: 12px;
}

.widget-popular-articles .meta-item a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}

.widget-popular-articles .meta-item a:hover {
    color: #007bff;
}

.widget-popular-articles .article-excerpt {
    margin: 10px 0;
    color: #666;
    line-height: 1.6;
    font-size: 14px;
}

.widget-popular-articles .article-tags {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.widget-popular-articles .tag-link {
    display: inline-block;
    padding: 4px 8px;
    background: #f8f9fa;
    color: #666;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.3s;
}

.widget-popular-articles .tag-link:hover {
    background: #007bff;
    color: white;
}

/* 最新文章组件 - 文章列表样式 */
.widget-recent-articles {
    margin-bottom: 30px;
    padding: 25px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.widget-recent-articles .widget-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
    position: relative;
    padding-bottom: 10px;
}

.widget-recent-articles .widget-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(45deg, #007bff, #0056b3);
    border-radius: 2px;
}

.widget-recent-articles .article-item {
    padding: 20px 0;
    border-bottom: 1px solid #eee;
    transition: transform 0.3s ease;
}

.widget-recent-articles .article-item:last-child {
    border-bottom: none;
}

.widget-recent-articles .article-item:hover {
    transform: translateY(-1px);
}

.widget-recent-articles .article-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 600;
}

.widget-recent-articles .article-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.widget-recent-articles .article-title a:hover {
    color: #007bff;
}

.widget-recent-articles .article-meta {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.widget-recent-articles .meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.widget-recent-articles .meta-item i {
    color: #999;
    font-size: 12px;
}

.widget-recent-articles .meta-item a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}

.widget-recent-articles .meta-item a:hover {
    color: #007bff;
}

.widget-recent-articles .article-excerpt {
    margin: 10px 0;
    color: #666;
    line-height: 1.6;
    font-size: 14px;
}

.widget-recent-articles .article-tags {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.widget-recent-articles .tag-link {
    display: inline-block;
    padding: 4px 8px;
    background: #f8f9fa;
    color: #666;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.3s;
}

.widget-recent-articles .tag-link:hover {
    background: #007bff;
    color: white;
}

/* 自定义HTML组件 */
.widget-custom-html {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.widget-custom-html .widget-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    position: relative;
    padding-bottom: 8px;
}

.widget-custom-html .widget-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background: #007bff;
    border-radius: 1px;
}

.widget-custom-html .custom-content {
    color: #666;
    line-height: 1.6;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .widget-article-list,
    .widget-category-nav,
    .widget-hot-tags,
    .widget-search-box,
    .widget-ad,
    .widget-custom-html,
    .widget-popular-articles,
    .widget-recent-articles {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .widget-article-list .article-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .widget-hot-tags .tag-cloud {
        gap: 6px;
    }
    
    .widget-hot-tags .tag {
        font-size: 12px;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .widget-article-list .article-title {
        font-size: 16px;
    }
    
    .widget-article-list .article-excerpt {
        font-size: 13px;
    }
    
    .widget-article-list .tag-link {
        font-size: 11px;
        padding: 3px 6px;
    }
} 