/* 字体定义 */
@font-face {
    font-family: 'ZhuZiAWan';
    src: url('ZhuZiAWan2.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

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

/* 主体样式 - 默认黑夜模式 */
body {
    font-family: 'ZhuZiAWan', sans-serif;
    background-color: #1a1a1a;
    color: #f8f9fa;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 白天模式样式 */
body.light-mode {
    background-color: #f8f9fa;
    color: #333;
}

/* 主题切换按钮 */
.theme-toggle {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    cursor: pointer;
    z-index: 1001;
    padding: 0.2rem;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.light-mode .theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.toggle-icon {
    width: 24px;
    height: 24px;
    color: #f8f9fa;
    transition: color 0.3s ease;
}

body.light-mode .toggle-icon {
    color: #333;
}

/* 顶部倒计时 */
.countdown-header {
    background-color: #2d2d2d;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    padding: 0.8rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    text-align: center;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* 复制成功提示 */
.global-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 40px;
    border-radius: 4px;
    color: white;
    font-size: 16px;
    font-weight: 500;
    z-index: 99999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    opacity: 0;
    min-width: 200px;
    text-align: center;
    background-color: #67c23a;
    pointer-events: none;
}

.global-message.show {
    opacity: 1;
}

.global-message.error {
    background-color: #f56c6c;
}

.global-message.success {
    background-color: #67c23a;
}

body.light-mode .global-message {
    background-color: #67c23a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .global-message {
        padding: 12px 20px;
        font-size: 14px;
        min-width: 150px;
        top: 40%; /* 调整位置，避免被键盘遮挡 */
    }
}

body.light-mode .global-message.error {
    background-color: #f56c6c;
}

body.light-mode .global-message.success {
    background-color: #67c23a;
}

body.light-mode .countdown-header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.countdown {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.countdown-title {
    font-size: 1rem;
    font-weight: bold;
    color: #f8f9fa;
    margin-right: 0.8rem;
    transition: color 0.3s ease;
}

.countdown-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.countdown-number {
    font-size: 1rem;
    font-weight: bold;
    color: #e74c3c;
}

.countdown-label {
    font-size: 0.8rem;
    color: #aaa;
    transition: color 0.3s ease;
}

body.light-mode .countdown-title {
    color: #333;
}

body.light-mode .countdown-label {
    color: #666;
}

/* 主内容区 */
main {
    min-height: calc(100vh - 120px);
    padding: 1rem 0;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 页面部分 */
.section {
    display: none;
}

.section.active {
    display: block;
}

.section-title {
    text-align: center;
    margin-bottom: 1.2rem;
    font-size: 1.2rem;
    color: #333;
}

/* 许愿表单 */
.wish-form {
    background-color: #2d2d2d;
    border-radius: 10px 10px 0 0;
    padding: 1rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    position: fixed;
    bottom: 70px; /* 底部导航栏高度 */
    left: 0;
    right: 0;
    transform: none;
    z-index: 1001;
    width: 100%;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

#wish-content {
    width: 100%;
    min-height: 80px;
    padding: 0.8rem;
    border: 1px solid #444;
    border-radius: 5px;
    resize: vertical;
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 1rem;
    background-color: #3a3a3a;
    color: #f8f9fa;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body.light-mode .wish-form {
    background-color: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

body.light-mode #wish-content {
    background-color: #fff;
    color: #333;
    border-color: #ddd;
}

/* 许愿表单选项 */
.wish-form .form-options {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 1rem !important;
    flex-wrap: nowrap !important;
    margin-top: 0px !important; /* 调整与输入框的距离 */
    width: 100% !important;
}

.wish-form .form-options .user-info {
    flex: 0 0 auto !important;
    font-size: 0.9rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.wish-form .form-options label {
    flex: 1 !important;
    text-align: right !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 1rem !important;
}

.wish-form .form-options button {
    flex: 0 0 auto !important;
    padding: 0.6rem 1rem !important;
    font-size: 1rem !important;
    min-width: 120px !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #e74c3c !important;
    color: #fff !important;
    border: none !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    font-family: inherit !important;
    transition: background-color 0.3s ease !important;
}

.wish-form .form-options button:hover {
    background-color: #c0392b !important;
}

/* 手机版适配 */
    @media (max-width: 768px) {
        .wish-form .form-options {
            gap: 0.5rem !important;
            flex-wrap: nowrap !important;
        }
        
        .wish-form .form-options .user-info {
            font-size: 1rem !important;
            order: 1 !important;
            flex: 0 0 auto !important;
            text-align: left !important;
            white-space: nowrap !important;
        }
        
        .wish-form .form-options label {
            font-size: 0.9rem !important;
            order: 2 !important;
            flex: 1 !important;
            text-align: right !important;
        }
        
        .wish-form .form-options button {
            padding: 0.5rem 1rem !important;
            font-size: 0.9rem !important;
            min-width: 100px !important;
            height: auto !important;
            order: 3 !important;
        }
        
        .wish-form .form-options input[type="checkbox"] {
            width: 16px !important;
            height: 16px !important;
        }
        
        .wish-form {
            padding: 0.8rem !important;
        }
        
        #wish-content {
            min-height: 60px !important;
            padding: 0.8rem !important;
            font-size: 0.9rem !important;
        }
    }

/* 按钮样式 */
.btn {
    background-color: #e74c3c;
    color: #fff;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

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

/* 许愿容器 */
.wish-container {
    position: relative;
    min-height: 600px;
    padding: 3rem 0;
    overflow: hidden;
    width: 100%;
}



/* 许愿卡片 - 独立滚动 */
.wish-item {
    position: absolute;
    background-color: #2d2d2d;
    border-radius: 10px;
    padding: 0.8rem 1.5rem;
    max-width: 300px;
    cursor: pointer;
    overflow: visible;
    opacity: 1;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 1;
    white-space: nowrap;
    height: auto;
    animation: wishScroll 50s linear infinite;
}

.wish-item.paused {
    animation-play-state: paused;
}

@keyframes wishScroll {
    0% {
        left: 100%;
    }
    100% {
        left: -300px;
    }
}

.wish-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.wish-item .wish-text {
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 作者信息 */
.wish-item .wish-author {
    font-size: 0.75rem;
    color: #f8f9fa;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0,0,0,0.9);
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    margin-bottom: 8px;
    display: block;
}

.wish-item .wish-author::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0,0,0,0.9);
}

.wish-item:hover .wish-author {
    opacity: 1;
}

/* 白天模式下的许愿卡片 */
body.light-mode .wish-item {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

body.light-mode .wish-item:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

body.light-mode .wish-item .wish-author {
    background-color: rgba(0,0,0,0.7);
    color: #fff;
}

/* 记事本 */
#note-content {
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    border: 1px solid #444;
    border-radius: 5px;
    resize: vertical;
    font-family: inherit;
    font-size: 1rem;
    background-color: #2d2d2d;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    color: #f8f9fa;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.auto-save-info {
    text-align: right;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #aaa;
    transition: color 0.3s ease;
}

/* 大事记 */
.events-list {
    background-color: #2d2d2d;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.event-item {
    padding: 1rem;
    border-bottom: 1px solid #444;
    transition: border-color 0.3s ease, color 0.3s ease;
    color: #f8f9fa;
}

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

.event-item h3 {
    color: #e74c3c;
    margin-bottom: 0.5rem;
}

/* 手机导航 */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #2d2d2d;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    display: flex;
    justify-content: space-around;
    padding: 1rem 0;
    z-index: 1002;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    height: 70px;
    align-items: center;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #aaa;
    transition: color 0.3s ease;
}

.nav-item.active {
    color: #e74c3c;
}

body.light-mode #note-content {
    background-color: #fff;
    color: #333;
    border-color: #ddd;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

body.light-mode .auto-save-info {
    color: #666;
}

body.light-mode .events-list {
    background-color: #fff !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

body.light-mode .event-item {
    border-bottom: 1px solid #eee !important;
    color: #333 !important;
}

body.light-mode .event-item h3 {
    color: #c0392b !important;
}

body.light-mode .mobile-nav {
    background-color: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

body.light-mode .nav-item {
    color: #666;
}

/* 导航图标 */
.nav-icon {
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
}

/* 导航文字 */
.nav-text {
    font-size: 0.8rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    /* 确保底部导航栏图标显示 */
    .nav-icon {
        font-size: 1.5rem !important;
        display: block !important;
    }

    .nav-text {
        font-size: 0.8rem !important;
        display: block !important;
    }

    .countdown-number {
        font-size: 1.5rem;
    }

    .countdown-label {
        font-size: 1rem;
    }

    /* 手机端许愿条适配 */
    .wish-container {
        min-height: 480px;
    }

    .wish-item {
        max-width: 200px;
        padding: 0.6rem 1rem;
    }

    .wish-item .wish-text {
        font-size: 0.9rem;
    }

    /* 手机端提交框适配 */
    .wish-form {
        bottom: 70px; /* 调整为导航栏实际高度 */
        padding: 0.8rem;
        width: 100%;
        left: 0;
        right: 0;
        z-index: 1001;
        box-sizing: border-box;
    }
    
    /* 确保手机导航在最底部 */
    .mobile-nav {
        z-index: 1002;
        height: 70px;
    }

    #wish-content {
        min-height: 60px;
        font-size: 0.9rem;
    }

    .wish-form .form-options {
        gap: 0.5rem !important;
    }

    .wish-form .form-options button {
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
    }
}

/* 桌面版显示底部导航 */
@media (min-width: 769px) {
    .mobile-nav {
        display: flex;
        max-width: 600px;
        margin: 0 auto;
        border-radius: 10px 10px 0 0;
    }

    main {
        min-height: calc(100vh - 170px);
    }

    /* PC端许愿墙全屏显示 */
    .wish-container {
        min-height: 700px;
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        margin-right: calc(-50vw + 50%);
    }

    .wish-item {
        max-width: 350px;
        padding: 1rem 2rem;
    }

    .wish-item .wish-text {
        font-size: 1rem;
    }
}

/* 纪念日样式 */
.anniversary-footer {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    background-color: #1a1a1a;
    padding: 1rem;
    text-align: center;
    z-index: 100;
    border-top: none;
    transition: background-color 0.3s ease;
}

body.light-mode .anniversary-footer {
    background-color: #f8f9fa;
}

.anniversary-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 120px;
    min-height: calc(100vh - 200px);
}

.anniversary-item {
    background-color: #2d2d2d;
    border-radius: 10px;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    position: relative;
}

.anniversary-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

body.light-mode .anniversary-item {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

body.light-mode .anniversary-item:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.anniversary-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.anniversary-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #f8f9fa;
    margin: 0;
    flex: 1;
}

body.light-mode .anniversary-name {
    color: #333;
}

.anniversary-date {
    font-size: 0.9rem;
    color: #e74c3c;
    margin-bottom: 0.2rem;
}

.anniversary-countdown {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 0.3rem;
}

body.light-mode .anniversary-countdown {
    color: #666;
}

.anniversary-description {
    font-size: 0.85rem;
    color: #888;
    margin-top: 0.3rem;
    padding-top: 0.3rem;
    border-top: 1px solid #444;
}

body.light-mode .anniversary-description {
    border-top-color: #eee;
    color: #666;
}

.anniversary-actions {
    display: flex;
    gap: 0.3rem;
    margin-left: 0.5rem;
}

.anniversary-actions .btn-small {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s ease;
}

.btn-edit {
    background-color: #3498db;
    color: #fff;
}

.btn-edit:hover {
    background-color: #2980b9;
}

.btn-delete {
    background-color: #e74c3c;
    color: #fff;
}

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

.anniversary-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #888;
}

body.light-mode .anniversary-empty {
    color: #999;
}

.anniversary-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    z-index: 2000;
    overflow-y: auto;
    padding: 1rem;
    box-sizing: border-box;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 2rem;
}

.modal-content {
    background-color: #2d2d2d;
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 30px rgba(0,0,0,0.5);
    transition: background-color 0.3s ease;
}

body.light-mode .modal-content {
    background-color: #fff;
    box-shadow: 0 5px 30px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #444;
}

body.light-mode .modal-header {
    border-bottom-color: #eee;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #f8f9fa;
}

body.light-mode .modal-header h2 {
    color: #333;
}

.modal-close {
    font-size: 1.5rem;
    cursor: pointer;
    color: #aaa;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #e74c3c;
}

.modal-content form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #f8f9fa;
}

body.light-mode .form-group label {
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #444;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    background-color: #3a3a3a;
    color: #f8f9fa;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    box-sizing: border-box;
}

body.light-mode .form-group input,
body.light-mode .form-group select,
body.light-mode .form-group textarea {
    background-color: #fff;
    color: #333;
    border-color: #ddd;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #e74c3c;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-secondary {
    background-color: #666;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #555;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .modal-content {
        margin: 0;
        max-height: none;
        border-radius: 10px;
    }
    
    .anniversary-item {
        padding: 1rem;
        margin: 0 0.5rem 0.8rem 0.5rem;
    }
    
    .anniversary-name {
        font-size: 1rem;
    }
    
    .anniversary-actions {
        flex-wrap: wrap;
    }
    
    .anniversary-actions .btn-small {
        flex: 1;
        text-align: center;
    }
    
    .anniversary-footer {
        bottom: 70px;
        left: 0;
        right: 0;
        padding: 0.8rem;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .anniversary-footer .btn {
        width: 90%;
        max-width: 300px;
    }
    
    .anniversary-list {
        padding-bottom: 100px;
        min-height: auto;
    }
    
    #anniversary-section .container {
        padding: 0;
        padding-bottom: 80px;
    }
    
    #anniversary-section {
        padding-bottom: 70px;
    }
}

