/* ======================================================================
 *  老黄历 · 今日宜忌 /tool/chinese-almanac
 *  依赖 home.css 全局变量 + tool-detail.css 公共类，支持黑夜模式
 * ====================================================================== */

[hidden] { display: none !important; }

/* ---------- 日期切换条 ---------- */
.alm-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.alm-nav {
    height: 38px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--c-text-sub);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 11px;
    cursor: pointer;
    transition: all 0.16s ease;
}
.alm-nav:hover { color: var(--c-primary); border-color: var(--c-primary); }
.alm-nav:disabled { opacity: 0.45; cursor: not-allowed; }
.alm-nav:disabled:hover { color: var(--c-text-sub); border-color: var(--c-border); }
.alm-nav-today { color: var(--c-primary); border-color: var(--c-primary); background: var(--c-primary-soft); }
.alm-date-input {
    height: 38px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--c-text);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 11px;
    outline: none;
}
.alm-date-input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.alm-bar-tip { font-size: 12px; color: var(--c-text-muted); margin-left: auto; }

/* ---------- 日历主区 ---------- */
.alm-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 18px;
    padding: 26px;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(122, 92, 214, 0.12), rgba(214, 92, 140, 0.08));
    border: 1px solid rgba(122, 92, 214, 0.26);
    box-shadow: var(--shadow-sm);
}
.alm-solar-date {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--c-text);
}
.alm-solar-extra { font-size: 13px; color: var(--c-text-sub); margin-top: 5px; }
.alm-flag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 800;
    color: #fff;
    background: #7a5cd6;
}
.alm-lunar-date {
    margin-top: 14px;
    font-size: 20px;
    font-weight: 800;
    color: #6b46c1;
}
.alm-lunar-extra { font-size: 12.5px; color: var(--c-text-sub); margin-top: 5px; }
.alm-fest { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.alm-fest span.alm-fest {
    padding: 2px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    color: #c2185b;
    background: rgba(214, 92, 140, 0.14);
    border: 1px solid rgba(214, 92, 140, 0.3);
}
.alm-muted { font-size: 12px; color: var(--c-text-muted); }

.alm-hero-pillar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    align-content: start;
}
.alm-pillar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 14px 6px;
    border-radius: 14px;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
}
.alm-pillar .k { font-size: 11.5px; color: var(--c-text-muted); }
.alm-pillar b { font-size: 17px; font-weight: 800; color: var(--c-text); }

