/* 全局样式 - 手缔手工坊 */
/* 暖色调主题：米色、浅棕、木色 */

/* 全局变量 */
:root {
    --color-primary: #C4956A;
    --color-primary-dark: #A67A4F;
    --color-secondary: #8B6914;
    --color-bg: #F5F0E8;
    --color-bg-light: #FFFDF7;
    --color-text: #333;
    --color-text-light: #888;
    --color-border: #E0D8C8;
    --border-radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
}

/* 重置默认样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--color-primary-dark);
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== 顶部导航栏 ==================== */
.header {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
}

.logo-icon {
    font-size: 24px;
}

.nav {
    display: flex;
    gap: 15px;
}

.nav-link {
    color: #666;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s;
}

.nav-link:hover {
    color: var(--color-primary);
    background: var(--color-bg);
}

.admin-link {
    color: #666;
    font-size: 18px;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s;
}

.admin-link:hover {
    color: var(--color-primary);
    background: var(--color-bg);
}

/* ==================== 轮播区域 ==================== */
.carousel {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    padding: 40px 0;
    color: white;
}

.carousel-wrapper {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.carousel-slide {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    height: 400px;
}

.carousel-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.carousel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(transparent 50%, rgba(0,0,0,0.7));
}

.carousel-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    color: white;
}

.carousel-tag {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    font-size: 12px;
    margin-bottom: 10px;
}

.carousel-title {
    font-size: 32px;
    margin: 0 0 10px 0;
    font-weight: 500;
}

.carousel-summary {
    font-size: 14px;
    opacity: 0.9;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s;
}

.carousel-dot.active {
    background: white;
    transform: scale(1.2);
}

.carousel-placeholder {
    height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.7);
    font-size: 18px;
}

/* ==================== 区块标题 ==================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 24px;
    color: var(--color-text);
    font-weight: 500;
}

.section-more {
    color: var(--color-primary);
    font-size: 14px;
}

/* ==================== 分类卡片 ==================== */
.categories {
    padding: 60px 0;
}

.category-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.category-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    text-decoration: none;
    color: var(--color-text);
    position: relative;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.category-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

.category-name {
    font-size: 20px;
    font-weight: 500;
    margin: 0 0 8px 0;
}

.category-desc {
    font-size: 14px;
    color: var(--color-text-light);
    margin: 0;
}

.category-arrow {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--color-primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.category-card:hover .category-arrow {
    opacity: 1;
}

/* ==================== 教程卡片 ==================== */
.featured,
.latest {
    padding: 60px 0;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.post-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    text-decoration: none;
    color: var(--color-text);
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.post-cover {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.post-cover .post-category {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 12px;
    background: rgba(255,255,255,0.9);
    border-radius: 20px;
    font-size: 12px;
    color: var(--color-primary);
}

.post-info {
    padding: 15px;
}

.post-title {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.post-summary {
    font-size: 14px;
    color: var(--color-text-light);
    margin: 0 0 10px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #aaa;
}

/* ==================== 教程列表（首页最新） ==================== */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.post-list-item {
    display: flex;
    gap: 15px;
    background: white;
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--color-text);
    transition: all 0.3s;
}

.post-list-item:hover {
    box-shadow: var(--shadow-hover);
}

.post-list-cover {
    width: 120px;
    height: 80px;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
}

.post-list-info {
    flex: 1;
}

.post-list-category {
    font-size: 12px;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.post-list-title {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 6px 0;
}

.post-list-summary {
    font-size: 13px;
    color: var(--color-text-light);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-light);
}

.empty-state .empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

.empty-state p {
    font-size: 16px;
    margin: 0 0 5px 0;
}

.empty-state small {
    font-size: 14px;
    opacity: 0.7;
}

/* ==================== 分类页头部 ==================== */
.category-header {
    padding: 60px 0;
    color: white;
}

.category-header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.category-header-icon {
    font-size: 64px;
}

.category-header-title {
    font-size: 36px;
    font-weight: 500;
    margin: 0 0 8px 0;
}

.category-header-desc {
    font-size: 16px;
    opacity: 0.9;
    margin: 0;
}

/* ==================== 工具入口 ==================== */
.tools-section {
    padding: 40px 0;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.tool-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--color-text);
    transition: all 0.3s;
    text-align: center;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.tool-icon {
    font-size: 36px;
    display: block;
    margin-bottom: 10px;
}

.tool-name {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 5px 0;
}

.tool-desc {
    font-size: 13px;
    color: var(--color-text-light);
    margin: 0;
}

/* ==================== 页脚 ==================== */
.footer {
    background: #333;
    color: white;
    padding: 40px 0 20px 0;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

.footer-logo {
    font-size: 20px;
    font-weight: 500;
    margin: 0 0 8px 0;
}

.footer-desc {
    font-size: 14px;
    opacity: 0.7;
    margin: 0;
}

.footer-links h4 {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 12px 0;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    text-align: center;
    font-size: 14px;
    opacity: 0.7;
}

.footer-bottom a {
    color: rgba(255,255,255,0.7);
}

.footer-bottom a:hover {
    color: white;
}

/* ==================== 页面内容 ==================== */
.page-content {
    padding: 40px 0;
}

.section-count {
    font-size: 14px;
    color: var(--color-text-light);
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 20px;
    }

    .nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding: 5px 0;
    }

    .carousel-slide {
        height: 250px;
    }

    .carousel-title {
        font-size: 20px;
    }

    .category-cards,
    .post-grid,
    .tools-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .post-list-item {
        flex-direction: column;
    }

    .post-list-cover {
        width: 100%;
        height: 150px;
    }
}

/* ==================== 语言切换 ==================== */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lang-switch {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.lang-current {
    color: var(--color-primary);
    font-weight: 600;
    padding: 4px 8px;
    background: var(--color-bg);
    border-radius: 4px;
    cursor: default;
}

.lang-link {
    color: #999;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.lang-link:hover {
    color: var(--color-primary);
    background: var(--color-bg);
}
