/**
 * Four Pillars Display Styles
 * Enhances the display of Chinese characters and pillar layout
 */

/* Pillar Container Styles */
.pillars-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin: 2rem 0;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 12px;
}

.pillars-container.layout-vertical {
  grid-template-columns: 1fr;
}

.pillars-container.layout-grid {
  grid-template-columns: repeat(2, 1fr);
}

/* Individual Pillar Styles */
.pillar {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.pillar:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.pillar h5 {
  margin: 0 0 1rem 0;
  color: #333;
  font-size: 1.1rem;
  font-weight: 600;
}

/* Pillar Content */
.pillar-content {
  margin: 1rem 0;
}

.stem,
.branch {
  padding: 0.75rem;
  margin: 0.5rem 0;
  background: #f5f5f5;
  border-radius: 6px;
  font-size: 1.5rem;
  line-height: 1.6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Chinese Character Display */
.stem::before,
.branch::before {
  content: attr(data-label);
  display: block;
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 100%;
}

.stem::before {
  content: "Heavenly Stem";
}

.branch::before {
  content: "Earthly Branch";
}

/* Ensure Chinese characters display properly */
.stem,
.branch,
.chinese,
.pillar-main .stem-character,
.pillar-main .branch-character {
  font-family:
    -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "微软雅黑", "SimHei", "黑体",
    "Noto Sans CJK SC", "PingFang SC", "Hiragino Sans GB", "Heiti SC", "WenQuanYi Micro Hei",
    sans-serif;
}

/* Element Colors */
.element-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  margin-top: 0.5rem;
}

.element-badge.wood {
  background-color: #2e7d32;
}
.element-badge.fire {
  background-color: #d32f2f;
}
.element-badge.earth {
  background-color: #f57c00;
}
.element-badge.metal {
  background-color: #455a64;
}
.element-badge.water {
  background-color: #1976d2;
}

/* Pillar Meaning */
.pillar-meaning {
  font-size: 0.875rem;
  color: #666;
  margin-top: 1rem;
  font-style: italic;
}

/* Four Pillars Display Component Styles */
.four-pillars-display {
  margin: 2rem 0;
}

.pillars-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.pillars-header h2 {
  margin: 0;
  color: #333;
}

/* Chart Controls */
.chart-controls {
  display: flex;
  gap: 0.5rem;
}

.chart-toggle {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chart-toggle:hover {
  background: #f0f0f0;
}

.chart-toggle.active {
  background: #6a1b9a;
  color: white;
  border-color: #6a1b9a;
}

/* Summary Section */
.pillars-summary {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
  margin-top: 2rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.summary-item h4 {
  margin: 0 0 0.5rem 0;
  color: #555;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Day Master Display */
.day-master {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.day-master-info {
  font-size: 1.1rem;
  color: #333;
  font-weight: 500;
}

/* Balance Score */
.balance-score {
  display: flex;
  justify-content: center;
}

.score-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #6a1b9a;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-value {
  font-size: 1.5rem;
  font-weight: bold;
}

.score-unit {
  font-size: 0.875rem;
  opacity: 0.8;
}

/* Element Distribution Bars */
.element-distribution {
  width: 100%;
}

.element-bar {
  display: flex;
  align-items: center;
  margin: 0.5rem 0;
  gap: 0.5rem;
}

.element-name {
  min-width: 60px;
  font-size: 0.875rem;
  text-transform: capitalize;
}

.bar-container {
  flex: 1;
  height: 20px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  transition: width 0.5s ease;
}

.bar-fill.wood {
  background-color: #4caf50;
}
.bar-fill.fire {
  background-color: #f44336;
}
.bar-fill.earth {
  background-color: #ff9800;
}
.bar-fill.metal {
  background-color: #607d8b;
}
.bar-fill.water {
  background-color: #2196f3;
}

.element-percentage {
  min-width: 40px;
  text-align: right;
  font-size: 0.875rem;
  color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
  .pillars-container {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }

  .pillars-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .chart-controls {
    width: 100%;
    justify-content: space-between;
  }
}

/* Print Styles */
@media print {
  .chart-controls,
  .chart-toggle {
    display: none;
  }

  .pillars-container {
    page-break-inside: avoid;
  }

  .pillar {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
