/* email-styles.css - AI邮件编辑器样式优化 */

/* 邮件输出容器样式优化 */
.email-output {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-top: 25px;
    overflow: hidden;
}

.email-output h4 {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    margin: 0;
    padding: 18px 25px;
    font-size: 18px;
    font-weight: 600;
    color: white;
    border-bottom: 1px solid #e1e5e9;
}

/* 邮件内容区域样式优化 */
.email-content {
    padding: 0; /* 取消内边距，让内部元素控制 */
}

/* 邮件元信息样式优化 */
.email-meta {
    margin-bottom: 25px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 4px;
}

.email-meta p {
    margin: 10px 0;
    font-size: 15px;
    color: #4a5568;
    line-height: 1.5;
}

.email-meta strong {
    color: #2d3748;
    min-width: 70px;
    display: inline-block;
    font-weight: 600;
}

/* 邮件正文整体样式 */
.email-body {
    white-space: pre-wrap;
    font-size: 15px;
    line-height: 1.8;
    color: #2d3748;
    background: #fafbfc;
    padding: 25px;
    border-radius: 6px;
    border-left: 4px solid #4299e1;
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

/* 正文段落标准缩进 */
.email-body p {
    margin: 0 0 1.2em 0;
    text-indent: 2em;
    text-align: justify;
}

/* 称呼不缩进，其余段落包括您好都与正文保持相同缩进 */
.email-body p:first-child /* 称呼不缩进 */ {
    text-indent: 0;
}

/* 结尾敬语特殊处理 */
.email-body p:contains("此致") {
    text-indent: 2em; /* 与正文保持一致的缩进 */
    text-align: left;
    margin: 0 0 0.5em 0;
}

/* 此致段落特殊样式，确保与正文保持相同缩进 */
.email-body p.sincerely {
    text-indent: 2em !important;
    text-align: left;
    margin: 0 0 0.5em 0;
}

.email-body p:contains("敬礼！") {
    text-indent: 0; /* 敬礼顶格显示 */
    text-align: left;
    margin: 0 0 1.2em 0;
}

/* 针对格式化后的敬礼特殊处理 */
.email-body p.closing {
    text-indent: 0 !important;
    text-align: left !important;
    margin: 0 0 1.2em 0 !important;
}

/* 中文邮件标准格式：签名行靠右对齐 */
/* 增强选择器的特异性和优先级 */
#emailResult .email-output .email-content .email-body p.email-signature,
#emailResult .email-output .email-content .email-body p[data-signature="true"],
.email-body p.email-signature,
.email-body p[data-signature="true"],
#emailResult .email-output .email-content .email-body p:contains("申请人："),
#emailResult .email-output .email-content .email-body p:contains("毕业院校："),
#emailResult .email-output .email-content .email-body p:contains("联系方式："),
#emailResult .email-output .email-content .email-body p:contains("日期："),
.email-body p:contains("申请人："),
.email-body p:contains("毕业院校："),
.email-body p:contains("联系方式："),
.email-body p:contains("日期：") {
    text-indent: 0 !important;
    text-align: right !important;
    text-align-last: right !important;
    margin: 0 0 0.8em 0 !important;
    /* 保持与正文一致的字体大小 */
    font-size: 15px !important;
    /* 保持与正文一致的颜色 */
    color: #2d3748 !important;
    /* 确保没有额外的样式覆盖 */
    padding: 0 !important;
    line-height: 1.8 !important;
    border: none !important;
    background: transparent !important;
    /* 确保不会被text-justify覆盖 */
    text-align: right !important;
    text-justify: none !important;
}



/* 称呼段落样式 */
.email-body .salutation {
    margin-bottom: 1.5em;
    font-weight: 600;
    text-indent: 0;
}

/* 正文内容段落 */
.email-body .content {
    margin-bottom: 1.2em;
}

/* 结尾段落样式 */
.email-body .closing {
    margin-top: 2em;
    margin-bottom: 1em;
    text-indent: 0;
    text-align: center;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .email-body {
        padding: 18px;
        font-size: 14px;
    }
    
    .email-body p {
        text-indent: 1.8em;
    }
    
    /* 确保签名行在移动端也靠右对齐，不会被通用规则覆盖 */
    /* 签名行样式 - 使用更可靠的选择器 */
    .email-body p.email-signature,
    .email-body p[data-signature="true"],
    #emailResult .email-body p.email-signature,
    #emailResult .email-body p[data-signature="true"] {
        text-indent: 0 !important;
        text-align: right !important;
        text-align-last: right !important;
        margin: 0 0 0.8em 0 !important;
        font-size: 15px !important;
        color: #2d3748 !important;
        padding: 0 !important;
        line-height: 1.8 !important;
        border: none !important;
        background: transparent !important;
        text-justify: none !important;
    }
    
    /* 移除可能导致签名行缩进的通用规则 */
    .email-body p:nth-last-child(-n+4) {
        /* 明确设置样式以避免默认缩进影响签名行 */
        text-indent: 0 !important;
        text-align: inherit !important;
        margin: inherit !important;
    }
    
    .email-meta {
        padding: 12px 15px;
    }
    
    .email-output h4 {
        padding: 15px 18px;
        font-size: 16px;
    }
}

