

/* 写信页面样式 */
:root {
    --background-color: #FFF5EE;
    --primary-color: #D88C7E;
    --accent-color: #95C5B0;
    --text-color: #2D4356;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    font-family: 'Noto Serif SC', serif;
    min-height: 100vh;
}

/* 返回按钮样式 */
.back-button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #FFD699;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(255, 214, 153, 0.3);
}

.back-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 214, 153, 0.4);
}

.back-icon {
    font-size: 20px;
}

/* 写信区域样式 */
.letter-container {
    max-width: 900px;
    margin: 60px auto 40px auto;
    padding: 0 20px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
    background: none;
    box-sizing: border-box;
}

.letter-form {
    background-color: #fff;
    padding: 40px 40px 60px;
    border-radius: 18px;
    box-shadow: 0 6px 24px rgba(216,140,126,0.10), 0 1.5px 6px rgba(216,140,126,0.08);
    position: relative;
    min-height: 480px;
    height: auto;
    overflow: visible;
    transition: box-shadow 0.3s;
    will-change: box-shadow;
}

/* 修改日期样式 */
.letter-header {
    position: absolute;
    top: 20px;
    right: 40px;
    margin: 0;
    color: #666;
    font-family: 'Noto Serif SC', serif;
    font-size: 14px;
    z-index: 1;
    background: transparent;  /* 移除白色背景 */
}

.date {
    text-align: right;
    margin: 0;
    padding: 0;
}

/* 信纸背景线条 */
.letter-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(#e5e5e5 1px, transparent 1px);
    background-size: 100% 32px;
    background-position: 0 100px;
    pointer-events: none;  /* 防止干扰文字输入 */
    z-index: 0;
}

/* 左侧红线 */
.letter-form::after {
    content: '';
    position: absolute;
    top: 0;
    left: 30px;
    height: 100%;
    width: 1px;
    background-color: #ff9999;
    opacity: 0.5;
    pointer-events: none;
}

/* 文本区域样式 */
textarea {
    width: 100%;
    min-height: 320px;
    margin-top: 60px;
    padding: 0 0 20px 50px;
    border: none;
    background: transparent;
    font-family: 'Noto Serif SC', serif;
    font-size: 17px;
    line-height: 32px;
    color: #2c3e50;
    resize: vertical;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    transition: font-size 0.2s;
}

textarea:focus {
    outline: none;
}

.letter-footer {
    position: absolute;
    bottom: 30px;
    right: 30px;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
    width: calc(100% - 60px);
}

.api-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #FFD699;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(255, 214, 153, 0.3);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.api-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 214, 153, 0.4);
}

/* 波纹动画效果 */
.api-button::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 2s infinite;
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.button-text {
    display: none; /* 隐藏文字 */
}

.button-icon {
    font-size: 24px;
}

/* 弹窗样式优化 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    /* 弹窗居中样式 */
    align-items: center;
    justify-content: center;
}

/* 显示弹窗时的样式 */
.modal.show {
    display: flex !important; /* 确保能覆盖其他 display 声明 */
    opacity: 1;
}

.modal-content {
    background: rgba(255, 255, 255, 0.98);
    padding: 20px;
    border-radius: 12px;
    width: 75%;
    max-width: 280px;
    position: relative;
    transform: translateY(-20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    /* 优化布局 */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin: 0;
}

.close-button {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s ease;
    line-height: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.modal-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.modal-input:focus {
    outline: none;
    border-color: #FFD699;
    box-shadow: 0 0 0 2px rgba(255, 214, 153, 0.2);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    margin-top: auto;
}

.modal-button {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-button.cancel {
    background-color: #f5f5f5;
    color: #666;
}

.modal-button.cancel:hover {
    background-color: #eee;
}

.modal-button.confirm {
    background-color: #FFD699 !important;
    color: #333 !important;
}

.modal-button.confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(255, 214, 153, 0.3);
}

/* 成功弹窗样式优化 */
.success-modal .modal-content {
    text-align: center;
    padding: 25px;
    max-width: 260px;
}

.success-icon {
    font-size: 32px;
    color: #4CAF50;
    margin-bottom: 15px;
}

.success-modal h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
}

.success-modal p {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* 开关按钮样式优化 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-label:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-label {
    background-color: #FFD699;
}

input:checked + .toggle-label:before {
    transform: translateX(20px);
}

/* 提示文本样式 */
.hint {
    font-size: 12px;
    color: #999;
    margin-left: 8px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .letter-container {
        margin: 24px auto 10px auto;
        padding: 0 4vw;
    }
    .letter-form {
        padding: 18px 8px 60px 8px;
        border-radius: 12px;
        min-height: 320px;
    }
    .letter-header {
        top: 10px;
        right: 10px;
        font-size: 12px;
    }
    textarea {
        width: 100%;
        padding: 0 0 20px 20px;
        margin-top: 40px;
        font-size: 16px;
        line-height: 26px;
        min-height: 180px;
        max-height: 50vh;
        background: transparent;
    }
    .letter-form::after {
        left: 12px;
    }
    .letter-footer {
        position: static;
        width: 100%;
        margin-top: 12px;
        right: 0;
        bottom: 0;
        justify-content: flex-end;
    }
}
/* 防止iOS输入时页面晃动 */
@media (max-width: 768px) {
    html, body {
        height: 100%;
        min-height: 100vh;
        overflow-x: hidden;
        background: var(--background-color);
    }
    body {
        position: relative;
        overscroll-behavior-y: contain;
        touch-action: manipulation;
    }
    main {
        min-height: 100vh;
        box-sizing: border-box;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .letter-container {
        margin: 40px auto;
    }

    .letter-form {
        padding: 20px;
    }

    textarea {
        font-size: 14px;
        padding: 0 15px 15px 40px;
    }

    .modal-content {
        padding: 20px;
    }
} 

/* 添加模糊效果类 */
.blur {
    filter: blur(5px);
    transition: filter 0.3s ease;
    pointer-events: none;
} 

/* 触摸设备优化 */
@media (hover: none) {
    .api-button:active {
        transform: scale(0.98);
    }

    .modal-button:active {
        opacity: 0.8;
    }

    /* 增加可点击区域 */
    .form-group label {
        padding: 8px 0;
    }

    .modal-input {
        padding: 12px;
    }

    /* 优化滚动体验 */
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
}

/* 防止键盘弹出时页面变形 */
@media screen and (max-height: 450px) {
    .modal-content {
        max-height: 85vh;
        overflow-y: auto;
    }
} 

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
} 

/* 成功弹窗样式优化 */
.success-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.postmark {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.success-icon {
    font-size: 32px;
    color: #4CAF50;
} 
