/* 万年历页样式：全屏布局（无页面滚动条）
 * 结构：header / main(flex:1) / footer；main 内 = 左侧当月节日列表 + 右侧月历
 * 视觉：深色红金玻璃拟态，时尚卡片风格
 */
html, body {
    height: 100%;
    overflow: hidden;
}

body.calendar-body {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ===== 主体布局：全屏自适应（页头页脚之间），左侧 35% / 右侧 65% ===== */
.calendar-main {
    flex: 1;
    min-height: 0;
    display: flex;
    padding: 16px 20px;
}

.calendar-layout {
    display: flex;
    gap: 1.2rem;
    width: 100%;
    min-width: 0;
    height: 100%;
}

/* ===== 左侧：当月节日列表 ===== */
.calendar-side {
    flex: 0 0 30%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, rgba(30, 41, 59, 0.88), rgba(15, 23, 42, 0.94));
    border: 1px solid rgba(251, 191, 36, 0.22);
    border-radius: 1.4rem;
    padding: 1rem 0.8rem 0.8rem;
    backdrop-filter: blur(22px);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

/* 左侧顶部金色高光线 */
.calendar-side::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.7), transparent);
}

.side-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.3rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0.6rem;
}

.side-head-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.4));
}

.side-head-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: linear-gradient(120deg, #ffffff, var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--text-light);
}

.side-head-badge {
    margin-left: auto;
    font-size: 0.68rem;
    color: var(--accent-color);
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.35);
    padding: 0.12rem 0.5rem;
    border-radius: 9999px;
    white-space: nowrap;
}

/* 列表 */
.side-list {
    list-style: none;
    margin: 0;
    padding: 0.2rem 0.1rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.side-list::-webkit-scrollbar {
    width: 5px;
}
.side-list::-webkit-scrollbar-thumb {
    background: rgba(251, 191, 36, 0.3);
    border-radius: 9999px;
}
.side-list::-webkit-scrollbar-track {
    background: transparent;
}

.side-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.55rem;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    animation: sideIn 0.4s ease both;
}

.side-item:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(251, 191, 36, 0.45);
    transform: translateX(4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.side-item:active {
    transform: scale(0.98);
}

.side-item.today {
    background: linear-gradient(120deg, rgba(251, 191, 36, 0.16), rgba(220, 38, 38, 0.1));
    border-color: rgba(251, 191, 36, 0.5);
}

/* 日期文本（如 10月16日） */
.side-date {
    flex-shrink: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
}

.side-item.today .side-date {
    color: var(--accent-color);
}

.side-name {
    flex: 1;
    min-width: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.side-name.festival { color: #f87171; }
.side-name.jieqi    { color: var(--accent-color); }
.side-name.db       { color: #34d399; }

.side-cat {
    align-self: flex-start;
    font-size: 0.68rem;
    line-height: 1;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-muted);
}

.side-cat.festival { color: #f87171; border-color: rgba(220, 38, 38, 0.4); background: rgba(220, 38, 38, 0.1); }
.side-cat.jieqi    { color: var(--accent-color); border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.1); }
.side-cat.db       { color: #34d399; border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.1); }

.side-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 2rem 0;
}

/* 列表底部导航 */
.side-foot {
    display: flex;
    gap: 0.35rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 0.5rem;
}

.side-foot .btn {
    flex: 1;
    padding: 0.32rem 0.4rem;
    font-size: 0.72rem;
    text-align: center;
    cursor: pointer;
    user-select: none;
    border-radius: 9999px;
    white-space: nowrap;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.side-foot .btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.25);
}

@keyframes sideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ===== 右侧：月历卡片 ===== */
.calendar-card {
    flex: 1 1 70%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.92));
    border: 1px solid rgba(251, 191, 36, 0.22);
    border-radius: 1.5rem;
    padding: 1.1rem 1.2rem;
    backdrop-filter: blur(22px);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    position: relative;
}

/* 顶部金色高光线 */
.calendar-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.7), transparent);
}

/* 工具栏 */
.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.7rem;
}

