/* 
 * 云启主题主样式文件
 * Theme Name: 云启主题
 * Author: 十九云栈
 * Version: 1.0.0
 */

/* ==================== 基础重置 ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    overflow-x: hidden;
}

/* ==================== 基础元素样式 ==================== */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

p {
    margin-bottom: 1rem;
}

a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #2980b9;
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

li {
    margin-bottom: 0.25rem;
}

/* ==================== 容器和网格系统 ==================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.content-area {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

@media (min-width: 768px) {
    .content-area {
        grid-template-columns: 2fr 1fr;
    }
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.btn:focus {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

.btn-primary {
    color: #fff;
    background-color: #3498db;
    border-color: #3498db;
}

.btn-primary:hover {
    color: #fff;
    background-color: #2980b9;
    border-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-outline {
    color: #3498db;
    background-color: transparent;
    border-color: #3498db;
}

.btn-outline:hover {
    color: #fff;
    background-color: #3498db;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* ==================== 表单样式 ==================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* ==================== 头部样式 ==================== */
.site-header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.site-branding .custom-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #3498db;
    text-decoration: none;
}

.main-navigation ul {
    display: flex;
    list-style: none;
}

.main-navigation li {
    margin: 0 1rem;
}

.main-navigation a {
    color: #333;
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

.main-navigation a:hover {
    color: #3498db;
}

.main-navigation a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #3498db;
    transition: width 0.3s ease;
}

.main-navigation a:hover::after {
    width: 100%;
}

/* ==================== 用户功能区 ==================== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-toggle, .user-toggle, .mobile-menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.25rem;
    color: #333;
    transition: color 0.3s ease;
}

.search-toggle:hover, .user-toggle:hover {
    color: #3498db;
}

.user-dropdown {
    position: relative;
}

.user-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.user-dropdown:hover .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #3498db;
}

.dropdown-divider {
    height: 1px;
    background-color: #eee;
    margin: 0.25rem 0;
}

.guest-actions {
    display: flex;
    gap: 1rem;
}

.login-link, .register-link {
    color: #3498db;
    font-weight: 500;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 2px solid #3498db;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.register-link {
    background-color: #3498db;
    color: #fff;
}

.login-link:hover {
    background-color: #3498db;
    color: #fff;
}

.register-link:hover {
    background-color: #2980b9;
    border-color: #2980b9;
}

/* ==================== 搜索覆盖层 ==================== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 2000;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-container {
    width: 90%;
    max-width: 600px;
}

.search-form {
    position: relative;
}

.search-field {
    width: 100%;
    padding: 1.5rem;
    font-size: 1.25rem;
    border: none;
    border-radius: 50px;
    outline: none;
}

.search-submit, .search-close {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.search-submit {
    right: 1.5rem;
}

.search-close {
    right: 4.5rem;
}

.search-submit:hover, .search-close:hover {
    color: #333;
}

/* ==================== 移动端菜单 ==================== */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.mobile-menu-toggle span {
    width: 100%;
    height: 3px;
    background-color: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-panel {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background: #fff;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1500;
    overflow-y: auto;
}

.mobile-menu-panel.active {
    right: 0;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1400;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==================== 面包屑导航 ==================== */
.breadcrumb {
    padding: 1rem 0;
    font-size: 0.875rem;
    color: #666;
}

.breadcrumb a {
    color: #3498db;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ==================== 文章卡片样式 ==================== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.post-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.post-thumbnail {
    position: relative;
    overflow: hidden;
}

.post-thumbnail img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-card:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-category {
    position: absolute;
    top: 1rem;
    left: 1rem;
}

.post-category a {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #3498db;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 20px;
    text-decoration: none;
}

.post-content {
    padding: 1.5rem;
}

.entry-title {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    line-height: 1.4;
}

.entry-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.entry-title a:hover {
    color: #3498db;
}

.entry-excerpt {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.entry-footer {
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 1rem;
}

.post-meta a {
    color: #3498db;
    text-decoration: none;
}

.post-meta a:hover {
    text-decoration: underline;
}

.post-actions {
    display: flex;
    gap: 1rem;
}

.post-action {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.post-action:hover {
    color: #3498db;
    background-color: #f8f9fa;
}

/* ==================== 分页导航 ==================== */
.pagination-wrapper {
    margin: 2rem 0;
    text-align: center;
}

.pagination {
    display: inline-flex;
    gap: 0.5rem;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
}

.pagination a:hover, .pagination .active {
    background-color: #3498db;
    color: #fff;
    border-color: #3498db;
}

/* ==================== 无内容提示 ==================== */
.no-posts {
    text-align: center;
    padding: 3rem 1rem;
}

.no-posts-icon {
    font-size: 3rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.no-posts h3 {
    margin-bottom: 1rem;
    color: #666;
}

.no-posts p {
    color: #999;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.widget {
    margin-bottom: 2rem;
}

.widget:last-child {
    margin-bottom: 0;
}

.widget-title {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
    color: #333;
    font-size: 1.25rem;
}

/* ==================== 底部样式 ==================== */
.site-footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    margin-top: 3rem;
}

.footer-widgets {
    padding: 2rem 0;
    background-color: #34495e;
}

.footer-widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-widget-column .widget-title {
    color: #ecf0f1;
    border-bottom-color: #3498db;
}

.footer-widget-column a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-widget-column a:hover {
    color: #3498db;
}

.site-info {
    padding: 1.5rem 0;
    text-align: center;
    border-top: 1px solid #3d566e;
}

.copyright p {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.footer-nav {
    margin: 1rem 0;
}

.footer-nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-nav a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-nav a:hover {
    color: #3498db;
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #34495e;
    color: #bdc3c7;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.footer-social a:hover {
    background-color: #3498db;
    color: #fff;
    transform: translateY(-3px);
}

/* ==================== 返回顶部按钮 ==================== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background-color: #3498db;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: #2980b9;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

/* ==================== 加载动画 ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
    }
    
    .main-navigation {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .content-area {
        grid-template-columns: 1fr;
    }
    
    .footer-widgets-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-nav ul {
        justify-content: center;
    }
    
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .post-content {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
}