/* ============ 易经国学系统 - 中国风样式 ============ */

:root {
  --bg-dark: #0a0a0f;
  --bg-panel: #12121a;
  --bg-card: #1a1a25;
  --gold: #c9a84c;
  --gold-light: #e0c878;
  --gold-dark: #8b6914;
  --text: #d4c5a9;
  --text-light: #a99b80;
  --text-bright: #f0e6d0;
  --red: #c0392b;
  --red-light: #e74c3c;
  --green: #27ae60;
  --border: #2a2a35;
  --border-gold: #3d3520;
  --radius: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.5);
}

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

body {
  font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.8;
}

.bg-pattern {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(201,168,76,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(201,168,76,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(201,168,76,0.03) 0%, transparent 50%);
  pointer-events: none; z-index: 0;
}

/* ============ Header ============ */
.header {
  position: relative; z-index: 1;
  text-align: center; padding: 30px 20px 10px;
  border-bottom: 1px solid var(--border-gold);
  background: linear-gradient(180deg, rgba(18,18,26,0.95) 0%, rgba(10,10,15,0.9) 100%);
}
.title {
  font-size: 2.2em; color: var(--gold);
  letter-spacing: 6px; font-weight: normal;
  text-shadow: 0 0 30px rgba(201,168,76,0.3);
}
.subtitle {
  font-size: 0.95em; color: var(--text-light);
  margin-top: 6px; letter-spacing: 3px;
}

/* ============ Navigation Tabs ============ */
.tabs {
  position: relative; z-index: 1;
  display: flex; justify-content: center; gap: 0;
  padding: 15px 20px;
  background: rgba(18,18,26,0.8);
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 10px 30px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-light);
  font-size: 1.05em; cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}
.tab:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.tab:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.tab.active {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #1a1a10; border-color: var(--gold);
  font-weight: bold;
}
.tab:hover:not(.active) {
  border-color: var(--gold-dark); color: var(--gold-light);
}

/* ============ Tab Content ============ */
.tab-content { display: none; position: relative; z-index: 1; }
.tab-content.active { display: block; }

/* ============ Main Layout ============ */
.main-layout {
  display: grid; grid-template-columns: 360px 1fr;
  gap: 20px; padding: 20px; min-height: calc(100vh - 200px);
}
/* 婚姻匹配页面需要更宽的输入面板 */
#tab-marriage .main-layout {
  grid-template-columns: 400px 1fr;
}
@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
}

/* ============ Panel ============ */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 25px;
  box-shadow: var(--shadow);
}
.panel h2 {
  font-size: 1.3em; color: var(--gold-light);
  margin-bottom: 20px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border-gold);
  letter-spacing: 2px;
}
.panel h3 {
  color: var(--gold);
  margin: 20px 0 12px;
  font-size: 1.1em;
}
.panel-input { max-height: calc(100vh - 200px); overflow-y: auto; }
.panel-result { max-height: calc(100vh - 200px); overflow-y: auto; }

.placeholder {
  text-align: center; color: var(--text-light);
  padding: 60px 20px; font-size: 1.1em;
}

/* ============ Forms ============ */
.form-row { display: flex; gap: 12px; margin-bottom: 12px; }
.form-group { flex: 1; }
.form-group label {
  display: block; color: var(--text-light);
  font-size: 0.85em; margin-bottom: 4px;
}
.form-group input, .form-group select {
  width: 100%; padding: 8px 10px;
  background: var(--bg-card); color: var(--text-bright);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.9em; font-family: inherit;
  transition: border-color 0.3s;
  min-width: 0;
}
.form-group input[type="number"] {
  min-width: 72px;
  -moz-appearance: textfield;
}
.form-group input[type="number"]::-webkit-inner-spin-button,
.form-group input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--gold);
}
.btn-primary {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #1a1a10;
  border: none; border-radius: var(--radius);
  font-size: 1.1em; font-weight: bold;
  cursor: pointer; margin-top: 8px;
  font-family: inherit; letter-spacing: 2px;
  transition: all 0.3s;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(201,168,76,0.3);
}

