/* 八字排盘 - 亮色主题 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 全局颜色变量 - 亮色主题 */
:root {
    /* 背景色 */
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f0f0;
    --bg-header: #fafafa;
    --bg-active: #fff8e1;

    /* 五行颜色 */
    --color-wood: #27ae60;      /* 木 - 绿色 */
    --color-fire: #e74c3c;      /* 火 - 红色 */
    --color-earth: #8B4513;     /* 土 - 深棕色 */
    --color-metal: #D4AF37;     /* 金 - 亮金色 */
    --color-water: #2980b9;     /* 水 - 蓝色 */

    /* 文字颜色 */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --text-gold: #d4a574;
    --text-purple: #8e44ad;
    --text-cyan: #16a085;

    /* 边框颜色 */
    --border-color: #e0e0e0;
    --border-active: #d4a574;

    /* 特殊 */
    --accent-gold: #d4a574;
    --accent-red: #e74c3c;
    --accent-cyan: #16a085;

    /* 统一字体字号体系 */
    --font-xs: 11px;      /* 辅助小字、标注 */
    --font-sm: 12px;      /* 标签、说明文字 */
    --font-base: 14px;    /* 正文基准 */
    --font-md: 15px;      /* 次级标题、重要文字 */
    --font-lg: 16px;      /* 表单输入、按钮、区块标题 */
    --font-xl: 18px;      /* 页面标题 */
    --font-2xl: 22px;     /* 大标题 */
    --font-3xl: 28px;     /* 主标题 */

    /* 统一间距体系 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
    --space-2xl: 24px;

    /* 统一圆角 */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* 六亲情义系统 (红利绿弊) */
    --lq-blessing: #FF3030;  /* 琥珀红：宫星同位且为喜 */
    --lq-lifeline: #A52A2A;  /* 天元紫红：从格命脉 */
    --lq-help:     #FF6B6B;  /* 朱砂红：异位喜神 */
    --lq-standard: #F1C40F;  /* 秋葵黄：位正缘平 */
    --lq-neutral:  #BDC3C7;  /* 玄武灰：平缘闲神 */
    --lq-drain:    #76D7C4;  /* 竹青色：忌神消耗 */
    --lq-danger:   #229954;  /* 墨绿色：受损矛盾 */
    --lq-collision:#0E6251;  /* 焦墨绿：剧烈冲突 */
    --lq-self:     #2C3E50;  /* 墨黑：日主自我 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
}

/* ========== 五行颜色类 ========== */
.w-wood { color: var(--color-wood) !important; }
.w-fire { color: var(--color-fire) !important; }
.w-earth { color: var(--color-earth) !important; }
.w-metal { color: var(--color-metal) !important; }
.w-water { color: var(--color-water) !important; }

.bg-wood { background-color: rgba(39, 174, 96, 0.1) !important; }
.bg-fire { background-color: rgba(231, 76, 60, 0.1) !important; }
.bg-earth { background-color: rgba(139, 69, 19, 0.1) !important; }
.bg-metal { background-color: rgba(212, 175, 55, 0.1) !important; }
.bg-water { background-color: rgba(41, 128, 185, 0.1) !important; }

