/* ============================================================
   天机阁 · 全局样式
   传统中国风配色：深黑底、金色字、朱砂红点缀
   ============================================================ */

:root {
    --bg-primary: #0d0d14;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(30, 25, 20, 0.8);
    --gold: #d4af37;
    --gold-dim: #b8960c;
    --gold-light: #f0d060;
    --red: #c23a2e;
    --red-glow: rgba(194, 58, 46, 0.3);
    --text-primary: #e8dcc8;
    --text-dim: #8a7e6b;
    --border: rgba(212, 175, 55, 0.2);
}

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

body.dark {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: "Noto Serif SC", "Source Han Serif CN", "STSong", "SimSun", serif;
    min-height: 100vh;
}

/* ===== 通用组件 ===== */

.page-header {
    text-align: center;
    padding: 3rem 2rem 2rem;
    position: relative;
}

.page-header::after {
    content: '';
    display: block;
    width: 200px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
    margin: 1.5rem auto 0;
}

.page-title {
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--gold);
    letter-spacing: 0.3em;
    text-shadow: 0 0 30px rgba(212,175,55,0.2);
}

.page-subtitle {
    font-size: 1rem;
    color: var(--text-dim);
    margin-top: 0.8rem;
    letter-spacing: 0.2em;
}

.nav-bar {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: rgba(13,13,20,0.95);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
}

.nav-item {
    color: var(--text-dim);
    text-decoration: none;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.nav-item:hover, .nav-item.active {
    color: var(--gold);
    background: rgba(212,175,55,0.08);
}

.btn-gold {
    display: inline-block;
    padding: 0.8rem 2.5rem;
    background: linear-gradient(135deg, var(--gold), var(--gold-dim));
    color: var(--bg-primary);
    text-decoration: none;
    border-radius: 4px;
    font-size: 1.05rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212,175,55,0.3);
}

.btn-outline {
    display: inline-block;
    padding: 0.6rem 1.8rem;
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: transparent;
    cursor: pointer;
}

.btn-outline:hover {
    background: rgba(212,175,55,0.1);
    box-shadow: 0 4px 15px rgba(212,175,55,0.15);
}

.section-title {
    font-size: 1.6rem;
    color: var(--gold);
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 3px solid var(--gold-dim);
}

/* ===== 表单样式 ===== */

.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    color: var(--gold);
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
}

.form-input, .form-select {
    width: 100%;
    padding: 0.7rem 1rem;
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(212,175,55,0.15);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-col {
    flex: 1;
    min-width: 120px;
}

/* ===== 八字排盘样式 ===== */

.bazi-chart {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    max-width: 800px;
    margin: 2rem auto;
}

.pill-column {
    text-align: center;
    padding: 1.5rem 1rem;
    background: linear-gradient(180deg, rgba(60,40,20,0.4), rgba(30,20,10,0.6));
    border: 1px solid var(--border);
    border-radius: 6px;
}

.pill-label {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}

.pillar-gan, .pillar-zhi {
    width: 3rem;
    height: 3rem;
    line-height: 3rem;
    text-align: center;
    font-size: 1.6rem;
    margin: 0 auto 0.5rem;
    border-radius: 4px;
}

.pillar-gan {
    color: var(--gold);
    background: rgba(212,175,55,0.08);
    border-bottom: 1px solid var(--border);
}

.pillar-zhi {
    color: var(--red);
    background: rgba(194,58,46,0.08);
}

.wuxing-bar {
    display: flex;
    gap: 2rem;
    justify-content: center;
    padding: 1rem;
    margin: 1rem auto;
    max-width: 600px;
    background: rgba(30,25,20,0.4);
    border-radius: 6px;
}

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

.wuxing-dot {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    display: inline-block;
    margin-bottom: 0.3rem;
}

.wuxing-jin .wuxing-dot { background: #e8c94a; }
.wuxing-mu .wuxing-dot { background: #4caf50; }
.wuxing-shui .wuxing-dot { background: #2196f3; }
.wuxing-huo .wuxing-dot { background: #ff5722; }
.wuxing-tu .wuxing-dot { background: #8d6e40; }

/* ===== 六爻卦象样式 ===== */

.gua-display {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem;
    max-width: 300px;
    margin: 2rem auto;
}

.gua-line {
    height: 12px;
    width: 200px;
    background: var(--gold);
    border-radius: 2px;
    position: relative;
}

.gua-line.yin {
    background: transparent;
    display: flex;
    justify-content: space-between;
}

.gua-line.yin::before, .gua-line.yin::after {
    content: '';
    width: 80px;
    height: 12px;
    background: var(--gold);
    border-radius: 2px;
}

.gua-line.yang-old::before {
    content: '○';
    position: absolute;
    right: -30px;
    top: -8px;
    color: var(--red);
    font-size: 1rem;
}

.gua-line.yin-old::before, .gua-line.yin-old::after {
    content: '';
    width: 80px;
    height: 12px;
    background: var(--gold);
    border-radius: 2px;
}

.gua-line.yang-old {
    background: transparent;
    display: flex;
    justify-content: space-between;
}

.gua-line.yang-old::before, .gua-line.yang-old::after {
    content: '';
    width: 80px;
    height: 12px;
    background: var(--gold);
    border-radius: 2px;
}

/* ===== 分析结果区 ===== */

.result-box {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(60,40,20,0.3), rgba(20,15,10,0.5));
    border: 1px solid var(--border);
    border-radius: 8px;
}

.result-title {
    color: var(--gold);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(212,175,55,0.15);
}

.result-content {
    color: var(--text-primary);
    line-height: 2;
    font-size: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.loading-indicator {
    text-align: center;
    padding: 3rem;
    color: var(--gold-dim);
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(212,175,55,0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== 罗盘样式 ===== */

.luopan-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.luopan {
    width: 400px;
    height: 400px;
    border-radius: 50%;
    position: relative;
    background: radial-gradient(circle, #2a1f14, #1a1208);
    border: 3px solid var(--gold-dim);
}

.luopan-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(212,175,55,0.15);
}

/* ===== 响应式 ===== */

@media (max-width: 768px) {
    .bazi-chart { grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
    .pillar-gan, .pillar-zhi { width: 2.5rem; height: 2.5rem; line-height: 2.5rem; font-size: 1.3rem; }
    .page-header { padding: 2rem 1rem 1rem; }
    .result-box { margin: 1rem; padding: 1.5rem; }
}

/* ===== 通用容器 ===== */

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

.container-wide {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===== 动画 ===== */

.fade-in {
    animation: fadeIn 0.8s ease forwards;
}

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

/* ===== 表格样式 ===== */

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.data-table th, .data-table td {
    padding: 0.8rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    color: var(--gold);
    font-weight: normal;
    background: rgba(212,175,55,0.05);
}

.data-table td {
    color: var(--text-primary);
}

.data-table tr:hover td {
    background: rgba(212,175,55,0.03);
}

/* ===== 标签页 ===== */

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.6rem 1.2rem;
    background: transparent;
    color: var(--text-dim);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.tab-btn.active, .tab-btn:hover {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.5s ease; }

/* ===== Footer ===== */

.site-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-dim);
    border-top: 1px solid rgba(212,175,55,0.1);
    margin-top: 3rem;
}
