/* ==========================================================================
   八字命卦工具专用样式 (Astrology Minggua Tool Style)
   ========================================================================== */

/* 选项卡容器 */
.tabs-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 12px;
}

.tab-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: var(--background-blur);
    -webkit-backdrop-filter: var(--background-blur);
}

.tab-btn:hover {
    background: var(--glass-bg-hover);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.tab-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px var(--mystic-glow);
}

/* 选项卡面板 */
.tab-panel {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-panel.active {
    display: block;
}

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

/* --------------------------------------------------------------------------
   八字终身卦样式
   -------------------------------------------------------------------------- */
.bazi-info-header {
    text-align: center;
    padding: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    margin-bottom: 24px;
}

.bazi-pillars-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
}

.bazi-pillar-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 8px 12px;
    min-width: 60px;
    background: rgba(255, 255, 255, 0.02);
}

.bazi-pillar-box .label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.bazi-pillar-box .val {
    font-size: 20px;
    font-weight: bold;
}

/* 起卦图形展示区 */
.gua-display-flex {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 40px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.gua-card-box {
    flex: 1;
    min-width: 260px;
    max-width: 320px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.gua-card-box h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 700;
}

.gua-symbol-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.hexagram-lines-wrapper {
    display: flex;
    flex-direction: column-reverse; /* 卦爻自下而上排序 */
    gap: 10px;
    width: 180px;
    margin-bottom: 20px;
}

.hexagram-line-row {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hex-line {
    width: 100%;
    height: 14px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

/* 阳爻：一条实线 */
.hex-line.yang {
    background: var(--primary-color);
    box-shadow: 0 0 6px var(--mystic-glow);
}

/* 阴爻：两条断线 */
.hex-line.yin {
    background: linear-gradient(to right, var(--primary-color) 42%, transparent 42%, transparent 58%, var(--primary-color) 58%);
    filter: drop-shadow(0 0 4px var(--mystic-glow));
}

/* 动爻高亮效果 */
.hexagram-line-row.active-line .hex-line {
    background: #ef4444; /* 红色表示动爻 */
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}
.hexagram-line-row.active-line.yin .hex-line {
    background: linear-gradient(to right, #ef4444 42%, transparent 42%, transparent 58%, #ef4444 58%);
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.6));
}

.line-label {
    position: absolute;
    left: 100%;
    margin-left: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    pointer-events: none;
}

.hexagram-line-row.active-line .line-label {
    color: #ef4444;
    font-weight: bold;
    animation: blink-text 1.5s infinite;
}

@keyframes blink-text {
    50% { opacity: 0.5; }
}

.gua-desc-preview {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.5;
}

/* 解卦段落卡片 */
.interpretation-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    margin-top: 24px;
}

.interpretation-card h4 {
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--primary-color);
    font-size: 16px;
    border-bottom: 1px dashed var(--glass-border);
    padding-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.interpretation-content {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* --------------------------------------------------------------------------
   八宅本命卦样式
   -------------------------------------------------------------------------- */
.minggua-summary-header {
    text-align: center;
    padding: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    margin-bottom: 30px;
}

.minggua-name-badge {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 6px;
    text-shadow: 0 0 10px var(--mystic-glow);
}

.minggua-group-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 6px;
}

.minggua-group-badge.east {
    background: rgba(8, 145, 178, 0.15);
    color: var(--primary-color);
    border: 1px solid rgba(8, 145, 178, 0.3);
}

.minggua-group-badge.west {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* 九宫格布局 */
.nine-palace-container {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.nine-palace-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1 / 1;
}

.palace-cell {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}

.palace-cell:hover {
    transform: scale(1.03);
    z-index: 2;
}

.palace-cell .cell-dir {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.palace-cell .cell-star {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 2px;
}

.palace-cell .cell-luck {
    font-size: 11px;
}

/* 吉位样式 */
.palace-cell.ji {
    background: rgba(13, 148, 136, 0.08);
    border-color: rgba(13, 148, 136, 0.3);
}

.palace-cell.ji .cell-star {
    color: #0d9488;
}

.palace-cell.ji .cell-luck {
    color: #0d9488;
    background: rgba(13, 148, 136, 0.12);
    padding: 1px 6px;
    border-radius: 4px;
}

.palace-cell.ji:hover {
    background: rgba(13, 148, 136, 0.16);
    border-color: #0d9488;
    box-shadow: 0 0 15px rgba(13, 148, 136, 0.25);
}

/* 凶位样式 */
.palace-cell.xiong {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.25);
}

.palace-cell.xiong .cell-star {
    color: #ef4444;
}

.palace-cell.xiong .cell-luck {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.09);
    padding: 1px 6px;
    border-radius: 4px;
}

.palace-cell.xiong:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.25);
}

/* 中宫样式 */
.palace-cell.center {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.4);
    cursor: default;
}

.palace-cell.center .cell-name {
    font-size: 16px;
    font-weight: 800;
    color: #d97706;
}

.palace-cell.center .cell-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.palace-cell.center:hover {
    transform: none;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

/* 选中高亮状态 */
.palace-cell.selected {
    border-width: 2px !important;
}
.palace-cell.ji.selected {
    border-color: #0d9488 !important;
    background: rgba(13, 148, 136, 0.2) !important;
    box-shadow: 0 0 20px rgba(13, 148, 136, 0.4) !important;
}
.palace-cell.xiong.selected {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.16) !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4) !important;
}

/* 详情展示区域 */
.palace-explanation-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    min-height: 120px;
}

.palace-explanation-box h4 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.palace-explanation-box .star-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
}

.palace-explanation-box .star-badge.ji {
    background: rgba(13, 148, 136, 0.15);
    color: #0d9488;
}

.palace-explanation-box .star-badge.xiong {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.palace-explanation-box p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   响应式调整
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .gua-display-flex {
        gap: 20px;
        align-items: center;
        flex-direction: column;
    }
    
    .gua-card-box {
        width: 100%;
        max-width: 100%;
    }
    
    .nine-palace-grid {
        max-width: 360px;
        gap: 8px;
    }

    .palace-cell {
        border-radius: 12px;
        padding: 6px;
    }

    .palace-cell .cell-star {
        font-size: 15px;
    }

    .palace-cell .cell-dir,
    .palace-cell .cell-luck {
        font-size: 10px;
    }

    .palace-cell.center .cell-name {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .tab-btn {
        padding: 8px 16px;
        font-size: 14px;
        border-radius: 10px;
    }

    .nine-palace-grid {
        max-width: 300px;
        gap: 6px;
    }

    .palace-cell .cell-star {
        font-size: 14px;
    }

    .palace-cell .cell-dir {
        font-size: 9px;
        transform: scale(0.95);
    }
}

/* 按钮标准化样式 */
.btn-primary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.5px;
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px var(--mystic-shadow);
    margin-top: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 6px 16px var(--mystic-glow);
}

