/*!
 * 老黄历查询系统 - 主样式表
 * Version: 1.0.0
 */

/* ===== 基础样式 ===== */
:root {
    --primary-color: #c41e3a;
    --secondary-color: #d4a017;
    --bg-color: #f5f0e6;
    --text-color: #333;
    --text-light: #666;
    --border-color: #d4a017;
    --gold-color: #d4a017;
    --lucky-color: #c41e3a;
    --unlucky-color: #666;
    --card-bg: #fff;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== 容器 ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== 头部样式 ===== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #a01830 100%);
    color: #fff;
    padding: 20px 0;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 36px;
}

.logo h1 {
    font-size: 28px;
    font-weight: bold;
}

.nav {
    display: flex;
    gap: 20px;
}

.nav a {
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background 0.3s;
}

.nav a:hover {
    background: rgba(255,255,255,0.2);
    text-decoration: none;
}

/* ===== 主内容区 ===== */
.main {
    padding: 30px 0;
}

.section {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 20px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--gold-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* ===== 日期选择器 ===== */
.date-picker {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #faf7f0;
    border-radius: 8px;
    margin-bottom: 25px;
}

.date-picker label {
    font-weight: bold;
    color: var(--text-color);
}

.date-picker select,
.date-picker input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
}

.date-picker button {
    padding: 8px 20px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.date-picker button:hover {
    background: #a01830;
}

/* ===== 今日黄历卡片 ===== */
.today-calendar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.calendar-main {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #fff8e7 0%, #fff 100%);
    border: 2px solid var(--gold-color);
    border-radius: 8px;
}

.solar-date {
    font-size: 48px;
    font-weight: bold;
    color: var(--primary-color);
}

.week-day {
    font-size: 20px;
    color: var(--text-light);
    margin-top: 5px;
}

.lunar-date {
    font-size: 24px;
    color: var(--text-color);
    margin-top: 15px;
}

.ganzhi-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--gold-color);
}

.ganzhi-item {
    text-align: center;
}

.ganzhi-label {
    font-size: 14px;
    color: var(--text-light);
}

.ganzhi-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

/* ===== 宜忌展示 ===== */
.yiji-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.yi-section,
.ji-section {
    padding: 20px;
    border-radius: 8px;
}

.yi-section {
    background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
    border: 1px solid #ffcccc;
}

.ji-section {
    background: linear-gradient(135deg, #f5f5f5 0%, #fff 100%);
    border: 1px solid #ddd;
}

.yi-section h3 {
    color: var(--lucky-color);
}

.ji-section h3 {
    color: var(--unlucky-color);
}

.yi-list,
.ji-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.yi-item,
.ji-item {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.yi-item {
    background: var(--lucky-color);
    color: #fff;
}

.ji-item {
    background: var(--unlucky-color);
    color: #fff;
}

/* ===== 详细信息 ===== */
.detail-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.detail-item {
    text-align: center;
    padding: 15px;
    background: #faf7f0;
    border-radius: 8px;
}

.detail-label {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 5px;
}

.detail-value {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-color);
}

/* ===== 冲煞信息 ===== */
.chong-info {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
    padding: 20px;
    background: #faf7f0;
    border-radius: 8px;
}

.chong-item,
.sha-item {
    text-align: center;
}

.chong-label,
.sha-label {
    font-size: 14px;
    color: var(--text-light);
}

.chong-value,
.sha-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

/* ===== 吉时凶时 ===== */
.time-section {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.lucky-time,
.unlucky-time {
    flex: 1;
    padding: 20px;
    border-radius: 8px;
}

.lucky-time {
    background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
    border: 1px solid #ffcccc;
}

.unlucky-time {
    background: linear-gradient(135deg, #f5f5f5 0%, #fff 100%);
    border: 1px solid #ddd;
}

.time-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.time-item {
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 16px;
}

.lucky-time .time-item {
    background: var(--lucky-color);
    color: #fff;
}

.unlucky-time .time-item {
    background: var(--unlucky-color);
    color: #fff;
}

/* ===== 方位信息 ===== */
.position-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.position-item {
    text-align: center;
    padding: 20px;
    background: #faf7f0;
    border-radius: 8px;
}

.position-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.position-name {
    font-size: 14px;
    color: var(--text-light);
}

.position-value {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 5px;
}

/* ===== 日历视图 ===== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.calendar-header-cell {
    text-align: center;
    padding: 10px;
    font-weight: bold;
    color: var(--text-light);
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.calendar-day:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.calendar-day.today {
    background: var(--primary-color);
    color: #fff;
}

.calendar-day.other-month {
    opacity: 0.5;
}

.calendar-day.has-jiri {
    border-color: var(--gold-color);
    background: #fffbe6;
}

.day-number {
    font-size: 18px;
    font-weight: bold;
}

.day-lunar {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 5px;
}

/* ===== 生肖运势 ===== */
.shengxiao-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
}

.shengxiao-item {
    text-align: center;
    padding: 15px;
    background: #faf7f0;
    border-radius: 8px;
}

.shengxiao-icon {
    font-size: 32px;
}

.shengxiao-name {
    font-size: 16px;
    font-weight: bold;
    margin-top: 5px;
}

.shengxiao-level {
    font-size: 14px;
    margin-top: 5px;
}

.shengxiao-level.good {
    color: var(--lucky-color);
}

.shengxiao-level.bad {
    color: var(--unlucky-color);
}

/* ===== 表单样式 ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.form-group input,
.form-group select {
    width: 100%;
    max-width: 300px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
}

.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background: #a01830;
}

.btn-secondary {
    background: var(--secondary-color);
    color: #fff;
}

/* ===== 转换工具 ===== */
.converter-result {
    padding: 20px;
    background: #faf7f0;
    border-radius: 8px;
    margin-top: 20px;
}

.converter-result .label {
    font-size: 14px;
    color: var(--text-light);
}

.converter-result .value {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 5px;
}

/* ===== 响应式布局 ===== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .today-calendar {
        grid-template-columns: 1fr;
    }
    
    .yiji-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .position-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .shengxiao-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .time-section {
        flex-direction: column;
    }
    
    .chong-info {
        flex-direction: column;
        gap: 20px;
    }
    
    .ganzhi-info {
        flex-direction: column;
        gap: 15px;
    }
}

/* ===== 页脚 ===== */
.footer {
    background: var(--text-color);
    color: #fff;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

.footer a {
    color: #fff;
}

/* ===== 加载动画 ===== */
.loading {
    text-align: center;
    padding: 40px;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--gold-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

/* ===== 工具提示 ===== */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background: var(--text-color);
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}