:root {
    /* 主题色 */
    --bg-primary: #fdfbf7;
    --bg-secondary: #f8f6f1;
    --text-primary: #2c2c2c;
    --text-secondary: #6b6b6b;
    --text-tertiary: #a0a0a0;
    
    /* 时间线 */
    --timeline-color: #d4c5b0;
    --timeline-dot: #8b7355;
    --timeline-accent: #b8a394;
    
    /* 用户颜色 */
    --user1-color: #b8a394;
    --user1-light: #e8dfd8;
    --user2-color: #94a3b8;
    --user2-light: #dce4ec;
    
    /* 阴影和边框 */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
    --border-color: #e8e4de;
    
    /* 字体 */
    --font-serif: 'Crimson Pro', 'Noto Serif SC', serif;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
    font-family: var(--font-serif);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 顶部栏 */
.header {
    position: sticky;
    top: 0;
    background: rgba(253, 251, 247, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px 0;
    margin-bottom: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.site-title {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 3px;
    color: var(--text-primary);
}

.header-controls {
    display: flex;
    gap: 12px;
}

.toggle-btn,
.add-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-btn {
    background: var(--timeline-dot);
    color: white;
    border-color: var(--timeline-dot);
}

.toggle-btn:hover,
.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.add-btn:hover {
    background: #6f5d45;
}

/* 时间线主容器 */
.timeline {
    position: relative;
    padding: 20px 0 80px;
}

/* 中央时间轴 */
.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        var(--timeline-color) 3%, 
        var(--timeline-color) 97%, 
        transparent 100%);
    transform: translateX(-50%);
    z-index: 0;
}

.timeline-content {
    position: relative;
}

/* 年份节点 */
.year-section {
    position: relative;
    margin-bottom: 40px;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.year-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    cursor: pointer;
    user-select: none;
}

.year-node {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    background: white;
    border: 2px solid var(--timeline-dot);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    z-index: 2;
}

.year-header:hover .year-node {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.year-node::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% + 16px);
    height: calc(100% + 16px);
    border: 1px solid var(--timeline-color);
    border-radius: 28px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.year-header:hover .year-node::before {
    opacity: 1;
}

.collapse-icon {
    transition: transform 0.3s ease;
    color: var(--timeline-dot);
    flex-shrink: 0;
}

.year-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.year-title {
    font-size: 22px;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: 2px;
}

.year-count {
    font-size: 12px;
    color: var(--text-tertiary);
    font-family: var(--font-sans);
    background: var(--bg-secondary);
    padding: 2px 10px;
    border-radius: 10px;
}

/* 月份节点 */
.months-container {
    transition: all 0.3s ease;
}

.month-section {
    position: relative;
    margin-bottom: 32px;
}

.month-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    cursor: pointer;
    user-select: none;
}

.month-node {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    background: white;
    border: 2px solid var(--timeline-accent);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    z-index: 2;
}

.month-header:hover .month-node {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.month-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.month-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.month-count {
    font-size: 11px;
    color: var(--text-tertiary);
    font-family: var(--font-sans);
}

/* 日期节点 */
.days-container {
    transition: all 0.3s ease;
}

.day-section {
    position: relative;
    margin-bottom: 28px;
}

.day-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    cursor: pointer;
    user-select: none;
}

.day-node {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--timeline-color);
    border-radius: 16px;
    transition: all 0.3s ease;
    z-index: 2;
}

.day-header:hover .day-node {
    transform: scale(1.05);
    background: white;
    box-shadow: var(--shadow-sm);
}

.day-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.day-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-sans);
}

.day-count {
    font-size: 11px;
    color: var(--text-tertiary);
    font-family: var(--font-sans);
}

/* 时间条目容器 */
.posts-container {
    position: relative;
    transition: all 0.3s ease;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

/* 时间轴点 */
.timeline-item::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 16px;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: var(--timeline-dot);
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
    z-index: 1;
    box-shadow: 0 0 0 4px rgba(139, 115, 85, 0.1);
}

/* 左右交替布局 */
.timeline-item.left {
    flex-direction: row-reverse;
}

.timeline-item.left .content-card {
    margin-right: calc(50% + 30px);
    margin-left: 0;
}

