/* ============================================================
   黄金眼 - 核心样式表 (style.css)
   包含：全局风格、奇门/六壬布局、择吉样式
   修复：奇门宫位头部文字重叠问题 (左右分离)
   ============================================================ */

:root {
    /* 全局深色背景 */
    --bg-color: #121212; 
    --bg-gradient: radial-gradient(circle at center top, #2b2b2b 0%, #000000 100%);
    
    /* 文字颜色 */
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;
    
    /* 黄金眼品牌色 */
    --gold-main: #d4af37;
    --gold-light: #fcf6ba;
    --gold-dark: #8a6d1f;
    
    /* 功能色 */
    --btn-blue-bg: #0d6efd;
    --btn-blue-hover: #0b5ed7;
    --btn-gold-bg: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    
    /* 玻璃质感 */
    --glass-bg: rgba(30, 30, 30, 0.7);
    --glass-border: rgba(212, 175, 55, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    
    /* 字体 */
    --font-serif: 'Noto Serif SC', 'SimSun', serif;
    --font-sans: 'Roboto', 'Microsoft YaHei', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    font-family: var(--font-sans);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ================= 顶部控制面板 ================= */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--glass-shadow);
}

.control-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* 标题样式 */
.app-title {
    font-family: var(--font-serif);
    color: var(--gold-main);
    font-size: 2.2rem;
    margin: 0;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
    text-align: center;
}

/* 输入框区域布局 */
.input-group-row {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    align-items: flex-end;
    width: 100%;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-wrapper label {
    color: var(--gold-main);
    font-size: 0.9rem;
    font-weight: bold;
}

.input-inner {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 输入框美化 */
input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
select {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #555;
    color: #fff;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 1rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.3s;
}

input:focus, select:focus {
    border-color: var(--gold-main);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

/* 按钮组 */
.action-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 10px;
}

.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

/* 蓝色按钮 */
.btn.primary {
    background-color: var(--btn-blue-bg);
    color: white;
    box-shadow: 0 4px 10px rgba(13, 110, 253, 0.3);
}
.btn.primary:hover {
    background-color: var(--btn-blue-hover);
    transform: translateY(-2px);
}

/* 金色按钮 */
.btn.accent {
    background: var(--btn-gold-bg);
    color: #000;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}
.btn.accent:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

.btn-icon {
    background: #fff;
    color: #000;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
}
.btn-icon:hover { background: #eee; }

/* 状态文字 */
.status-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* ================= 导航栏 ================= */
.nav-links {
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-start;
    gap: 15px;
}
.nav-links a {
    color: var(--gold-main);
    text-decoration: none;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}
.nav-links a:hover { color: #fff; text-shadow: 0 0 5px var(--gold-main); }

/* ================= 结果区域通用 ================= */
.output-container {
    animation: fadeIn 0.5s ease-in-out;
}

.board-wrapper {
    background: #fff;
    color: #333;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    border: 1px solid #444;
}

.board-header-row {
    border-bottom: 2px solid var(--btn-blue-bg);
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.qimen-grid-title {
    margin: 0;
    font-family: var(--font-serif);
    font-weight: bold;
    font-size: 1.4rem;
    color: #000;
}

/* 全屏按钮 */
.fullscreen-btn {
    padding: 5px 15px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* 择吉筛选区域 */
#zhejiResults {
    background-color: #e8f5e9 !important;
    border: 1px solid #a5d6a7 !important;
    color: #2e7d32;
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
}

/* ================= 奇门九宫格布局 ================= */
.analysis-container {
    display: flex;
    gap: 20px;
    align-items: stretch;
    flex-wrap: wrap;
}

.left-column {
    flex: 0 0 180px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    border: 1px solid #dee2e6;
}

.qimen-grid {
    flex: 1;
    min-width: 360px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    background: #333;
    border: 2px solid #333;
}

/* 宫位容器 */
.palace {
    background: #fff;
    min-height: 150px;
    padding: 8px;
    position: relative; /* 关键：作为子元素定位的参考 */
    display: flex;
    flex-direction: column;
}

/* ★★★ 关键修复：宫位头部布局 (左右分离，防止重叠) ★★★ */
.palace-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 4px 6px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between; /* 宫名在左，标记在右 */
    align-items: flex-start;
    z-index: 10;
}

/* 宫位名称 (左上) */
.palace-name { 
    margin: 0;
    font-weight: bold; 
    color: #999; 
    font-size: 0.85rem; 
    line-height: 1.4;
    white-space: nowrap;
}

/* 神煞标记容器 (右上) */
.markers {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 3px;
    max-width: 70%;
}

/* 标记样式 */
.mark {
    font-size: 0.7rem;
    padding: 1px 4px;
    border-radius: 3px;
    color: #fff;
    font-weight: bold;
    line-height: 1.2;
    display: inline-block;
}
.mark.kong { background-color: #9e9e9e; }   /* 空亡灰 */
.mark.break { background-color: #e57373; }  /* 破红 */
.mark.punish { background-color: #ffb74d; } /* 刑橙 */

/* ★★★ 关键修复：内容下移，避开头部文字 ★★★ */
.palace-content {
    margin-top: 28px; /* 增加顶部间距 */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-grow: 1;
}

/* 宫位内部元素颜色 */
.god { color: #2e7d32; font-weight: bold; font-size: 1rem; } /* 八神 */
.star { color: #d81b60; font-weight: bold; font-size: 1.1rem; } /* 九星 */
.door { color: #d32f2f; font-weight: bold; font-size: 1.1rem; } /* 八门 */
.door.lucky { color: #f57c00 !important; font-weight: 900; text-shadow: 0 0 1px rgba(0,0,0,0.1); }
.tianpan { color: #d32f2f; font-weight: bold; font-size: 1.2rem; } /* 天盘 */
.dipan { color: #000; font-weight: bold; font-size: 1.2rem; } /* 地盘 */

.main-stack, .pan-stack { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pan-stack { padding-left: 10px; border-left: 1px solid #eee; }

/* 六壬容器 */
.liuren-container {
    flex: 1;
    min-width: 350px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 5px;
}

/* ================= 移动端适配 ================= */
@media (max-width: 768px) {
    body { padding: 10px; }
    .glass-panel { padding: 15px; }
    .app-title { font-size: 1.6rem; }
    
    .input-group-row { flex-direction: column; gap: 15px; align-items: stretch; }
    .input-wrapper { width: 100%; }
    .input-inner { display: flex; width: 100%; gap: 10px; }
    .input-inner input { flex: 1; }
    
    .action-row { flex-direction: column; width: 100%; }
    .btn { width: 100%; padding: 12px; }
    
    .analysis-container { flex-direction: column; }
    .left-column { width: 100%; box-sizing: border-box; }
    .qimen-grid { width: 100%; }
    
    /* 手机端宫位紧凑化 */
    .palace { min-height: 110px; padding: 4px; }
    .palace-name { font-size: 0.8rem; }
    .mark { font-size: 0.6rem; padding: 1px 3px; }
    .palace-content { margin-top: 24px; gap: 8px; } /* 手机端稍微紧凑一点 */
    .star, .door, .tianpan, .dipan { font-size: 1rem; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}