/* ============================================
   八字缘禄网 - 公共基础样式 v2.0
   所有页面统一引用此文件
   ============================================ */

/* === CSS 变量 === */
:root {
    --brown: #5D2F0D;
    --brown-dark: #3a1a05;
    --brown-light: #7a3d1a;
    --brown-accent: #8B4513;
    --gold: #D4AF37;
    --gold-light: #E5C048;
    --gold-dark: #c4a832;
    --gold-bg: rgba(212, 175, 55, 0.1);
    --gold-text: #F4E4BC;
    --error: #e74c3c;
    --error-bg: #fdf0f0;
    --bg: #f5f0e8;
    --bg-light: #ede6d8;
    --bg-card: #fefcf8;
    --text: #3a2a1a;
    --text-light: #8B7355;
    --text-muted: #999;
    --white: #fff;
    --border: #e8e0d0;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(93, 47, 13, 0.12);
    --radius: 10px;
    --radius-lg: 16px;
    --font: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --font-kai: "KaiTi", "STKaiti", serif;
}

/* === 基础重置 === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-light) 100%);
    color: var(--text);
    line-height: 1.8;
    font-size: 15px;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* === Header 导航栏 === */
.header {
    background: linear-gradient(135deg, var(--brown) 0%, var(--brown-light) 100%);
    padding: 15px 0;
    box-shadow: 0 4px 20px rgba(93, 47, 13, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    color: var(--gold-text);
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
    white-space: nowrap;
}

.logo:hover {
    color: var(--gold);
    transform: scale(1.02);
}

.nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.nav a {
    color: rgba(244, 228, 188, 0.85);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 24px;
    transition: all 0.3s;
    font-weight: 500;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.nav a:hover {
    color: var(--gold);
    background: var(--gold-bg);
    transform: translateY(-1px);
}

.nav a.active {
    color: var(--gold);
    background: rgba(212, 175, 55, 0.2);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2);
}

/* === 登录按钮 === */
.btn-login {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--brown);
    border: none;
    border-radius: 24px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
    white-space: nowrap;
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

/* === 容器 === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px 60px;
}

.container-sm {
    max-width: 800px;
}

/* === 页面标题 === */
.page-title {
    text-align: center;
    padding: 20px 0 30px;
}

.page-title h1 {
    font-size: 32px;
    color: var(--brown);
    margin-bottom: 10px;
    font-weight: 800;
    letter-spacing: 2px;
}

.page-title p {
    color: var(--text-light);
    font-size: 15px;
    max-width: 600px;
    margin: 0 auto;
}

/* === 卡片 === */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-lg), 0 2px 8px rgba(93, 47, 13, 0.05);
    margin-bottom: 25px;
    transition: all 0.3s;
    border: 1px solid rgba(212, 175, 55, 0.08);
}

.card:hover {
    box-shadow: 0 12px 48px rgba(93, 47, 13, 0.12), 0 4px 12px rgba(93, 47, 13, 0.08);
}

/* === 区块标题 === */
.section-title {
    font-size: 18px;
    color: var(--brown);
    border-left: 4px solid var(--gold);
    padding-left: 14px;
    margin-bottom: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

/* === 表单 === */
.form-table {
    width: 100%;
    border-spacing: 0 12px;
}

.form-table td {
    padding: 10px 14px;
    vertical-align: middle;
}

.form-table td:first-child {
    width: 120px;
    text-align: right;
    font-weight: 600;
    color: var(--brown);
    font-size: 14px;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text);
    transition: all 0.3s;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.12);
    background: var(--white);
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--gold-dark);
}

input[type="radio"],
input[type="checkbox"] {
    width: auto;
    margin-right: 6px;
    accent-color: var(--gold);
}

label {
    font-size: 14px;
    color: var(--brown);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 8px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
}

label:hover {
    background: var(--gold-bg);
}

/* === 提交按钮 === */
.btn-submit {
    display: block;
    width: 240px;
    margin: 30px auto 0;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--brown);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 1px;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
}

.btn-submit:hover {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(212, 175, 55, 0.4);
}

.btn-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

/* === 提示文字 === */
.hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* === Footer === */
.footer {
    background: linear-gradient(135deg, var(--brown) 0%, var(--brown-dark) 100%);
    color: var(--gold-text);
    padding: 30px 20px;
    margin-top: 40px;
    text-align: center;
    border-top: 2px solid rgba(212, 175, 55, 0.2);
}