.timeline-item.right .content-card {
    margin-left: calc(50% + 30px);
    margin-right: 0;
}

/* 内容卡片 */
.content-card {
    flex: 0 0 auto;
    width: calc(50% - 30px);
    background: white;
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border-left: 3px solid var(--user1-color);
}

.timeline-item.right .content-card {
    border-left: none;
    border-right: 3px solid var(--user2-color);
}

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

/* 卡片头部 */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.user-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-family: var(--font-sans);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.timeline-item.left .user-badge {
    background: var(--user1-light);
    color: var(--user1-color);
}

.timeline-item.right .user-badge {
    background: var(--user2-light);
    color: var(--user2-color);
}

.time-badge {
    font-size: 12px;
    color: var(--text-tertiary);
    font-family: var(--font-sans);
    font-weight: 500;
}

/* 地点标签 */
.location-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-tertiary);
    font-family: var(--font-sans);
    margin-bottom: 8px;
}

.location-badge svg {
    width: 12px;
    height: 12px;
}

/* 文字内容 */
.content-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.content-text p {
    margin-bottom: 8px;
}

.content-text p:last-child {
    margin-bottom: 0;
}

/* 图片容器 */
.content-images {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.content-images.count-1 {
    grid-template-columns: 1fr;
}

.content-images.count-2 {
    grid-template-columns: repeat(2, 1fr);
}

.content-images.count-3 {
    grid-template-columns: repeat(3, 1fr);
}

.content-images.count-4 {
    grid-template-columns: repeat(2, 1fr);
}

.content-images.count-5,
.content-images.count-6 {
    grid-template-columns: repeat(3, 1fr);
}

.image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-wrapper:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-sm);
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: all 0.3s ease;
}

/* 预览模式 */
.toggle-btn[data-state="preview"] ~ .timeline .image-wrapper {
    height: 100px;
}

.toggle-btn[data-state="preview"] ~ .timeline .content-images.count-1 .image-wrapper {
    height: 160px;
}

/* 完整模式 */
.toggle-btn[data-state="full"] ~ .timeline .image-wrapper {
    height: auto;
}

.toggle-btn[data-state="full"] ~ .timeline .image-wrapper img {
    height: auto;
}

/* 隐藏模式 */
.toggle-btn[data-state="hidden"] ~ .timeline .content-images {
    display: grid;
}

/* 图片占位符 */
.images-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 32px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-tertiary);
    font-family: var(--font-sans);
    font-size: 14px;
    cursor: default;
    grid-column: 1 / -1;
}

.images-placeholder svg {
    opacity: 0.6;
}

/* 图片灯箱 */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-family: var(--font-sans);
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 500;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-tertiary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
}

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

/* 表单样式 */
form {
    padding: 24px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-serif);
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--timeline-dot);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.btn-cancel,
.btn-submit {
    padding: 10px 24px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-cancel:hover {
    background: var(--border-color);
}

.btn-submit {
    background: var(--timeline-dot);
    border: none;
    color: white;
}

.btn-submit:hover {
    background: #6f5d45;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 加载状态 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
}

.loading.hidden {
    display: none;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 2px solid var(--bg-secondary);
    border-top-color: var(--timeline-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
    }
    
    .header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .site-title {
        font-size: 20px;
    }
    
    .timeline-line {
        left: 30px;
    }
    
    .year-header,
    .month-header,
    .day-header {
        justify-content: flex-start;
        padding-left: 60px;
    }
    
    .timeline-item {
        flex-direction: column !important;
        padding-left: 60px;
    }
    
    .timeline-item::before {
        left: 30px;
        top: 12px;
    }
    
    .timeline-item.left .content-card,
    .timeline-item.right .content-card {
        margin: 0;
        width: 100%;
    }
    
    .timeline-item.right .content-card {
        border-left: 3px solid var(--user2-color);
        border-right: none;
    }
    
    .content-card {
        padding: 14px 16px;
    }
    
    .year-title {
        font-size: 18px;
    }
    
    .month-title {
        font-size: 14px;
    }
    
    .day-title {
        font-size: 13px;
    }
    
    .content-images.count-2,
    .content-images.count-3,
    .content-images.count-4,
    .content-images.count-5,
    .content-images.count-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 30px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--timeline-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--timeline-dot);
}
