/* =====================================================
   Зелёный Нефрит — Calculator pages
   Общие стили для Бацзы / Цзы Вэй Доу Шу / Ци Мэнь
   ===================================================== */

/* ============ Site header (на calc-страницах) ============ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(212, 175, 55, 0.12);
  transition: background 0.3s ease;
}
.site-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}
.site-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 600;
  color: #0F4C3A;
}
.site-header .logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0F4C3A, #1A6B52);
  color: #D4AF37;
}
.site-header .main-nav {
  display: flex;
  gap: 28px;
  align-items: center;
}
.site-header .main-nav a {
  color: #2a3530;
  text-decoration: none;
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}
.site-header .main-nav a:hover,
.site-header .main-nav a.is-active {
  color: #0F4C3A;
  font-weight: 600;
}
.site-header .header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.site-header .mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: #0F4C3A;
  cursor: pointer;
}
@media (max-width: 900px) {
  .site-header .main-nav { display: none; }
  .site-header .mobile-menu-toggle { display: block; }
  .site-header .header-actions .btn-ghost { display: none; }
}

/* ============ Page shell ============ */
.calc-page {
  background: linear-gradient(180deg, #FAF7F0 0%, #F5F1E6 100%);
  min-height: 100vh;
  padding-top: 90px;
}

.calc-hero {
  padding: 48px 0 32px;
  text-align: center;
  position: relative;
}

.calc-hero__eyebrow {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  color: #D4AF37;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  font-style: italic;
}

.calc-hero__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(36px, 5vw, 56px);
  color: #0F4C3A;
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 16px;
}

.calc-hero__subtitle {
  font-size: 17px;
  color: #4a5550;
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ============ Two-column layout ============ */
.calc-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 40px;
  padding: 32px 0 80px;
  align-items: start;
}

@media (max-width: 1024px) {
  .calc-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* ============ Form panel ============ */
.calc-form {
  background: #fff;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 8px 40px rgba(15, 76, 58, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.15);
  position: sticky;
  top: 100px;
}

@media (max-width: 1024px) {
  .calc-form { position: relative; top: 0; }
}

.calc-form__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  color: #0F4C3A;
  margin-bottom: 6px;
  font-weight: 600;
}