/* 增强邮件正文格式 */
.email-body .paragraph-spacing {
    margin-bottom: 1.2em;
}

/* 特殊格式处理 */
.email-body .emphasis {
    font-weight: 600;
    color: #2d3748;
}

/* 链接样式（如果有） */
.email-body a {
    color: #4299e1;
    text-decoration: underline;
}

.email-body a:hover {
    color: #3182ce;
}

/* 复制按钮样式 */
.copy-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 25px auto;
    display: block;
    width: 200px;
}

.copy-btn:hover {
    background: #3182ce;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-btn.copied {
    background: #48bb78;
}

#copyEmailBtn:active {
    transform: translateY(0);
}

#copyEmailBtn.copied {
    background: #48bb78;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .email-output {
        margin: 15px 0;
        border-radius: 6px;
    }
    
    .email-content {
        padding: 15px;
    }
    
    .email-body {
        padding: 15px;
        font-size: 14px;
    }
    
    #copyEmailBtn {
        margin: 15px;
        width: calc(100% - 30px);
    }
}

/* 全新的加载状态样式 - 确保完全居中 */
.ai-loading-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 40px 20px;
    background-color: #fafbfc;
    border-radius: 8px;
}

.ai-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 15px;
}

.ai-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #4299e1;
    border-radius: 50%;
    animation: ai-spin 1s linear infinite;
}

.ai-loading-text {
    color: #718096;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

@keyframes ai-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* AI简历优化加载样式 */
.resume-loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    padding: 40px 20px;
    background-color: #fafbfc;
    border-radius: 8px;
}

.resume-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 20px;
}

.resume-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #4299e1;
    border-radius: 50%;
    animation: ai-spin 1s linear infinite;
}

.resume-loading-text {
    color: #718096;
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    animation: none !important;
}

/* 错误消息样式 */
.error {
    background: #fed7d7;
    color: #c53030;
    padding: 15px 20px;
    border-radius: 6px;
    margin: 20px 0;
    border-left: 4px solid #f56565;
}

/* 邮件正文格式增强 */
.email-body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.email-body .salutation {
    margin-bottom: 20px;
}

.email-body .content {
    margin-bottom: 20px;
}

.email-body .closing {
    margin-top: 30px;
}

/* 统一签名行样式，避免冲突 */
.email-body .signature {
    /* 移除此类样式定义，避免与.email-signature冲突 */
    display: none !important;
}

/* 分隔线样式 */
.email-content hr {
    border: 0;
    height: 1px;
    background: #e2e8f0;
    margin: 20px 0;
}

/* 进一步优化AI导师推荐关键词输入框样式 */
/* 确保AI导师推荐关键词输入框样式能覆盖Tailwind类 */
#keywords-container {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 12px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    background-color: white !important;
    transition: all 0.2s ease !important;
    min-height: 40px !important;
    box-shadow: none !important;
    width: 100% !important;
}

#keyword-input {
    flex: 1 !important;
    min-width: 200px !important;
    padding: 6px 10px !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    font-size: 14px !important;
    color: #4a5568 !important;
    margin: 0 !important;
}

#keyword-input::placeholder {
    color: #a0aec0 !important;
}

#keywords-container:focus-within {
    border-color: #4299e1 !important;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1) !important;
}

/* 关键词标签样式优化 */
#keywords-container span {
    display: inline-flex !important;
    align-items: center !important;
    padding: 4px 10px !important;
    background-color: #ebf8ff !important;
    color: #2b6cb0 !important;
    border-radius: 16px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    margin: 0 !important;
}

#keywords-container span button {
    margin-left: 6px !important;
    padding: 0 !important;
    width: 16px !important;
    height: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background: transparent !important;
    color: #718096 !important;
    cursor: pointer !important;
    border-radius: 50% !important;
    font-size: 16px !important;
    line-height: 1 !important;
    transition: all 0.2s ease !important;
}

#keywords-container span button:hover {
    background-color: #2b6cb0 !important;
    color: white !important;
}

/* 当没有关键词时的样式 */
#keywords-container:empty {
    min-height: 40px !important;
}

/* 确保在移动设备上也有良好的体验 */
@media (max-width: 640px) {
    #keywords-container {
        padding: 6px 8px !important;
    }
    
    #keyword-input {
        min-width: 150px !important;
        font-size: 13px !important;
    }
    
    #keywords-container span {
        font-size: 12px !important;
    }
}