/* ---------- 宜忌 ---------- */
.alm-yiji {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.alm-yiji-col {
    padding: 18px 20px;
    border-radius: var(--radius-md);
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    box-shadow: var(--shadow-sm);
}
.alm-yiji-good { border-left: 4px solid #34c759; }
.alm-yiji-bad { border-left: 4px solid #ff5252; }
.alm-yiji-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.alm-yiji-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
}
.alm-yiji-good .alm-yiji-badge { background: #34c759; }
.alm-yiji-bad .alm-yiji-badge { background: #ff5252; }
.alm-yiji-num { font-size: 12.5px; color: var(--c-text-muted); }
.alm-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.alm-chip {
    padding: 4px 11px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-sub);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
}
.alm-yiji-good .alm-chip { color: #1f9d43; background: rgba(52, 199, 89, 0.1); border-color: rgba(52, 199, 89, 0.28); }
.alm-yiji-bad .alm-chip { color: #d32f2f; background: rgba(255, 82, 82, 0.1); border-color: rgba(255, 82, 82, 0.28); }
.alm-chip.is-none { color: var(--c-text-muted); background: var(--c-surface-soft); border-color: var(--c-border); }

/* ---------- 节气 ---------- */
.alm-jq {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.alm-jq-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    box-shadow: var(--shadow-sm);
}
.alm-jq-col .k { font-size: 12px; color: var(--c-text-muted); }
.alm-jq-col .v { font-size: 14px; color: var(--c-text-sub); line-height: 1.7; }
.alm-jq-col .v b { color: var(--c-text); }
.alm-jq-today {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 9px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 700;
    color: #fff;
    background: #7a5cd6;
}

/* ---------- 卡片与明细 ---------- */
.alm-card {
    padding: 22px;
    margin-bottom: 16px;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.alm-card-title { font-size: 16px; font-weight: 800; margin-bottom: 14px; letter-spacing: -0.01em; }
.alm-help { font-size: 12px; line-height: 1.7; color: var(--c-text-muted); margin-top: 10px; }
.alm-help b { color: var(--c-text-sub); }

.alm-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--c-border); border: 1px solid var(--c-border); border-radius: 12px; overflow: hidden; }
.alm-info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 16px;
    background: var(--c-bg-card);
    font-size: 13px;
}
.alm-info-item .k { flex: 0 0 76px; color: var(--c-text-muted); font-size: 12.5px; padding-top: 1px; }
.alm-info-item .v { flex: 1 1 auto; min-width: 0; color: var(--c-text); font-weight: 700; line-height: 1.65; word-break: break-word; }

/* ---------- 方位 ---------- */
.alm-pos { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.alm-pos-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 14px 8px;
    border-radius: 14px;
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    text-align: center;
}
.alm-pos-item .k { font-size: 12px; color: var(--c-text-muted); }
.alm-pos-item .v { font-size: 18px; font-weight: 800; color: #7a5cd6; }
.alm-pos-item .d { font-size: 11px; color: var(--c-text-muted); line-height: 1.5; }
.alm-lu { margin-top: 14px; font-size: 13px; font-weight: 700; color: var(--c-text-sub); text-align: center; }

/* ---------- 时辰表 ---------- */
.alm-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}
.alm-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 860px; }
.alm-table thead th {
    text-align: left;
    padding: 11px 14px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--c-text-sub);
    background: var(--c-surface-soft);
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}
.alm-table tbody td {
    padding: 10px 14px;
    color: var(--c-text-sub);
    border-bottom: 1px solid var(--c-border);
    line-height: 1.6;
    vertical-align: top;
}
.alm-table tbody tr:last-child td { border-bottom: none; }
.alm-table tbody tr.is-now { background: rgba(122, 92, 214, 0.12); }
.alm-table tbody tr.is-now td { color: var(--c-text); }
.alm-table tbody tr.is-now td:first-child { box-shadow: inset 3px 0 0 #7a5cd6; }
.alm-table small { display: block; font-size: 11px; color: var(--c-text-muted); margin-top: 2px; }
.alm-t-zhi b { font-size: 14.5px; color: var(--c-text); }
.alm-t-hm, .alm-t-gz { white-space: nowrap; }
.alm-t-gz b { color: var(--c-text); }
.alm-t-yi, .alm-t-ji { min-width: 150px; }
.alm-luck {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
}
.alm-luck.is-good { background: #34c759; }
.alm-luck.is-bad { background: #ff5252; }

/* ---------- 操作与免责 ---------- */
.alm-actions { display: flex; justify-content: center; margin-bottom: 22px; }
.alm-disclaim {
    font-size: 12px;
    line-height: 1.85;
    color: var(--c-text-muted);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 26px;
}
.alm-disclaim b { color: var(--c-text-sub); }
.alm-info-block { margin-bottom: 26px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .alm-hero { grid-template-columns: 1fr; padding: 20px; }
    .alm-yiji { grid-template-columns: 1fr; }
    .alm-jq { grid-template-columns: 1fr; }
    .alm-info { grid-template-columns: 1fr; }
    .alm-pos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .alm-bar-tip { display: none; }
    .alm-nav { padding: 0 11px; font-size: 12.5px; }
    .alm-solar-date { font-size: 24px; }
    .alm-lunar-date { font-size: 17px; }
    .alm-card { padding: 18px; }
    .alm-pos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .alm-info-item { flex-direction: column; gap: 3px; }
    .alm-info-item .k { flex: none; }
}

/* ============ 黑夜模式 ============ */
[data-theme="dark"] .alm-nav,
[data-theme="dark"] .alm-date-input,
[data-theme="dark"] .alm-pos-item { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .alm-date-input::-webkit-calendar-picker-indicator { filter: invert(0.8); }
[data-theme="dark"] .alm-hero {
    background: linear-gradient(135deg, rgba(122, 92, 214, 0.2), rgba(214, 92, 140, 0.12));
    border-color: rgba(122, 92, 214, 0.36);
}
[data-theme="dark"] .alm-lunar-date { color: #b79cf5; }
[data-theme="dark"] .alm-pos-item .v { color: #b79cf5; }
[data-theme="dark"] .alm-table thead th,
[data-theme="dark"] .alm-disclaim { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .alm-table tbody tr.is-now { background: rgba(122, 92, 214, 0.2); }
[data-theme="dark"] .alm-yiji-good .alm-chip { color: #4ede78; }
[data-theme="dark"] .alm-yiji-bad .alm-chip { color: #ff8a8a; }
[data-theme="dark"] .alm-fest span.alm-fest { color: #ff8fb8; }