/* ============ 八字四柱展示 ============ */
.pillars-table {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin: 15px 0;
}
.pillar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 10px; text-align: center;
}
.pillar-card .pillar-label {
  color: var(--gold-light); font-size: 0.85em;
  margin-bottom: 8px;
}
.pillar-card .pillar-gz {
  font-size: 1.8em; color: var(--text-bright);
  letter-spacing: 3px; margin: 5px 0;
}
.pillar-card .pillar-info {
  font-size: 0.8em; color: var(--text-light);
  margin-top: 5px;
}
.tg { color: #e8c840; }
.dz { color: #6cb4d4; }

/* ============ 五行展示 ============ */
.wuxing-bar { margin: 10px 0; }
.wuxing-bar .bar-label {
  display: inline-block; width: 30px;
  color: var(--gold-light); font-size: 0.9em;
}
.wuxing-bar .bar-track {
  display: inline-block; width: calc(100% - 40px);
  height: 18px; background: var(--bg-card);
  border-radius: 9px; overflow: hidden; vertical-align: middle;
}
.wuxing-bar .bar-fill {
  height: 100%; border-radius: 9px;
  transition: width 0.5s;
}
.wuxing-bar .bar-count {
  display: inline-block; width: 25px; text-align: right;
  font-size: 0.85em; color: var(--text-light); margin-left: 5px;
}
.bar-mu { background: linear-gradient(90deg, #2d8a4e, #4CAF50); }
.bar-huo { background: linear-gradient(90deg, #c0392b, #e74c3c); }
.bar-tu { background: linear-gradient(90deg, #b8860b, #daa520); }
.bar-jin { background: linear-gradient(90deg, #aaa, #e0e0e0); }
.bar-shui { background: linear-gradient(90deg, #1a5276, #3498db); }

/* ============ 解读卡片 ============ */
.interpretation-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px; margin: 15px 0;
}
.interpretation-card h4 {
  color: var(--gold-light);
  margin-bottom: 10px;
  font-size: 1.05em;
}
.interpretation-card p {
  color: var(--text);
  font-size: 0.95em; line-height: 1.9;
  margin: 5px 0;
}
.tag {
  display: inline-block; padding: 2px 10px;
  border-radius: 12px; font-size: 0.8em; margin: 2px 4px;
}
.tag-good { background: rgba(39,174,96,0.2); color: var(--green); }
.tag-bad { background: rgba(231,76,60,0.2); color: var(--red-light); }
.tag-neutral { background: rgba(201,168,76,0.2); color: var(--gold-light); }
.tag-gua { background: rgba(201,168,76,0.15); color: var(--gold); font-size: 0.9em; padding: 3px 12px; }

/* ============ 铁板神数条文 ============ */
.tiaowen-item {
  background: var(--bg-card);
  border-left: 3px solid var(--gold-dark);
  padding: 12px 18px; margin: 10px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.tiaowen-item .tiaowen-id {
  color: var(--gold); font-size: 0.85em; margin-bottom: 4px;
}
.tiaowen-item .tiaowen-category {
  color: var(--gold-light); font-size: 0.85em;
  float: right;
}
.tiaowen-item .tiaowen-text {
  color: var(--text-bright); font-size: 0.95em;
}

/* ============ 奇门九宫格 ============ */
.qimen-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px; margin: 20px auto;
  max-width: 500px;
  aspect-ratio: 1;
}
.qimen-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 8px 6px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; font-size: 0.8em;
  border-radius: 4px;
  min-height: 90px;
}
.qimen-cell .cell-title {
  color: var(--gold-light); font-size: 0.8em;
  margin-bottom: 4px;
}
.qimen-cell .cell-element {
  font-size: 1.3em; color: var(--text-bright);
  letter-spacing: 2px; margin: 2px 0;
}
.qimen-cell .cell-detail {
  font-size: 0.75em; color: var(--text-light);
  line-height: 1.4;
}
.qimen-cell.gong-ji { border-color: var(--green); }
.qimen-cell.gong-xiong { border-color: var(--red); }
.qimen-cell.gong-ma { border-color: #e67e22; box-shadow: 0 0 8px rgba(230,126,34,0.3); }
.qimen-cell.gong-kong { background: rgba(100,100,100,0.2); opacity: 0.7; }

/* ============ 大运展示 ============ */
.dayun-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.dayun-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px; text-align: center;
  font-size: 0.85em;
}
.dayun-item .dy-age { color: var(--gold-light); }
.dayun-item .dy-gz { color: var(--text-bright); font-size: 1.1em; letter-spacing: 2px; }

/* ============ Scrollbar ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dark); }

/* ============ Loading ============ */
.loading {
  text-align: center; padding: 40px;
  color: var(--gold); font-size: 1.1em;
}
.spinner {
  display: inline-block; width: 30px; height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 神煞表格 ============ */
.shensha-table {
  width: 100%; border-collapse: collapse; margin: 15px 0;
}
.shensha-table th {
  text-align: left; color: var(--gold-light);
  padding: 8px 12px; border-bottom: 1px solid var(--border-gold);
  font-size: 0.9em;
}
.shensha-table td {
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  font-size: 0.9em; color: var(--text);
}

.error-msg {
  color: var(--red-light); padding: 15px;
  background: rgba(231,76,60,0.1);
  border: 1px solid rgba(231,76,60,0.3);
  border-radius: var(--radius); margin: 10px 0;
}

/* 梅花易数类型 */
.gua-display { text-align: center; margin: 20px 0; }
.gua-symbol { font-size: 3em; color: var(--gold); }
.gua-name { font-size: 1.3em; color: var(--gold-light); margin-top: 8px; }
.gua-text { color: var(--text); font-size: 0.95em; margin: 8px 0; line-height: 1.8; }
.tiyong-table { margin: 15px 0; }
.tiyong-table td { padding: 6px 12px; font-size: 0.9em; }
.tiyong-table td:first-child { color: var(--gold-light); }