.calc-form__subtitle {
  font-size: 14px;
  color: #6b756f;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #2a342d;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.form-group label .req { color: #c0392b; }

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e2dccf;
  border-radius: 12px;
  background: #FBF8F1;
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  color: #1a1a1a;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: #0F4C3A;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(15, 76, 58, 0.08);
}
.form-control::placeholder { color: #a8a89c; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-row--three { grid-template-columns: 1fr 1fr 1fr; }

.form-hint {
  font-size: 12px;
  color: #8a948e;
  margin-top: 6px;
  line-height: 1.4;
}

.form-radios {
  display: flex;
  gap: 8px;
}
.form-radios label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  border: 1.5px solid #e2dccf;
  border-radius: 12px;
  background: #FBF8F1;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}
.form-radios label:hover { border-color: #D4AF37; }
.form-radios input[type="radio"] { display: none; }
.form-radios input[type="radio"]:checked + span,
.form-radios label.is-active {
  /* fallback */
}
.form-radios input[type="radio"]:checked ~ * {}
.form-radios label:has(input:checked) {
  border-color: #0F4C3A;
  background: #0F4C3A;
  color: #fff;
}

.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: #4a5550;
  cursor: pointer;
  line-height: 1.4;
}
.form-checkbox input { margin-top: 3px; accent-color: #0F4C3A; }

.form-submit {
  width: 100%;
  margin-top: 8px;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
}

/* ============ Result panel ============ */
.calc-result {
  min-height: 480px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.result-placeholder {
  background: #fff;
  border-radius: 24px;
  padding: 80px 32px;
  text-align: center;
  border: 2px dashed #e2dccf;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.result-placeholder__icon {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(15, 76, 58, 0.08), rgba(212, 175, 55, 0.12));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: #D4AF37;
  margin-bottom: 24px;
}
.result-placeholder h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  color: #0F4C3A;
  margin-bottom: 10px;
  font-weight: 600;
}
.result-placeholder p {
  color: #6b756f;
  font-size: 15px;
  max-width: 360px;
}

/* ============ Result cards ============ */
.result-card {
  background: #fff;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 4px 24px rgba(15, 76, 58, 0.06);
  border: 1px solid rgba(212, 175, 55, 0.1);
}
.result-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #efe7d8;
}
.result-card__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px;
  color: #0F4C3A;
  font-weight: 600;
}
.result-card__badge {
  background: linear-gradient(135deg, #D4AF37, #B8941F);
  color: #fff;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ============ Bazi: 4 pillars ============ */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}
@media (max-width: 640px) {
  .pillars-grid { grid-template-columns: repeat(2, 1fr); }
}

.pillar {
  background: linear-gradient(180deg, #FBF8F1 0%, #F5EFE1 100%);
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
  border: 1.5px solid #efe7d8;
  position: relative;
  overflow: hidden;
}
.pillar__label {
  font-size: 11px;
  font-weight: 700;
  color: #8a7a4a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.pillar__stem {
  font-family: 'Cormorant Garamond', serif;
  font-size: 42px;
  font-weight: 600;
  line-height: 1;
  color: #0F4C3A;
  margin-bottom: 6px;
}
.pillar__stem-en {
  font-size: 11px;
  color: #6b756f;
  margin-bottom: 14px;
}
.pillar__branch {
  font-family: 'Cormorant Garamond', serif;
  font-size: 36px;
  font-weight: 500;
  line-height: 1;
  color: #B8941F;
  margin-bottom: 4px;
}
.pillar__branch-en {
  font-size: 11px;
  color: #6b756f;
  margin-bottom: 12px;
}
.pillar__hidden {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: #4a5550;
  border-top: 1px dashed #d8cfb8;
  padding-top: 8px;
}
.pillar__hidden span {
  background: rgba(15, 76, 58, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
}

/* Element color tints */
.pillar[data-element="wood"]  { background: linear-gradient(180deg, #EEF6E8, #DDEDD2); }
.pillar[data-element="fire"]  { background: linear-gradient(180deg, #FBE8E0, #F5D2C2); }
.pillar[data-element="earth"] { background: linear-gradient(180deg, #FAF1DC, #F0E0B8); }
.pillar[data-element="metal"] { background: linear-gradient(180deg, #F0F0F0, #E0E0E0); }
.pillar[data-element="water"] { background: linear-gradient(180deg, #E0EBF5, #C8DAEA); }

/* ============ Element balance bars ============ */
.elements-balance {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 16px;
}
@media (max-width: 640px) {
  .elements-balance { grid-template-columns: repeat(5, 1fr); gap: 6px; }
}

.element-bar {
  text-align: center;
}
.element-bar__name {
  font-size: 12px;
  font-weight: 600;
  color: #4a5550;
  margin-bottom: 8px;
}
.element-bar__track {
  background: #f0eadb;
  height: 100px;
  border-radius: 8px;
  position: relative;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.element-bar__fill {
  width: 100%;
  background: linear-gradient(180deg, #0F4C3A, #1A6B52);
  transition: height 0.8s cubic-bezier(.2,.9,.3,1);
  border-radius: 0 0 8px 8px;
}
.element-bar[data-el="wood"]  .element-bar__fill { background: linear-gradient(180deg, #4A8B3A, #6BA85B); }
.element-bar[data-el="fire"]  .element-bar__fill { background: linear-gradient(180deg, #C44A2C, #E07050); }
.element-bar[data-el="earth"] .element-bar__fill { background: linear-gradient(180deg, #B8941F, #D4AF37); }
.element-bar[data-el="metal"] .element-bar__fill { background: linear-gradient(180deg, #8A8A8A, #B5B5B5); }
.element-bar[data-el="water"] .element-bar__fill { background: linear-gradient(180deg, #2C5A8A, #4A7BAA); }
.element-bar__value {
  font-size: 13px;
  font-weight: 700;
  color: #0F4C3A;
  margin-top: 6px;
}

/* ============ Info grid ============ */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.info-item {
  background: #FBF8F1;
  border-radius: 12px;
  padding: 14px 16px;
}
.info-item__label {
  font-size: 11px;
  color: #8a948e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  font-weight: 600;
}
.info-item__value {
  font-size: 16px;
  color: #0F4C3A;
  font-weight: 600;
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
}

/* ============ Da Yun (Luck pillars) ============ */
.dayun-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.dayun-table th,
.dayun-table td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid #efe7d8;
}
.dayun-table th {
  background: #FBF8F1;
  font-weight: 600;
  color: #4a5550;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dayun-table tr.is-current {
  background: linear-gradient(90deg, rgba(212,175,55,0.12), rgba(212,175,55,0.04));
}
.dayun-table .dayun-stem {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  color: #0F4C3A;
  font-weight: 600;
}
.dayun-table .dayun-branch {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  color: #B8941F;
  font-weight: 500;
}

/* ============ Ziwei: 12 palaces grid (4x4 with center empty) ============ */
.ziwei-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, minmax(140px, 1fr));
  gap: 6px;
  background: #efe7d8;
  padding: 6px;
  border-radius: 16px;
  aspect-ratio: 1 / 1;
  max-width: 720px;
  margin: 0 auto;
}
.ziwei-cell {
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  overflow: hidden;
}
.ziwei-cell__name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  font-weight: 600;
  color: #0F4C3A;
  margin-bottom: 4px;
}
.ziwei-cell__branch {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  color: #D4AF37;
  font-weight: 600;
}
.ziwei-cell__stars {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  line-height: 1.3;
  color: #4a5550;
}
.ziwei-cell__stars .star-main { color: #0F4C3A; font-weight: 600; }
.ziwei-cell__stars .star-aux  { color: #6b756f; }
.ziwei-cell.is-body {
  background: linear-gradient(135deg, #FBF8F1, #F5EFE1);
  border: 1.5px solid #D4AF37;
}
.ziwei-center {
  grid-column: 2 / 4;
  grid-row: 2 / 4;
  background: linear-gradient(135deg, #0F4C3A, #1A6B52);
  border-radius: 10px;
  padding: 20px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.ziwei-center__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  margin-bottom: 8px;
  color: #D4AF37;
}
.ziwei-center__info {
  font-size: 13px;
  line-height: 1.6;
  opacity: 0.9;
}

/* ============ Qimen: 3x3 magic square ============ */
.qimen-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: #efe7d8;
  padding: 4px;
  border-radius: 16px;
  aspect-ratio: 1 / 1;
  max-width: 540px;
  margin: 0 auto;
}
.qimen-cell {
  background: linear-gradient(180deg, #FBF8F1, #fff);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}
.qimen-cell__num {
  position: absolute;
  top: 6px;
  right: 8px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  color: #D4AF37;
  font-weight: 600;
}
.qimen-cell__layer {
  font-size: 12px;
  margin: 2px 0;
}
.qimen-cell__layer--god   { color: #C44A2C; font-weight: 600; }
.qimen-cell__layer--star  { color: #0F4C3A; font-weight: 600; font-size: 13px; }
.qimen-cell__layer--door  { color: #B8941F; font-weight: 600; }
.qimen-cell__layer--stem  { color: #4a5550; font-size: 11px; }
.qimen-cell__direction {
  position: absolute;
  bottom: 4px;
  left: 8px;
  font-size: 10px;
  color: #8a948e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============ AI block on result page ============ */
.ai-prompt-box {
  background: linear-gradient(135deg, #0F4C3A 0%, #1A6B52 100%);
  border-radius: 20px;
  padding: 32px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.ai-prompt-box::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(212,175,55,0.25), transparent 70%);
  pointer-events: none;
}
.ai-prompt-box__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px;
  margin-bottom: 8px;
  color: #D4AF37;
  font-weight: 600;
}
.ai-prompt-box__text {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 18px;
  line-height: 1.5;
}
.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.ai-suggestion {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: #fff;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.ai-suggestion:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: #D4AF37;
}
.ai-input-row {
  display: flex;
  gap: 10px;
}
.ai-input-row input {
  flex: 1;
  background: rgba(255,255,255,0.95);
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  color: #1a1a1a;
}
.ai-input-row input:focus { outline: 2px solid #D4AF37; }
.ai-input-row button {
  background: #D4AF37;
  border: none;
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-input-row button:hover { background: #B8941F; }

/* ============ Action buttons row ============ */
.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.result-actions .btn { flex: 0 0 auto; }

/* ============ Date hint ============ */
.calc-date-hint {
  background: rgba(212, 175, 55, 0.08);
  border-left: 3px solid #D4AF37;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: #6b5f3a;
  margin-bottom: 18px;
  line-height: 1.5;
}

/* ============ Loading spinner overlay ============ */
.calc-loading {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(250, 247, 240, 0.92);
  backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.calc-loading.is-active { display: flex; }
.calc-loading__spinner {
  width: 60px; height: 60px;
  border: 4px solid #efe7d8;
  border-top-color: #D4AF37;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.calc-loading__text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  color: #0F4C3A;
}
@keyframes spin { to { transform: rotate(360deg); } }