.calendar-nav {
    display: flex;
    gap: 0.35rem;
}

.calendar-nav .btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.88rem;
    cursor: pointer;
    user-select: none;
    border-radius: 9999px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.calendar-nav .btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 16px rgba(251, 191, 36, 0.25);
    transform: translateY(-1px);
}

/* 标题区 */
.calendar-head {
    text-align: center;
    min-width: 0;
}

.calendar-title .title-big {
    display: block;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: linear-gradient(120deg, #ffffff, var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--text-light);
}

.calendar-title .title-sub {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
}

.calendar-stats {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 0.3rem;
}

.calendar-stats .stat {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.28rem;
}

.calendar-stats .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px currentColor;
}

.dot-festival { background: var(--primary-color); color: var(--primary-color); }
.dot-jieqi    { background: var(--accent-color); color: var(--accent-color); }
.dot-db       { background: #34d399; color: #34d399; }

/* 星期表头 */
.calendar-weekdays, .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.35rem;
}

.calendar-weekdays {
    margin-bottom: 0.35rem;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.3rem 0;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0.55rem;
    letter-spacing: 0.1em;
}

.calendar-weekdays span:nth-child(6),
.calendar-weekdays span:nth-child(7) {
    color: rgba(251, 191, 36, 0.75);
}

/* 日期网格：固定容器高度内均分行高，页面不产生滚动条 */
.calendar-grid {
    flex: 1;
    min-height: 0;
    grid-auto-rows: 1fr;
    overflow: hidden;
}

.calendar-day {
    min-height: 0;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.8rem;
    padding: 0.3rem 0.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
    animation: dayIn 0.45s ease both;
}

@keyframes dayIn {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.calendar-day:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(251, 191, 36, 0.55);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(251, 191, 36, 0.25);
    z-index: 2;
}

/* 列表悬停联动高亮 */
.calendar-day.linked {
    border-color: rgba(251, 191, 36, 0.8);
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.6), 0 0 18px rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.1);
}

.calendar-day.today {
    border-color: var(--accent-color);
    background: linear-gradient(145deg, rgba(251, 191, 36, 0.18), rgba(220, 38, 38, 0.12));
    box-shadow: 0 0 0 1px var(--accent-color), 0 6px 22px rgba(251, 191, 36, 0.22);
}

/* 今天右上角"今"徽标 */
.calendar-day.today::after {
    content: '今';
    position: absolute;
    top: 0.22rem;
    right: 0.3rem;
    font-size: 0.52rem;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-color), #ef4444);
    padding: 0.05rem 0.26rem;
    border-radius: 9999px;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.45);
}

.calendar-day.weekend .day-solar {
    color: rgba(251, 191, 36, 0.85);
}

.calendar-day.blank {
    background: transparent;
    border-color: transparent;
    cursor: default;
    animation: none;
}

/* 外月补位格（灰色，点击跳转对应月份） */
.calendar-day.out-month {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
}

.calendar-day.out-month .day-solar {
    color: rgba(156, 163, 175, 0.45);
}

.calendar-day.out-month .day-lunar {
    color: rgba(156, 163, 175, 0.3);
}

.calendar-day.out-month:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(251, 191, 36, 0.35);
    transform: translateY(-3px);
}

.calendar-day.out-month:hover .day-solar {
    color: rgba(251, 191, 36, 0.6);
}

.day-solar {
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--text-light);
    line-height: 1.2;
}

.calendar-day.today .day-solar {
    color: var(--accent-color);
}

.day-lunar {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: 0.05rem;
    line-height: 1.2;
}

/* 标记行（em 胶囊：节气金 / 节日红 / 纪念日青 / 溢出计数） */
.day-marks {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.14rem;
    max-width: 100%;
}

.day-marks em {
    font-style: normal;
    font-size: 0.72rem;
    line-height: 1.25;
    padding: 0.12rem 0.36rem;
    border-radius: 9999px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.day-marks em.jieqi {
    color: var(--accent-color);
    border-color: rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.1);
}

