/* 论命页面专用样式 */

/* 表单容器 */
.lunming-form-container {
    background-color: rgba(255, 255, 230, 0.9);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 20px;
    margin: 20px 0;
}

.lunming-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* 表单分节样式 */
.form-section {
    background-color: rgba(255, 253, 240, 0.7);
    border: 1px solid #e0d6b8;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 2px 6px rgba(139, 69, 19, 0.1);
}

.section-title {
    color: #8B4513;
    font-size: 1.2rem;
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0d6b8;
    text-align: center;
}

/* 表单组样式 */
.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.form-group label {
    font-weight: bold;
    margin-right: 10px;
    color: #5d4037;
    min-width: 60px;
}

/* 媒体查询适配桌面端 */
@media (min-width: 481px) {
    .form-group {
        flex-wrap: nowrap;
    }
    
    .form-group label {
        flex: 0 0 80px;
        text-align: right;
    }
}

/* 输入框样式 */
.ancient-input {
    padding: 8px 12px;
    border: 1px solid #d9ccb3;
    border-radius: 4px;
    font-size: 1rem;
    background-color: #fffef5;
    color: #5d4037;
    flex: 1;
}

/* 姓名输入框宽度限制 */
.name-input {
    max-width: 150px;
    margin-right: 15px;
}

.ancient-input:focus {
    outline: none;
    border-color: #8B4513;
    box-shadow: 0 0 0 2px rgba(139, 69, 19, 0.2);
}

/* 性别选择样式 */
.gender-selection {
    display: flex;
    margin-left: 0;
}

.gender-label {
    display: flex;
    align-items: center;
    margin-right: 15px;
    cursor: pointer;
    user-select: none;
    color: #5d4037;
}

.gender-label input[type="radio"] {
    margin-right: 5px;
}

.gender-text {
    font-size: 1rem;
}

/* 日期输入区域样式 */
.date-input-container {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.date-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.date-label {
    font-weight: bold;
    color: #5d4037;
}

.date-input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.date-field {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 120px;
    max-width: 200px;
}

.lunar-year-field {
    min-width: 150px;
    max-width: 180px;
}

/* 日期选择器样式 */
.date-picker {
    padding: 8px 12px;
    border: 1px solid #d9ccb3;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    flex: 1;
    min-width: 120px;
    background-color: #fffef5;
}

/* 农历年份输入框样式 */
.lunar-year-input {
    width: 80px;
    padding-right: 85px; /* 为干支文本留出空间 */
    text-align: left;
    background-color: #fffef5;
}

.lunar-year-input-container {
    position: relative;
    display: inline-flex;
    flex: 1;
}

/* 农历日期选择器样式 */
.lunar-date-select {
    padding: 8px 12px;
    border: 1px solid #d9ccb3;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    flex: 1;
    min-width: 100px;
    background-color: #fffef5;
}

/* 干支文本样式 */
.lunar-year-ganzhi {
    position: absolute;
    right: 35px; /* 为下拉图标留出空间 */
    top: 50%;
    transform: translateY(-50%);
    color: #8B4513;
    font-size: 0.9em;
    pointer-events: none; /* 防止干扰输入 */
}

/* 日期选择标签页 */
.date-tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #d9ccb3;
}

.date-tab {
    padding: 8px 15px;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    background-color: #f5f5dc;
    color: #5d4037;
    margin-right: 2px;
    transition: all 0.2s;
}

.date-tab:hover {
    background-color: #f0e6cc;
}

.date-tab.active {
    background-color: #fffef5;
    border-color: #d9ccb3;
    color: #8B4513;
    font-weight: bold;
    position: relative;
    top: 1px;
}

/* 时辰选择器 */
.time-select {
    width: 100%;
    max-width: 250px;
}