/* ========== 导航 ========== */
.top-nav {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-item {
    flex: 1;
    padding: 15px 10px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.nav-item.active {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
}

.top-nav .home-tab {
    flex: 0.3333;
    min-width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 6px;
    padding-right: 6px;
}

.home-tab-icon {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    pointer-events: none;
}

.home-tab:hover .home-tab-icon {
    stroke: var(--accent-gold);
}

.home-tab.active .home-tab-icon {
    stroke: var(--accent-gold);
}

.member-center-tab {
    flex: 0.5;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
}

.member-center-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    pointer-events: none;
}

/* ========== 基本信息区 ========== */
.basic-info {
    background: var(--bg-card);
    padding: 12px 16px;
    margin: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-radius: 10px;
}

.gender-tag {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 15px;
    flex-shrink: 0;
}

.gender-tag.male {
    background: #4a90d9;
}

.gender-tag.female {
    background: #d96ba0;
}

.datetime {
    flex: 1;
    min-width: 0;
}

.datetime .datetime-primary {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.datetime .datetime-secondary {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-edit {
    background: none;
    border: 1px solid var(--border-color);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.btn-edit:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    background: rgba(212, 165, 116, 0.06);
}

/* ========== 共享弹窗样式 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: 14px;
    width: 90%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1001;
    animation: modalSlideIn 0.3s ease;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.modal-form {
    padding: 20px;
}

.modal-form .form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.modal-form .form-group {
    flex: 1;
}

.modal-form .form-group label {
    display: block;
    font-size: var(--font-sm);
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.modal-form .form-group input,
.modal-form .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: var(--font-lg);
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-form .form-group input:focus,
.modal-form .form-group select:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button,
.modal-actions a {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-cancel {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color) !important;
}

.btn-cancel:hover {
    background: var(--bg-primary);
}

.btn-confirm {
    background: linear-gradient(135deg, #d4a574 0%, #c08c5a 100%);
    color: white;
    font-weight: 600;
}

.btn-confirm:hover {
    opacity: 0.92;
}

.guest-register-modal-content {
    max-width: 460px;
}

.guest-register-copy {
    padding: 20px 20px 0;
}

.guest-register-lead,
.guest-register-text,
.guest-register-note {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

.guest-register-lead {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.guest-register-text {
    margin-bottom: 8px;
}

.guest-register-target {
    color: var(--accent-gold);
    font-weight: 600;
    margin: 0 2px;
}

.guest-register-note {
    font-size: 13px;
}

.guest-register-actions {
    padding: 0 20px 20px;
}

.membership-lock-section {
    padding: 14px 10px 20px;
}

.membership-lock-card {
    background: linear-gradient(180deg, #fffdf9 0%, #f9f2e8 100%);
    border: 1px solid #ead9bf;
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 10px 24px rgba(86, 58, 31, 0.08);
    text-align: center;
}

.membership-lock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(212, 165, 116, 0.14);
    color: #8b633a;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.membership-lock-title {
    margin: 14px 0 10px;
    color: var(--text-primary);
    font-size: 22px;
    line-height: 1.35;
}

.membership-lock-copy {
    margin: 0 auto;
    max-width: 420px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.75;
}

.membership-lock-actions {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.membership-lock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    padding: 12px 22px;
    border-radius: 10px;
    background: linear-gradient(135deg, #d4a574 0%, #c08c5a 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(192, 140, 90, 0.22);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.membership-lock-btn:hover {
    opacity: 0.94;
    transform: translateY(-1px);
}

/* ========== 选择器区域 ========== */
.selector-bar {
    background: var(--bg-secondary);
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.selector-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 15px;
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.3s;
}

.selector-item:hover {
    background: var(--bg-card-hover);
}

.selector-item.active {
    background: var(--accent-gold);
    color: white;
    border-color: var(--accent-gold);
}

/* ========== 详细表格网格 ========== */
.detail-container {
    overflow-x: auto;
    padding: 0;
    background: var(--bg-primary);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(9, minmax(75px, 1fr));
    gap: 1px;
    background: var(--border-color);
    min-width: 700px;
}

.detail-col {
    background: var(--bg-card);
    text-align: center;
}

.detail-col.header {
    background: linear-gradient(180deg, #e8d5b5 0%, #d4c4a8 100%);
    color: var(--text-primary);
    font-weight: bold;
    padding: 10px 2px;
    font-size: 13px;
}

.detail-col.sub-header {
    background: var(--bg-header);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 6px 2px;
}

.detail-cell {
    padding: 6px 2px;
    border-bottom: 1px solid var(--bg-primary);
    font-size: 12px;
}

.detail-cell.gan {
    font-size: 24px;
    font-weight: bold;
    padding: 12px 2px 6px;
}

.detail-cell.zhi {
    font-size: 20px;
    font-weight: bold;
    padding: 6px 2px 10px;
}

.detail-cell.shishen {
    font-size: 11px;
    color: var(--text-purple);
    padding: 4px 2px;
}

.detail-cell.shishen-main {
    font-size: 11px;
    color: var(--accent-gold);
    font-weight: bold;
}

.detail-cell.canggan {
    font-size: 10px;
    color: var(--text-purple);
    padding: 2px;
    line-height: 1.5;
    min-height: 60px;
}

.detail-cell.canggan-item {
    padding: 1px 0;
}

.detail-cell.canggan-main {
    color: var(--accent-cyan);
    font-weight: bold;
}

.detail-cell.changsheng {
    font-size: 11px;
    color: var(--accent-cyan);
    padding: 5px 2px;
}

.detail-cell.nayin {
    font-size: 10px;
    color: var(--color-earth);
    padding: 5px 2px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-cell.xuwang {
    font-size: 11px;
    color: var(--accent-red);
    padding: 5px 2px;
}

.detail-col.current {
    background: var(--bg-active);
    box-shadow: inset 0 0 0 2px var(--accent-gold);
}

/* ========== 大运时间线 ========== */
.section-title {
    background: linear-gradient(90deg, #e8d5b5 0%, #d4c4a8 100%);
    color: var(--text-primary);
    padding: 12px 15px;
    font-size: 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dayun-timeline {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 15px;
    background: var(--bg-secondary);
}

.dayun-item {
    background: var(--bg-card);
    padding: 10px 12px;
    border-radius: 8px;
    text-align: center;
    min-width: 65px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: var(--text-primary);
}

.dayun-item:hover {
    background: var(--bg-card-hover);
}

.dayun-item.current {
    background: var(--accent-gold);
    color: white;
    border-color: var(--accent-gold);
}

.dayun-item .age-range {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.dayun-item.current .age-range {
    color: rgba(255,255,255,0.8);
}

.dayun-item .ganzhi {
    font-size: 18px;
    font-weight: bold;
    margin: 5px 0;
}

.dayun-item .year {
    font-size: 11px;
    color: var(--text-muted);
}

.dayun-item.current .year {
    color: rgba(255,255,255,0.8);
}

.dayun-item .shishen {
    font-size: 10px;
    color: var(--text-purple);
    margin-top: 3px;
}

.dayun-item.current .shishen {
    color: rgba(255,255,255,0.9);
}

/* ========== 信息区域 ========== */
.info-section {
    background: var(--bg-secondary);
    margin: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.info-content {
    padding: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-muted);
}

.info-value {
    color: var(--text-primary);
}

.info-value.highlight {
    color: var(--accent-gold);
}

/* ========== 按钮 ========== */
.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #d4a574 0%, #c9956b 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.btn-action {
    display: block;
    padding: 12px 20px;
    background: var(--bg-card);
    color: var(--text-gold);
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin: 10px;
}

/* ========== 表单 ========== */
.input-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.input-form {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: var(--font-sm);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--font-lg);
}

/* ========== 滚动条样式 ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========== 五行颜色 ========== */
/* 天干五行 */
.gan-wood { color: #27ae60; font-weight: bold; }
.gan-fire { color: #e74c3c; font-weight: bold; }
.gan-earth { color: #8B4513; font-weight: bold; }
.gan-metal { color: #D4AF37; font-weight: bold; }
.gan-water { color: #2980b9; font-weight: bold; }

/* 地支五行 */
.zhi-wood { color: #27ae60; font-weight: bold; }
.zhi-fire { color: #e74c3c; font-weight: bold; }
.zhi-earth { color: #8B4513; font-weight: bold; }
.zhi-metal { color: #D4AF37; font-weight: bold; }
.zhi-water { color: #2980b9; font-weight: bold; }

/* 五行小图标 */
.wx-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    line-height: 14px;
    text-align: center;
    font-size: 10px;
    border-radius: 50%;
    margin-left: 2px;
}

.wx-wood-icon { background: #27ae60; color: white; }
.wx-fire-icon { background: #e74c3c; color: white; }
.wx-earth-icon { background: #8B4513; color: white; }
.wx-metal-icon { background: #D4AF37; color: white; }
.wx-water-icon { background: #2980b9; color: white; }

/* ========== 六亲图示专属样式 ========== */
.lq-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    color: #ffffff !important;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    min-width: 60px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.lq-tag.blessing { background-color: var(--lq-blessing) !important; box-shadow: 0 0 5px rgba(255,48,48,0.5); }
.lq-tag.life_line { background-color: var(--lq-lifeline) !important; }
.lq-tag.help { background-color: var(--lq-help) !important; }
.lq-tag.standard { background-color: var(--lq-standard) !important; color: #333 !important; } /* 黄底黑字 */
.lq-tag.neutral { background-color: var(--lq-neutral) !important; color: #fff !important; }
.lq-tag.drain { background-color: var(--lq-drain) !important; color: #fff !important; }
.lq-tag.danger { background-color: var(--lq-danger) !important; }
.lq-tag.collision { background-color: var(--lq-collision) !important; }
.lq-tag.self { background-color: var(--lq-self) !important; }

/* ========== 管理后台顶部栏 ========== */
.admin-top-bar {
    background: #2c3e50;
    color: #ecf0f1;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-top-bar-inner {
    max-width: 1040px;
    margin: 0 auto;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: var(--font-base);
}

.admin-top-bar-label {
    font-weight: 700;
    letter-spacing: 1px;
    margin-right: auto;
}

.admin-top-bar-link {
    color: rgba(236, 240, 241, 0.8);
    text-decoration: none;
    font-size: var(--font-sm);
    transition: color 0.2s;
}

.admin-top-bar-link:hover {
    color: #fff;
}

/* ========== 移动端输入防放大 ========== */
/* iOS Safari 在 input font-size < 16px 时会自动缩放页面 */
@supports (-webkit-touch-callout: none) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* 防止双击缩放 */
html {
    touch-action: manipulation;
}
