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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 导航栏样式 */
.navbar {
    background-color: #333;
    color: white;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.nav-logo {
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
    color: white;
}

.nav-menu {
    display: flex;
    list-style: none;
}

.nav-item {
    margin-left: 30px;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s;
}

.nav-link:hover {
    color: #4CAF50;
}

.nav-link.active {
    color: #4CAF50;
    font-weight: bold;
}

.logout-btn {
    background-color: transparent;
    border: 1px solid white;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background-color: white;
    color: #333;
}

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

.header {
    text-align: center;
    padding: 60px 0;
    background-color: white;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.header h1 {
    font-size: 36px;
    margin-bottom: 10px;
    color: #333;
}

.header p {
    font-size: 18px;
    color: #666;
}

/* 卡片和网格 */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-content {
    padding: 20px;
}

.card-title {
    font-size: 20px;
    margin-bottom: 10px;
    color: #333;
}

.card-description {
    color: #666;
    margin-bottom: 15px;
}

.card-link {
    display: inline-block;
    background-color: #4CAF50;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.3s;
}

.card-link:hover {
    background-color: #45a049;
}

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

/* 音乐角落样式 */
.music-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.music-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.music-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.music-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.music-title {
    font-size: 20px;
    color: #333;
    margin-bottom: 5px;
}

.music-artist {
    font-size: 14px;
    color: #666;
}

.music-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.music-child {
    background-color: #4CAF50;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.music-description {
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
}

.audio-player {
    width: 100%;
    margin-bottom: 10px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

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

.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.form-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    min-height: 150px;
    resize: vertical;
}

.form-submit {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.form-submit:hover {
    background-color: #45a049;
}

/* 登录页面样式 */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.login-title {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.password-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    margin-bottom: 20px;
}

.login-btn {
    width: 100%;
    background-color: #4CAF50;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.login-btn:hover {
    background-color: #45a049;
}

.login-error {
    color: red;
    text-align: center;
    margin-top: 15px;
    display: none;
}

/* 家庭留言页面样式 */
.messages-container {
    display: grid;
    gap: 20px;
    margin-bottom: 40px;
}

.message-card {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.message-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.message-author {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2d3748;
}

.message-relationship {
    font-size: 0.9rem;
    color: #718096;
    margin-left: 10px;
}

.message-date {
    font-size: 0.85rem;
    color: #718096;
}

.message-content {
    font-size: 1.1rem;
    color: #4a5568;
    line-height: 1.8;
}

/* 孩子们页面样式 */
.children-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.child-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
}

.child-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.child-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.child-info {
    padding: 20px;
}

.child-name {
    font-size: 24px;
    margin-bottom: 5px;
    color: #333;
}

.child-age {
    font-size: 16px;
    color: #666;
    margin-bottom: 10px;
}

.child-nickname {
    font-size: 14px;
    color: #4CAF50;
    margin-bottom: 15px;
}

.child-description {
    color: #666;
    margin-bottom: 20px;
    text-align: left;
}

.child-interests {
    margin-bottom: 20px;
    text-align: left;
}

.child-interests h4 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.child-interests ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.child-interests li {
    background-color: #f0f8ff;
    color: #4CAF50;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
}

.view-more-btn {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s;
}

.view-more-btn:hover {
    background-color: #45a049;
}

/* 父母的信页面样式 */
.letters-container {
    display: grid;
    gap: 20px;
    margin-bottom: 40px;
}

.letter-card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.letter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.letter-header {
    background-color: #f7fafc;
    padding: 20px;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
}

.letter-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.letter-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    color: #666;
    font-size: 0.9rem;
}

.letter-content {
    padding: 20px;
    display: none;
    background-color: #ffffff;
    line-height: 1.8;
    color: #333;
}

.letter-content.expanded {
    display: block;
}

.target-age {
    background-color: #4CAF50;
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* 孩子详情页面样式 */
.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #4CAF50;
    text-decoration: none;
    font-size: 16px;
}

.back-link:hover {
    text-decoration: underline;
}

.child-detail {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.child-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 30px;
}

.child-header-image {
    flex: 1;
    min-width: 300px;
    margin-right: 30px;
}

.child-header-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.child-header-info {
    flex: 2;
    min-width: 300px;
}

.child-header-name {
    font-size: 36px;
    margin-bottom: 10px;
    color: #333;
}

.child-header-age {
    font-size: 18px;
    color: #666;
    margin-bottom: 10px;
}

.child-header-nickname {
    font-size: 16px;
    color: #4CAF50;
    margin-bottom: 20px;
}

.child-header-description {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.child-section {
    padding: 30px;
    border-top: 1px solid #eee;
}

.child-section h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

.child-interests {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.interest-item {
    background-color: #f0f8ff;
    color: #4CAF50;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
}

.child-achievements {
    list-style: none;
}

.achievement-item {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    color: #666;
}

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

.achievement-item:before {
    content: "✓ ";
    color: #4CAF50;
    font-weight: bold;
}

/* 照片时间线页面样式 */
.timeline {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 6px;
    background-color: #4CAF50;
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -3px;
}

.year-section {
    margin-bottom: 60px;
}

.year-title {
    text-align: center;
    font-size: 28px;
    color: #4CAF50;
    margin: 40px 0;
    position: relative;
}

.year-title::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 6px;
    background-color: #4CAF50;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
}

.photo-container {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
    margin: 20px 0;
}

.photo-container::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    right: -17px;
    background-color: white;
    border: 4px solid #4CAF50;
    top: 15px;
    border-radius: 50%;
    z-index: 1;
}

.left {
    left: 0;
}

.right {
    left: 50%;
}

.right::after {
    left: -16px;
}

.photo-content {
    padding: 20px;
    background-color: white;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.photo-date {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.photo-title {
    font-size: 20px;
    margin-bottom: 10px;
    color: #333;
}

.photo-description {
    color: #666;
    margin-bottom: 15px;
}

.photo-img {
    width: 100%;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: #333;
        width: 100%;
        display: none;
    }

    .nav-item {
        margin: 0;
        text-align: center;
        padding: 10px;
    }

    .header h1 {
        font-size: 28px;
    }

    .header p {
        font-size: 16px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .login-container {
        margin: 50px auto;
        padding: 20px;
    }

    .message-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .message-date {
        margin-top: 5px;
    }

    .letter-meta {
        flex-direction: column;
        gap: 5px;
    }

    .child-header {
        flex-direction: column;
    }

    .child-header-image {
        margin-right: 0;
        margin-bottom: 20px;
    }

    .timeline::after {
        left: 31px;
    }

    .photo-container {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
    }

    .photo-container::after {
        left: 15px;
    }

    .right {
        left: 0%;
    }
}