/* 年份下拉列表 */
.year-dropdown {
    width: 300px; /* 增加宽度 */
    left: 50%;
    top: 50%;  /* 居中显示在屏幕中间 */
    transform: translate(-50%, -50%); /* 水平垂直居中 */
    max-height: 320px; /* 增加高度，显示更多内容 */
    overflow-y: auto;
    position: fixed; /* 改为固定定位，避免被遮挡 */
    background-color: rgba(255, 254, 245, 0.05); /* 半透明背景 */
    border: 1px solid rgba(217, 204, 179, 0.8); /* 半透明边框 */
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2); /* 增强阴影效果 */
    padding: 15px; /* 增加内边距 */
    display: none;
    z-index: 1000;
    backdrop-filter: blur(5px); /* 添加模糊效果 */
}

/* 年份下拉框标题 */
.year-dropdown::before {
    content: "选择年份";
    display: block;
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: #8B4513;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(217, 204, 179, 0.8);
}

/* 年份选项按钮样式 */
.year-option {
    padding: 10px 5px;
    font-size: 1rem;
    text-align: center;
    background-color: rgba(245, 245, 220, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.year-option:hover {
    background-color: rgba(235, 230, 197, 0.9);
    transform: scale(1.05);
    border-color: #8B4513;
}

/* 年份选择器遮罩层 */
.year-dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 999;
    display: none;
}

/* 年份选项网格布局 */
.year-dropdown-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-bottom: 5px;
}

/* 年份行样式 */
.year-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 8px 0;
}

/* 年份区块标题样式 */
.year-section-title {
    font-weight: bold;
    padding: 8px 0;
    color: #8B4513;
    text-align: center;
    border-bottom: 2px solid rgba(217, 204, 179, 0.8);
    margin-bottom: 8px;
    font-size: 1.1rem;
    background-color: rgba(249, 244, 230, 0.6);
    border-radius: 4px;
}

/* 年份区块样式 */
.year-section {
    padding: 8px 0;
    border-bottom: 1px dashed rgba(224, 224, 224, 0.7);
    margin-bottom: 5px;
}

.year-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* 当前年份高亮样式 */
.year-option.current-year {
    background-color: rgba(150, 0, 0, 0.85);
    color: white;
    font-weight: bold;
    box-shadow: 0 0 4px rgba(139, 69, 19, 0.5);
}

/* 选中年份样式 */
.year-option.selected {

    border: 1px solid #8B4513;
    font-weight: bold;
}

