/* 通用样式与变量 */
:root {
    --primary-color: #3a86ff;
    --primary-dark: #2667cc;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #6c757d;
    --text-color: #212529;
    --border-radius: 6px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
    --font-family: 'Noto Sans SC', 'Helvetica Neue', Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f7f8fa;
    font-weight: 300;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3 {
    margin-bottom: 20px;
    font-weight: 500;
    letter-spacing: -0.5px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

h2 {
    font-size: 1.8rem;
    font-weight: 500;
}

h3 {
    font-size: 1.3rem;
    font-weight: 500;
}

/* 按钮样式 */
button {
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 400;
    box-shadow: 0 2px 4px rgba(58, 134, 255, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 8px rgba(58, 134, 255, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--medium-gray);
    color: var(--text-color);
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 400;
}

.btn-secondary:hover {
    background-color: var(--dark-gray);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 400;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* 页眉样式 */
header {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 0;
    padding: 0;
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header .subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* 介绍部分 */
.intro {
    text-align: center;
    margin-bottom: 50px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.intro p {
    font-size: 1.1rem;
    color: var(--dark-gray);
    line-height: 1.8;
}

/* 网格容器 */
.grid-container {
    margin-bottom: 60px;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    padding: 30px;
    background-color: var(--light-gray);
    box-shadow: var(--box-shadow);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.age-input {
    display: flex;
    align-items: center;
}

.age-input input {
    width: 60px;
    margin-left: 10px;
    padding: 8px;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-family: var(--font-family);
}

.zoom-controls {
    display: flex;
    align-items: center;
}

.zoom-controls button {
    background: white;
    border: 1px solid var(--medium-gray);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.zoom-controls button:hover {
    background-color: var(--light-gray);
    transform: translateY(-1px);
}

.zoom-controls span {
    margin: 0 15px;
    font-size: 14px;
    font-weight: 400;
}

.grid-wrapper {
    display: flex;
    margin-bottom: 20px;
    width: 100%;
    min-height: 400px; /* 设置最小高度 */
    max-height: calc(80vh - 100px); /* 限制最大高度 */
}

.year-labels {
    width: 50px;
    margin-right: 10px;
    flex-shrink: 0;
    overflow-y: auto; /* 允许垂直滚动 */
    max-height: calc(80vh - 150px); /* 与grid-scroll保持一致 */
}

.grid-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: white;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    width: calc(100% - 60px);
    max-height: calc(80vh - 150px); /* 限制最大高度为可视区域高度减去头部空间 */
    height: auto; /* 高度自适应内容 */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

#life-grid {
    display: block;
    width: 100%;
}

.activity-legend {
    margin-top: 20px;
}

.activity-legend h3 {
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 500;
}

#legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.legend-item, .legend-empty {
    display: flex;
    align-items: center;
    margin-right: 15px;
    margin-bottom: 5px;
}

.color-box {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border-radius: 4px;
}

.color-box.empty {
    border: 1px solid var(--medium-gray);
    background-color: white;
}

.activity-name {
    font-size: 14px;
    font-weight: 400;
}

/* 活动面板 */
.activity-panel {
    margin-bottom: 60px;
}

.activity-panel h2 {
    margin-bottom: 25px;
}

#add-activity {
    margin-bottom: 25px;
}

.activities-list {
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.activity-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--medium-gray);
    display: flex;
    align-items: center;
    background-color: white;
    transition: var(--transition);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background-color: var(--light-gray);
}

.activity-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 15px;
    flex-shrink: 0;
}

.activity-details {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 16px;
}

.activity-time {
    color: var(--dark-gray);
    font-size: 14px;
}

.activity-actions {
    display: flex;
    gap: 10px;
}

.edit-activity {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    padding: 5px 10px;
    border-radius: var(--border-radius);
}

.edit-activity:hover {
    background-color: rgba(58, 134, 255, 0.1);
}

/* 导出部分 */
.export-section {
    margin-bottom: 60px;
}

.export-options {
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--box-shadow);
}

.format-selection, .range-selection, .extra-options {
    margin-bottom: 25px;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
}

.radio-group input[type="radio"] {
    margin-right: 8px;
}

.custom-range {
    margin-top: 15px;
    padding: 15px;
    background-color: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--medium-gray);
}

.custom-range input {
    width: 60px;
    padding: 8px;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    margin: 0 5px;
    font-family: var(--font-family);
}

.extra-options label {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    cursor: pointer;
}

.extra-options input[type="checkbox"] {
    margin-right: 8px;
}

#export-btn {
    margin-top: 20px;
    padding: 12px 25px;
    font-size: 16px;
}

/* 模态框 */
.modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    color: var(--dark-gray);
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--text-color);
}

.form-group {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-size: 16px;
    transition: var(--transition);
    background: #fff;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.2);
}

.year-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.year-range input {
    width: 70px;
    padding: 10px;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-family: var(--font-family);
}

.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    flex-shrink: 0;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--text-color);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary-color);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    flex-shrink: 0;
    background: white;
}

.right-actions {
    display: flex;
    gap: 10px;
}

footer {
    background-color: var(--light-gray);
    padding: 30px 0;
    text-align: center;
    color: var(--dark-gray);
    font-size: 14px;
    margin-top: 40px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .export-options {
        padding: 20px;
    }
    
    .controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .modal-content {
        padding: 20px;
        width: 98%;
        max-width: 98vw;
        max-height: 98vh;
    }
    
    .color-picker {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2rem;
    }
    
    .year-range {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    #delete-activity {
        width: 100%;
    }
    
    .right-actions {
        width: 100%;
    }
    
    .right-actions button {
        flex: 1;
    }
}

/* 顶部导航栏样式 */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 0 40px;
    height: 72px;
    border-bottom: 1px solid #e9ecef;
}

.navbar-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.site-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.site-subtitle {
    font-size: 1rem;
    color: #6c757d;
    font-weight: 400;
    margin-top: 2px;
    letter-spacing: 0.2px;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-link {
    font-size: 1.05rem;
    color: #222;
    text-decoration: none;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

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

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        padding: 0 10px;
    }
    .navbar-left {
        margin-bottom: 8px;
    }
    .navbar-right {
        gap: 18px;
    }
    .site-title {
        font-size: 1.3rem;
    }
    .site-subtitle {
        font-size: 0.95rem;
    }
}

/* 底部菜单栏样式 */
.footer-bar {
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 24px 0 16px 0;
    margin-top: 48px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.03);
}
.footer-main {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 15px;
    color: #888;
    gap: 8px;
}
.footer-links a {
    color: #888;
    text-decoration: none;
    margin: 0 6px;
    transition: color 0.2s;
}
.footer-links a:hover {
    color: var(--primary-color);
}
@media (max-width: 768px) {
    .footer-main {
        font-size: 13px;
    }
} 