/* style.css - 黄历查询系统样式表 */
/* ==================== 基础变量与全局样式 ==================== */
:root {
    --primary-color: #8B4513;
    --secondary-color: #F5DEB3;
    --accent-color: #D2691E;
    --text-color: #333;
    --light-color: #FFF8DC;
    --success-color: #4CAF50;
    --warning-color: #F44336;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "SimHei", sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #fdf6e3 0%, #f5e6ca 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(139, 69, 19, 0.2);
    overflow: hidden;
    border: 1px solid #e0c9a6;
}

/* ==================== 页眉样式 ==================== */
.header {
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    color: white;
    padding: 25px 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ==================== 主要内容区域 ==================== */
.main-content {
    padding: 30px;
}

/* 查询区域 */
.query-section {
    background-color: var(--light-color);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px dashed var(--accent-color);
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1rem;
}

input[type="date"],
input[type="text"][readonly].date-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #d4a574;
    border-radius: 8px;
    font-size: 1.1rem;
    background-color: white;
    transition: all 0.3s;
    cursor: pointer;
}

input[type="date"]:focus,
input[type="text"][readonly].date-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.2);
}

/* 查询按钮 */
.btn {
    display: inline-block;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    font-weight: bold;
    letter-spacing: 2px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 15px rgba(139, 69, 19, 0.3);
}

.btn:active {
    transform: translateY(-1px);
}

/* ==================== 加载状态 ==================== */
.loading {
    display: none;
    text-align: center;
    padding: 30px;
    color: var(--accent-color);
}

.loading i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    animation: spin 1.5s linear infinite;
}

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

/* ==================== 结果区域 ==================== */
.result-section {
    display: none;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    text-align: center;
    margin-bottom: 20px;
}

.result-header h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.result-item {
    background-color: var(--light-color);
    border-radius: 8px;
    padding: 20px;
    border-left: 5px solid var(--accent-color);
}

.result-item h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-item p {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
}

/* ==================== 移动端响应式样式 ==================== */
/*@media (max-width: 768px) {
    /* ... 其他现有样式保持不变 ... */

    /* 针对“生肖”结果项的特殊优化 */
    /* 方法1：确保文本可以正常换行（推荐） */
 /*   .result-item p {
        word-wrap: break-word; /* 允许长单词或URL换行 */
/*        overflow-wrap: break-word; /* 更现代的属性，效果类似 */
 /*       white-space: normal !important; /* 强制允许换行 */
/*    }
*/
    /* 方法2：如果只想针对“生肖”项调整，可以更精确 */
   /* .result-item:has(p:contains("（旧算法")) p {
        font-size: 1.1rem; /* 稍微减小字体以确保一行能容纳更多字 */
/*        line-height: 1.4;
        white-space: normal;
    }
*/
    /* 方法3：为所有可能包含长文本的字段添加最小高度，避免布局错乱 */
 /*   .result-item {
        min-height: 60px; /* 确保有足够高度显示两行文本 */
  /*      display: flex;
        flex-direction: column;
        justify-content: center; /* 垂直居中 */
/*    }
*/
/*    .result-item p {
        /* 移除可能限制高度的固定高度设置 */
/*        height: auto !important;
        min-height: 24px;
    }
}
*/

/* 宜忌区域 */
.yi-ji-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.yi-section, .ji-section {
    background-color: var(--light-color);
    border-radius: 8px;
    padding: 20px;
}

.yi-section {
    border-top: 5px solid var(--success-color);
}

.ji-section {
    border-top: 5px solid var(--warning-color);
}

.yi-section h3, .ji-section h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.yi-list, .ji-list {
    line-height: 2;
    font-size: 1.1rem;
}

/* 宜忌列表项样式 */
.yi-list div, .ji-list div {
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.yi-list div {
    background-color: rgba(76, 175, 80, 0.1);
    border-left: 4px solid var(--success-color);
}

.ji-list div {
    background-color: rgba(244, 67, 54, 0.1);
    border-left: 4px solid var(--warning-color);
}

.yi-list i { color: var(--success-color); }
.ji-list i { color: var(--warning-color); }

.no-data {
    color: #666;
    font-style: italic;
    padding: 15px;
    text-align: center;
}

/* ==================== 错误区域 ==================== */
.error-section {
    display: none;
    background-color: #ffebee;
    border-radius: 10px;
    padding: 30px;
    margin-top: 20px;
    text-align: center;
    border: 2px solid #f44336;
}

.error-section i {
    font-size: 3rem;
    color: #f44336;
    margin-bottom: 20px;
}

/* ==================== 页脚 ==================== */
.footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid #eee;
    margin-top: 30px;
}

/* ==================== 移动端响应式样式 ==================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
        background: #f5e6ca;
    }

    .container {
        border-radius: 10px;
        box-shadow: 0 5px 15px rgba(139, 69, 19, 0.15);
    }

    .header {
        padding: 20px 15px;
    }

    .header h1 {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }

    .header p {
        font-size: 1rem;
    }

    /* 主要内容区域优化 */
    .main-content {
        padding: 20px 15px;
    }

    .query-section {
        padding: 20px;
        text-align: center;
        margin-bottom: 25px;
    }

    .form-group {
        margin-bottom: 25px;
        text-align: center;
    }

    .form-group label {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }

    /* 日期输入框优化（重点：居中显示） */
    #queryDate {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
        display: block;
        padding: 16px;
        font-size: 18px;
        text-align: center;
        border-radius: 8px;
        border: 2px solid #d4a574;
        background-color: #fff;
        -webkit-appearance: none;
        appearance: none;
    }

    #queryDate:focus {
        border-color: var(--primary-color);
        outline: none;
        box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.2);
    }

    /* iOS Safari 特别优化 */
    @supports (-webkit-touch-callout: none) {
        #queryDate {
            font-size: 18px;
            line-height: 1.4;
        }
    }

    /* 查询按钮优化 */
    .btn {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
        display: block;
        padding: 18px;
        font-size: 1.2rem;
        border-radius: 8px;
    }

    /* 结果区域优化 */
    .result-header {
        padding: 15px;
        margin-bottom: 15px;
    }

    .result-header h2 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }

    .result-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }

    .yi-ji-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .yi-section, .ji-section {
        padding: 15px;
    }

    /* 增强移动端触摸体验 */
    .btn, #queryDate {
        min-height: 50px;
    }

    /* 调整文字大小 */
    .result-item p, .yi-list, .ji-list {
        font-size: 1.1rem;
        line-height: 1.5;
    }
    
    /* 图标与文字间距 */
    .form-group label i {
        margin-right: 8px;
    }
}

/* 针对超小屏幕（如iPhone SE）的额外优化 */
@media (max-width: 375px) {
    .header h1 {
        font-size: 1.6rem;
    }
    
    #queryDate, .btn {
        max-width: 100%;
    }
    
    .result-item {
        padding: 15px;
    }
}