/* 高亮动画 */
@keyframes highlight {
    0% { background-color: #f5f5dc; }
    50% { background-color: #8B4513; color: white; }
    100% { background-color: #f0e6dc; }
}

/* 关闭按钮 */
.year-dropdown-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(139, 69, 19, 0.1);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    color: #8B4513;
    transition: all 0.2s;
}

.year-dropdown-close:hover {
    background-color: rgba(139, 69, 19, 0.2);
    transform: rotate(90deg);
}

/* 按钮容器 */
.form-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

/* 添加主按钮样式 */
.primary-btn {
    background-color: #8B4513;
    color: #fff;
}

.primary-btn:hover {
    background-color: #a05419;
}

.secondary-btn {
    background-color: #f5f5dc;
    color: #8B4513;
}

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

/* 加载动画 */
.loading-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 30px 0;
}

.loading-text {
    font-size: 18px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(139, 19, 19, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 分析结果样式 */
.analysis-content {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 15px;
    color: #333;
    text-align: left;
    white-space: pre-wrap; /* 保留格式 */
}

.analysis-title {
    margin: 16px 0 8px 0;
    color: #8b4513;
    font-weight: bold;
    border-bottom: 1px solid rgba(139, 69, 19, 0.2);
    padding-bottom: 5px;
}

.analysis-list-item {
    margin-bottom: 10px;
    padding-left: 24px;
    position: relative;
    line-height: 1.6;
    color: #333;
    font-size: 16px;
}

.analysis-list-item::before {
    content: "•";
    color: #8b4513;
    position: absolute;
    left: 8px;
    font-size: 18px;
    font-weight: bold;
}

/* 加粗文本样式 */
.analysis-paragraph strong,
.analysis-list-item strong {
    font-weight: bold;
    color: #5d2906;
}

.analysis-error {
    color: #d32f2f;
    background-color: #ffebee;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    font-weight: bold;
}

/* 结果容器样式 */
#analysis-content {
    padding: 15px;
    background-color: rgba(255, 253, 245, 0.9);
    border-radius: 8px;
    border: 1px solid #d4a76a;
    box-shadow: 0 2px 10px rgba(139, 69, 19, 0.1);
    max-height: 600px;
    overflow-y: auto;
    line-height: 1.6;
    margin-top: 20px;
}

/* 标题样式 */
.analysis-title {
    margin: 16px 0 8px 0;
    color: #8b4513;
    font-weight: bold;
    border-bottom: 1px solid rgba(139, 69, 19, 0.2);
    padding-bottom: 5px;
}

/* 不同级别标题的样式 */
.analysis-title-h1 {
    font-size: 24px;
    color: #5d2906;
}

.analysis-title-h2 {
    font-size: 22px;
    color: #6b3009;
}

.analysis-title-h3 {
    font-size: 20px;
    color: #8b4513;
}

.analysis-title-h4, .analysis-title-h5, .analysis-title-h6 {
    font-size: 18px;
    color: #a0522d;
}

/* 段落样式 */
.analysis-paragraph {
    margin-bottom: 12px;
    text-align: justify;
    color: #333;
    font-size: 16px;
    line-height: 1.6;
}

/* 列表样式 */
.analysis-list {
    margin: 10px 0;
    padding-left: 20px;
}

.analysis-list-item {
    margin-bottom: 8px;
    position: relative;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#analysis-content > * {
    animation: fadeIn 0.3s ease-in-out;
}

/* 加载容器样式 */
.loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    margin-bottom: 15px;
    background-color: rgba(255, 248, 225, 0.7);
    border-radius: 8px;
    border: 1px dashed #d4a76a;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #8b4513;
    border-top: 3px solid transparent;
    border-radius: 50%;
    margin-right: 10px;
    animation: spin 1s linear infinite;
}

/* 字符显示动画效果 */
@keyframes characterAppear {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#analysis-content > * {
    position: relative;
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 响应式样式调整 */
@media screen and (max-width: 480px) {
    #analysis-content {
        padding: 12px;
        max-height: 500px;
    }
    
    .analysis-title-h1 {
        font-size: 22px;
    }
    
    .analysis-title-h2 {
        font-size: 20px;
    }
    
    .analysis-title-h3, .analysis-title-h4, .analysis-title-h5, .analysis-title-h6 {
        font-size: 18px;
    }
    
    .analysis-paragraph {
        font-size: 15px;
    }
}

/* 移动端适配 */
@media (max-width: 480px) {
    .lunming-form-container {
        padding: 10px;
    }
    
    .form-section {
        padding: 12px;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .ancient-btn {
        width: 80%;
        margin-bottom: 10px;
    }
    
    .date-field {
        /* flex-direction: column; */
        align-items: flex-start;
        width: 100%;
        max-width: none;
    }
    
    .name-input {
        max-width: none;
        margin-bottom: 10px;
    }
    
    .lunar-date-select, .date-picker {
        height: auto;
        width: 100%;
    }
    
    .year-dropdown {
        width: 100%;
    }
}

/* 年份选择器图标 */
.year-picker-icon {
    position: absolute;
    right: 3px;
    width: 16px;
    height: 16px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #8B4513;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.year-picker-icon:hover {
    transform: translateY(-50%) scale(1.2);
}
.inline-status {
    min-height: 1.5rem;
    margin-top: 12px;
    text-align: center;
}

.inline-status[data-type="error"] { color: #8f1d1d; }
.inline-status[data-type="success"] { color: #2f6b3c; }
.location-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; }
.setting-toggle { display: flex; gap: 8px; align-items: center; margin: 12px 0; }
.chart-summary, .analysis-content { white-space: pre-wrap; line-height: 1.8; }
.chart-summary { border-bottom: 1px solid rgba(92, 49, 20, 0.3); padding: 12px 0; }
.responsible-use-notice { color: #66584b; font-size: 0.9rem; }

@media (max-width: 480px) {
    .location-fields { grid-template-columns: 1fr; }
}
/* 结构化命书 */
.result-container {
    margin-top: 32px;
}

.chart-summary {
    padding: 24px 10px 22px;
    border-top: 1px solid rgba(139, 69, 19, 0.35);
    border-bottom: 1px solid rgba(139, 69, 19, 0.35);
    white-space: normal;
}

.chart-heading {
    text-align: center;
    margin-bottom: 20px;
}

.report-kicker {
    display: block;
    color: #9a341f;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0;
    margin-bottom: 5px;
}

.chart-title {
    color: #5d2906;
    font-size: 1.45rem;
    font-weight: 600;
    margin: 0;
}

.pillar-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 720px;
    margin: 0 auto;
}

.pillar-item {
    min-width: 0;
    padding: 8px 14px;
    text-align: center;
    border-left: 1px solid rgba(139, 69, 19, 0.22);
}

.pillar-item:first-child {
    border-left: 0;
}

.pillar-label {
    display: block;
    color: #756354;
    font-size: 0.82rem;
    margin-bottom: 4px;
}

.pillar-value {
    color: #7f1d1d;
    font-size: 1.35rem;
    font-weight: 600;
    white-space: nowrap;
}

.chart-facts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 28px;
    margin-top: 18px;
}

.chart-fact {
    color: #756354;
    margin: 0;
}

.chart-fact span {
    margin-right: 8px;
}

.chart-fact strong {
    color: #44362c;
    font-weight: 600;
}

#analysis-content.analysis-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 34px;
    max-height: none;
    overflow: visible;
    margin-top: 0;
    padding: 0 10px;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    white-space: normal;
}

.report-overview,
.report-actions,
.report-closing,
.legacy-report {
    grid-column: 1 / -1;
}

.report-overview {
    padding: 28px 0 24px;
    text-align: center;
    border-bottom: 1px solid rgba(139, 69, 19, 0.24);
}

.report-summary {
    max-width: 780px;
    margin: 0 auto;
    color: #3f342b;
    font-size: 1.05rem;
    line-height: 1.9;
    text-align: justify;
}

.report-keywords {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 14px;
    color: #8b4513;
    font-weight: 600;
}

.report-keyword + .report-keyword::before {
    content: "·";
    padding: 0 12px;
    color: #c28b55;
}

.report-section {
    position: relative;
    padding: 24px 0 20px 18px;
    border-bottom: 1px solid rgba(139, 69, 19, 0.2);
}

.report-section::before {
    content: "";
    position: absolute;
    top: 29px;
    left: 0;
    width: 3px;
    height: 22px;
    background: #9a341f;
}

.report-section-title {
    margin: 0 0 15px;
    color: #6b3009;
    font-size: 1.2rem;
    font-weight: 600;
}

.report-point {
    margin-bottom: 14px;
}

.report-point:last-child {
    margin-bottom: 0;
}

.report-point-label {
    margin: 0 0 4px;
    color: #8b4513;
    font-size: 0.92rem;
    font-weight: 700;
}

.report-point-text,
.action-text {
    margin: 0;
    color: #443b34;
    font-size: 0.98rem;
    line-height: 1.8;
    text-align: justify;
}

.report-actions {
    margin-top: 26px;
    padding: 24px 0;
    border-top: 1px solid rgba(139, 69, 19, 0.34);
    border-bottom: 1px solid rgba(139, 69, 19, 0.34);
}

.action-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 32px;
}

.action-item {
    min-width: 0;
}

.action-title {
    display: block;
    margin-bottom: 5px;
    color: #7f1d1d;
    font-size: 0.95rem;
}

.report-closing {
    max-width: 720px;
    margin: 24px auto 4px;
    color: #6b5848;
    font-size: 0.96rem;
    line-height: 1.8;
    text-align: center;
}

.legacy-report {
    padding: 24px 0;
    color: #443b34;
    line-height: 1.8;
    white-space: pre-wrap;
}

.report-reveal {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 280ms ease, transform 280ms ease;
}

.report-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .report-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

@media (max-width: 720px) {
    .pillar-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 12px;
    }

    .pillar-item:nth-child(3) {
        border-left: 0;
    }

    #analysis-content.analysis-content {
        grid-template-columns: 1fr;
        padding: 0 4px;
    }

    .report-overview,
    .report-actions,
    .report-closing,
    .legacy-report {
        grid-column: auto;
    }

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