/* 底部导航4个项目的适配 */
.mobile-nav {
    justify-content: space-around;
}

.mobile-nav .nav-item {
    flex: 1;
    text-align: center;
}

/* 登录弹窗 */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-modal-content {
    background-color: #2d2d2d;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 350px;
    overflow: hidden;
}

body.light-mode .login-modal-content {
    background-color: #fff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.login-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #444;
}

body.light-mode .login-modal-header {
    border-bottom-color: #eee;
}

.login-modal-header h2 {
    margin: 0;
    color: #f8f9fa;
    font-size: 1.2rem;
}

body.light-mode .login-modal-header h2 {
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #aaa;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #e74c3c;
}

.login-modal-body {
    padding: 1.5rem;
    text-align: center;
}

.login-modal-body p {
    color: #f8f9fa;
    margin-bottom: 1.5rem;
}

body.light-mode .login-modal-body p {
    color: #333;
}

.login-modal .qrcode {
    width: 200px;
    height: 200px;
    margin: 0 auto 1.5rem;
    border: 1px solid #444;
    padding: 10px;
    background: white;
    border-radius: 8px;
}

body.light-mode .login-modal .qrcode {
    border-color: #ddd;
}

.login-modal .loading {
    display: none;
    color: #07C160;
    margin-top: 1rem;
}

.login-modal .loading.show {
    display: block;
}

/* 响应式 */
@media (max-width: 768px) {
    .login-modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .login-modal .qrcode {
        width: 180px;
        height: 180px;
    }
}