/* ================================================================
   万年历查询 · 页面私有样式（calendar.css）
   ================================================================ */

.main {
    grid-template-columns: 520px minmax(0, 1fr);
}

@media (max-width: 900px) {
    .main {
        grid-template-columns: 1fr;
    }
}

.btn-today {
    justify-content: center;
    width: 100%;
}

#lunarYear,
#lunarMonth,
#lunarDay {
    padding-top: 9px;
    padding-bottom: 9px;
}

#lunarCalcBtn {
    display: none;
}

/* ---------- 月份导航 ---------- */
.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 0 2px 10px;
}

.cal-nav-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #e3e8ef;
    background: #fafbfc;
    color: #4285f4;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.cal-nav-btn:hover {
    background: #eaf2ff;
    border-color: #4285f4;
    box-shadow: 0 2px 6px rgba(66, 133, 244, 0.2);
}

.cal-title {
    flex: 1;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #4285f4;
    letter-spacing: 1px;
}

/* ---------- 整月日历网格 ----------
   星期表头与日期共用同一 7 列 grid，
   每格采用完全一致的外框/圆角/盒模型，保证星期与日期竖向一一对应 */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 10px;
}

.cal-head-cell,
.cal-cell {
    box-sizing: border-box;
    border: 1px solid #e8ecf1;
    border-radius: 8px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-head-cell {
    font-size: 13px;
    font-weight: 700;
    color: #6b7483;
    background: #f0f3f7;
    letter-spacing: 1px;
}

.cal-head-cell.sun,
.cal-head-cell.sat {
    color: #e6533c;
}

.cal-cell {
    position: relative;
    background: #fdfdfe;
    min-height: 62px;
    padding: 5px 3px;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s, background 0.15s;
    user-select: none;
}

.cal-cell:hover {
    border-color: #4285f4;
    background: #f3f8ff;
    box-shadow: 0 3px 8px rgba(66, 133, 244, 0.18);
    transform: translateY(-1px);
}

.cal-cell.blank {
    border-color: transparent;
    background: transparent;
    cursor: default;
    box-shadow: none;
    transform: none;
    min-height: 0;
}

.cal-cell .cal-day {
    font-size: 17px;
    font-weight: 600;
    color: #333;
    line-height: 1.1;
}

.cal-cell .cal-lunar {
    font-size: 12px;
    color: #8a8f98;
    line-height: 1.1;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-cell .cal-lunar.new-month {
    color: #e6533c;
    font-weight: 600;
}

.cal-cell .cal-mark {
    font-size: 11px;
    line-height: 1.1;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-cell .cal-mark-fest {
    color: #e6533c;
    font-weight: 600;
}

.cal-cell .cal-mark-jq {
    color: #4285f4;
}

/* 周末日期着色 */
.cal-cell.sun .cal-day,
.cal-cell.sat .cal-day {
    color: #e6533c;
}

/* 今天 */
.cal-cell.today {
    border-color: #4285f4;
    background: linear-gradient(180deg, #eaf2ff, #f6faff);
}

.cal-cell.today .cal-day {
    color: #4285f4;
    font-weight: 700;
}

.cal-cell.today::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4285f4;
    box-shadow: 0 1px 3px rgba(66, 133, 244, 0.4);
}

/* 已选中 */
.cal-cell.selected {
    border: 2px solid #f6b100;
    background: linear-gradient(180deg, #fff8e1, #fffcef);
    box-shadow: 0 2px 10px rgba(246, 177, 0, 0.22);
    padding-top: 4px;
    padding-bottom: 4px;
}

.cal-cell.selected .cal-day {
    color: #e6a400;
    font-weight: 700;
}

/* ---------- 图例 ---------- */
.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    justify-content: center;
    font-size: 11px;
    color: #8a8f98;
    padding: 0 2px 10px;
}

.cal-legend span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cal-legend .lg {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.cal-legend .lg-fest { background: #e6533c; }
.cal-legend .lg-jq { background: #4285f4; }
.cal-legend .lg-new { background: #e6533c; }
.cal-legend .lg-today { background: #4285f4; box-shadow: 0 0 0 2px #fff, 0 0 0 3px #4285f4; }
.cal-legend .lg-selected { background: #f6b100; box-shadow: 0 0 0 2px #fff, 0 0 0 3px #f6b100; }

/* ---------- 结果面板 ---------- */
.hero-result {
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 14px 16px;
    margin: 0 0 6px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.result-body .summary-row {
    align-items: flex-start;
}

.result-body .summary-row .item-name {
    flex-shrink: 0;
    white-space: nowrap;
}

.result-body .summary-row .item-value {
    max-width: 100%;
    text-align: right;
    font-weight: 500;
}

.result-body .summary-list .item-value {
    color: #4b5563;
}

@media (max-width: 600px) {
    .cal-nav-btn {
        width: 28px;
        height: 28px;
    }

    .cal-cell {
        min-height: 46px;
        padding: 4px 1px;
    }

    .cal-cell .cal-day {
        font-size: 14px;
    }

    .cal-cell .cal-lunar {
        font-size: 10px;
    }

    .cal-cell .cal-mark {
        font-size: 9px;
    }

    .cal-cell.selected {
        padding-top: 3px;
        padding-bottom: 3px;
    }

    .result-body .summary-row {
        flex-direction: column;
        align-items: stretch;
        gap: 3px;
    }

    .result-body .summary-row .item-value {
        text-align: left;
    }
}