.footer p {
    font-size: 12px;
    margin: 5px 0;
    line-height: 1.8;
}

.footer a {
    color: var(--gold-text);
    text-decoration: none;
    transition: color 0.3s;
}

.footer a:hover {
    color: var(--gold);
}

.footer .footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin: 10px 0;
}

.footer .footer-links a {
    font-size: 13px;
}

.footer .footer-beian {
    margin-top: 8px;
}

.footer .footer-beian img {
    vertical-align: middle;
    margin-right: 5px;
    height: 16px;
}

/* === 动画 === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.fade-in {
    animation: fadeIn 0.6s ease;
}

/* === 加载状态 === */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    justify-content: center;
    align-items: center;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.loading-spinner .spinner-circle {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.loading-spinner p {
    color: var(--text-light);
    font-size: 14px;
}

/* === Toast消息提示 === */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease;
    min-width: 200px;
    max-width: 400px;
}

.toast-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.toast-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.toast-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.toast-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

/* === 表单验证状态 === */
input.input-error,
select.input-error {
    border-color: var(--error) !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15) !important;
}

input.input-valid,
select.input-valid {
    border-color: #2E7D32 !important;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1) !important;
}

/* === 按钮加载状态 === */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

/* === 四柱排盘（共用） === */
.bazi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 20px 0;
}

.bazi-pillar {
    background: linear-gradient(160deg, var(--brown) 0%, var(--brown-light) 50%, var(--brown-accent) 100%);
    border-radius: 16px;
    padding: 24px 16px;
    color: var(--gold-text);
    text-align: center;
    box-shadow: 0 8px 24px rgba(93, 47, 13, 0.25), inset 0 1px 0 rgba(244, 228, 188, 0.1);
    position: relative;
    overflow: hidden;
}

.bazi-pillar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold));
}

.bazi-pillar .pillar-label {
    font-size: 12px;
    opacity: 0.85;
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.bazi-pillar .gan {
    font-size: 42px;
    font-weight: 800;
    color: var(--gold);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
    font-family: var(--font-kai);
}

.bazi-pillar .zhi {
    font-size: 38px;
    font-weight: 700;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    line-height: 1.2;
    font-family: var(--font-kai);
}

.bazi-pillar .wuxing-tag {
    font-size: 13px;
    opacity: 0.9;
    padding-top: 10px;
    border-top: 1px solid rgba(244, 228, 188, 0.2);
}

/* === 分析卡片 === */
.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.analysis-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, #f9f4e8 100%);
    padding: 22px;
    border-radius: 14px;
    border-left: 4px solid var(--gold);
    box-shadow: 0 4px 16px rgba(93, 47, 13, 0.06);
    transition: all 0.3s;
}

.analysis-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(93, 47, 13, 0.1);
}

.analysis-card h4 {
    color: var(--brown);
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.analysis-card h4::before {
    content: '▸';
    color: var(--gold);
    font-size: 14px;
}

.analysis-card p {
    color: #5a4a3a;
    line-height: 1.9;
    font-size: 14px;
}

/* === 评分颜色 === */
.score-high { color: #2E7D32; }
.score-mid { color: #E67E22; }
.score-low { color: #C41E3A; }

/* === 响应式 === */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 10px;
    }

    .nav {
        gap: 4px;
        justify-content: center;
    }

    .nav a {
        padding: 6px 12px;
        font-size: 12px;
    }

    .page-title h1 {
        font-size: 24px;
    }

    .container {
        padding: 20px 12px 40px;
    }

    .card {
        padding: 20px 14px;
        border-radius: 12px;
    }

    .bazi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .bazi-pillar .gan { font-size: 32px; }
    .bazi-pillar .zhi { font-size: 28px; }

    .analysis-grid {
        grid-template-columns: 1fr;
    }

    .form-table td:first-child {
        width: 80px;
        font-size: 13px;
    }

    .btn-submit {
        width: 100%;
    }

    .footer {
        padding: 20px 12px;
    }
}

@media (max-width: 480px) {
    .nav a {
        padding: 5px 8px;
        font-size: 11px;
    }

    .logo {
        font-size: 20px;
    }

    .bazi-grid {
        grid-template-columns: 1fr 1fr;
    }

    .page-title h1 {
        font-size: 22px;
    }
}