.day-marks em.festival {
    color: #f87171;
    border-color: rgba(220, 38, 38, 0.4);
    background: rgba(220, 38, 38, 0.12);
}

.day-marks em.db {
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(52, 211, 153, 0.1);
}

.day-marks em.more {
    color: var(--text-muted);
    border-color: var(--border-color);
    background: transparent;
}

/* ===== 悬停提示气泡 ===== */
.day-tip {
    display: none;
    position: fixed;
    z-index: 1200;
    max-width: 320px;
    padding: 0.8rem 1rem;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 0.8rem;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    pointer-events: none;
}

.day-tip .tip-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 0.35rem;
}

.day-tip .tip-marks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.day-tip .tip-marks span {
    font-size: 0.82rem;
    color: var(--accent-color);
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 9999px;
    padding: 0.12rem 0.5rem;
}

/* ===== 详情面板 ===== */
.calendar-detail-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.calendar-detail-overlay.show {
    display: flex;
}

.calendar-detail {
    width: 100%;
    max-width: 440px;
    max-height: 88vh;
    overflow-y: auto;
    background: linear-gradient(160deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.97));
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-radius: 1.3rem;
    padding: 1.25rem;
    backdrop-filter: blur(22px);
    position: relative;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: panelIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes panelIn {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 详情头部渐变条 */
.detail-head {
    background: linear-gradient(120deg, rgba(220, 38, 38, 0.22), rgba(251, 191, 36, 0.18));
    margin: -1.25rem -1.25rem 1rem -1.25rem;
    padding: 1.4rem 1.25rem 1rem;
    border-radius: 1.3rem 1.3rem 0 0;
    border-bottom: 1px solid rgba(251, 191, 36, 0.2);
}

.detail-close {
    position: absolute;
    top: 0.8rem;
    right: 0.9rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 1rem;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 9999px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 2;
}

.detail-close:hover {
    color: #ffffff;
    border-color: rgba(251, 191, 36, 0.5);
    transform: rotate(90deg);
}

.detail-title {
    font-size: 1.25rem;
    font-weight: 800;
}

.detail-sub {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.detail-section {
    margin-bottom: 0.6rem;
    padding: 0.55rem 0.7rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 0.7rem;
}

.detail-label {
    font-size: 0.72rem;
    color: var(--accent-color);
    margin-bottom: 0.25rem;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.detail-value {
    font-size: 0.9rem;
    line-height: 1.65;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.detail-tags .tag {
    font-size: 0.72rem;
    padding: 0.2rem 0.55rem;
    cursor: default;
    border-radius: 9999px;
    background: rgba(220, 38, 38, 0.14);
    border: 1px solid rgba(220, 38, 38, 0.4);
    color: #f87171;
}

.detail-tags .tag.jieqi-tag {
    border-color: rgba(251, 191, 36, 0.4);
    color: var(--accent-color);
    background: rgba(251, 191, 36, 0.1);
}

.detail-loading {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 2.5rem 0;
}

/* ===== 响应式：窄屏恢复滚动布局，单列堆叠 ===== */
@media (max-width: 1100px) {
    html, body {
        height: auto;
        overflow: auto;
    }
    body.calendar-body {
        overflow-y: auto;
    }
    .calendar-main {
        padding: 1rem;
        flex-direction: column;
    }
    .calendar-layout {
        width: 100%;
        flex-direction: column;
        gap: 1rem;
    }
    .calendar-side {
        width: 100%;
        max-height: 320px;
    }
    .calendar-card {
        min-height: 520px;
    }
}

@media (max-width: 640px) {
    .calendar-toolbar { flex-wrap: wrap; justify-content: center; }
    .calendar-title .title-big { font-size: 1.2rem; }
    .calendar-day { border-radius: 0.6rem; padding: 0.25rem 0.15rem; }
    .day-solar { font-size: 1rem; }
    .day-lunar { font-size: 0.64rem; }
    .day-marks em { font-size: 0.62rem; padding: 0.08rem 0.28rem; }
}
