/* Professional Luopan Card CSS Template */
/* Shared styling for all traditional feng shui analysis cards */

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Microsoft YaHei", "SimHei", Arial, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: #333;
  line-height: 1.6;
}

#app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header styling */
.app-header {
  text-align: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2rem;
  margin-bottom: 2rem;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.app-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  font-weight: 300;
}

/* Control Panel */
.control-panel {
  background: white;
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-group label {
  font-weight: 600;
  color: #444;
  font-size: 1rem;
}

.mountain-selector,
.period-selector,
.angle-slider {
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: #fafafa;
}

.mountain-selector:focus,
.period-selector:focus,
.angle-slider:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.yuan-controls,
.house-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.yuan-controls input[type="radio"],
.house-controls input[type="radio"] {
  margin-right: 0.5rem;
}

.yuan-controls label,
.house-controls label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: normal;
}

.calculate-button,
.analyze-button,
.optimize-button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calculate-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.analyze-button {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.optimize-button {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.calculate-button:hover,
.analyze-button:hover,
.optimize-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Main Content Layout */
.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

/* Luopan Container */
.luopan-container {
  background: white;
  border-radius: 15px;
  padding: 1.5rem;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

#luopan-canvas {
  border: 2px solid #ddd;
  border-radius: 50%;
  background: radial-gradient(circle, #fafafa 0%, #f0f0f0 100%);
  cursor: grab;
  transition: all 0.3s ease;
}

#luopan-canvas:active {
  cursor: grabbing;
}

.precision-indicator {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: #f8f9fa;
  border-radius: 20px;
  font-size: 0.9rem;
  color: #666;
  border: 1px solid #e9ecef;
}

.luopan-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.direction-arrow {
  position: absolute;
  width: 3px;
  height: 200px;
  transform-origin: center bottom;
  pointer-events: none;
}

.dragon-arrow {
  background: linear-gradient(to top, #2e8b57, #90ee90);
  box-shadow: 0 0 10px rgba(46, 139, 87, 0.5);
}

.water-arrow {
  background: linear-gradient(to top, #4169e1, #87ceeb);
  box-shadow: 0 0 10px rgba(65, 105, 225, 0.5);
}

/* Analysis Panel */
.analysis-panel {
  background: white;
  border-radius: 15px;
  padding: 1.5rem;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  max-height: 600px;
}

.analysis-section,
.info-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}

.analysis-section:last-child,
.info-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.analysis-section h3,
.info-section h3 {
  color: #444;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  border-left: 4px solid #667eea;
  padding-left: 1rem;
}

.star-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.star-cell {
  aspect-ratio: 1;
  border: 2px solid #ddd;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  background: #fafafa;
  transition: all 0.3s ease;
}

.star-cell.center {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  border-color: #f39c12;
  font-size: 1.4rem;
}

.star-cell.excellent {
  background: linear-gradient(135deg, #2e8b57, #90ee90);
  color: white;
  border-color: #228b22;
}

.star-cell.good {
  background: linear-gradient(135deg, #4169e1, #87ceeb);
  color: white;
  border-color: #1e90ff;
}

.star-cell.declining {
  background: linear-gradient(135deg, #ff8c00, #ffd700);
  color: white;
  border-color: #ff6347;
}

.star-cell.harmful {
  background: linear-gradient(135deg, #dc143c, #ff6347);
  color: white;
  border-color: #b22222;
}

.ling-zheng-item,
.result-item,
.config-item,
.aixing-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.label {
  font-weight: 600;
  color: #444;
}

/* Mountains Panel */
.mountains-panel {
  background: white;
  border-radius: 15px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.mountains-panel h3 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #444;
  font-size: 1.3rem;
}

.current-hexagram,
.hexagram-meaning {
  text-align: center;
  margin-bottom: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.mountains-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.mountain-cell {
  aspect-ratio: 1;
  border: 1px solid #ddd;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  background: #fafafa;
  transition: all 0.3s ease;
  cursor: pointer;
}

.mountain-cell:hover {
  background: #e3f2fd;
  border-color: #2196f3;
  transform: scale(1.05);
}

.mountain-cell.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-color: #5a67d8;
}

/* Recommendations Panel */
.recommendations-panel {
  background: white;
  border-radius: 15px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.recommendations-panel h3 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #444;
  font-size: 1.3rem;
}

.recommendation-category {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 4px solid #667eea;
}

.recommendation-category h4 {
  margin-bottom: 0.75rem;
  color: #555;
  font-size: 1.1rem;
}

/* Info Panel */
.info-panel {
  background: white;
  border-radius: 15px;
  padding: 1.5rem;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  max-height: 600px;
}

/* Legend */
.legend {
  background: white;
  border-radius: 15px;
  padding: 1.5rem;
  margin-top: 2rem;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.legend h4 {
  margin-bottom: 1rem;
  color: #444;
  text-align: center;
}

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

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 6px;
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #ddd;
}

.legend-color.excellent {
  background: #2e8b57;
}

.legend-color.good {
  background: #4169e1;
}

.legend-color.declining {
  background: #ff8c00;
}

.legend-color.harmful {
  background: #dc143c;
}

.legend-color.zheng-shen {
  background: #228b22;
}

.legend-color.ling-shen {
  background: #4682b4;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .control-panel {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 768px) {
  #app-container {
    padding: 10px;
  }

  .app-header {
    padding: 1.5rem;
  }

  .app-header h1 {
    font-size: 2rem;
  }

  .control-panel {
    padding: 1.5rem;
    grid-template-columns: 1fr;
  }

  .luopan-container {
    padding: 1rem;
  }

  #luopan-canvas {
    width: 100%;
    max-width: 500px;
    height: auto;
  }

  .mountains-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  }

  .legend-items {
    grid-template-columns: 1fr;
  }
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.analysis-section,
.info-section,
.recommendation-category {
  animation: fadeInUp 0.6s ease-out;
}

/* Loading State */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  font-size: 1.1rem;
  color: #666;
}

.loading::after {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid #ddd;
  border-top: 2px solid #667eea;
  border-radius: 50%;
  margin-left: 1rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Error State */
.error {
  color: #dc143c;
  background: #ffe6e6;
  border: 1px solid #ffcccc;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  text-align: center;
}

/* Success State */
.success {
  color: #2e8b57;
  background: #e6ffe6;
  border: 1px solid #ccffcc;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  text-align: center;
}
