/* 全局样式 */
:root {
    --primary-color: #9a2a2a; /* 朱砂红 */
    --secondary-color: #eac853; /* 金色 */
    --light-bg: #f9f5e9; /* 米白 */
    --dark-text: #333333;
    --light-text: #f5f5f5;
    --border-radius: 8px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
    background-color: var(--light-bg);
    color: var(--dark-text);
    line-height: 1.6;
}

/* 导航栏 */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
}

.logo-icon {
    margin-right: 0.5rem;
    font-size: 1.8rem;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 1.5rem;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}

nav ul li a:hover, nav ul li a.active {
    border-bottom: 2px solid var(--secondary-color);
}

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* 主内容区 */
main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hero {
    background: linear-gradient(135deg, rgba(154, 42, 42, 0.9), rgba(234, 200, 83, 0.8));
    color: white;
    padding: 3rem 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path fill="white" fill-opacity="0.1" d="M30,10L50,30L70,10L90,30L70,50L90,70L70,90L50,70L30,90L10,70L30,50L10,30L30,10Z"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto 1.5rem;
}

.search-bar {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 0.8rem 1.2rem;
    border-radius: 50px;
    border: none;
    font-size: 1rem;
    box-shadow: var(--shadow);
}

.search-bar button {
    position: absolute;
    right: 5px;
    top: 5px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.search-bar button:hover {
    background-color: #7a1a1a;
}

/* 分类导航 */
.category-nav {
    margin-bottom: 2rem;
}

.category-nav h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
}

.category-nav h2::before {
    content: "";
    display: inline-block;
    width: 30px;
    height: 3px;
    background-color: var(--primary-color);
    margin-right: 1rem;
}

.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.category-btn {
    padding: 0.5rem 1.2rem;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.category-btn:hover, .category-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 颜色网格 */
.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.color-card {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.color-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.color-block {
    height: 120px;
    position: relative;
}

.color-name {
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.color-info {
    padding: 1rem;
}

.color-code {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-family: monospace;
}

.copy-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
}

.copy-btn:hover {
    background-color: #7a1a1a;
}

.color-desc {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

/* 配色方案 */
.color-palettes {
    margin-bottom: 3rem;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.palette-card {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.palette-colors {
    display: flex;
    height: 100px;
}

.palette-color {
    flex: 1;
    position: relative;
}

.palette-color span {
    position: absolute;
    bottom: 5px;
    left: 5px;
    color: white;
    font-size: 0.7rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.palette-info {
    padding: 1rem;
}

.palette-info h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.palette-info p {
    font-size: 0.9rem;
    color: #666;
}

/* 页脚 */
footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.footer-links a {
    color: white;
    margin: 0 1rem;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

.copyright {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 移动端适配 */
@media (max-width: 768px) {
    header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .logo {
        margin-bottom: 1rem;
    }

    nav {
        width: 100%;
        display: none;
    }

    nav.active {
        display: block;
    }

    nav ul {
        flex-direction: column;
    }

    nav ul li {
        margin: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    nav ul li a {
        display: block;
        padding: 0.8rem 0;
    }

    .menu-toggle {
        display: block;
        position: absolute;
        top: 1rem;
        right: 1rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .color-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .palette-grid {
        grid-template-columns: 1fr;
    }
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 90%;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #aaa;
}

.close-modal:hover {
    color: var(--primary-color);
}

.modal-color {
    width: 100%;
    height: 200px;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    position: relative;
}

.modal-color-name {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.modal-color-codes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.color-code-box {
    background-color: var(--light-bg);
    padding: 0.8rem;
    border-radius: var(--border-radius);
}

.color-code-box h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.modal-color-desc {
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

.modal-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.modal-btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.modal-btn.primary:hover {
    background-color: #7a1a1a;
}

.modal-btn.secondary {
    background-color: #eee;
    color: var(--dark-text);
}

.modal-btn.secondary:hover {
    background-color: #ddd;
}