/* 深色古风八字算命表单样式 */

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

:root {
  /* 深色古风主题 */
  --bg-primary: #0d0d0d;
  --bg-secondary: #1a1a1a;
  --bg-card: #1f1f1f;
  --bg-card-hover: #252525;
  
  /* 金色系 */
  --gold-primary: #c9a962;
  --gold-light: #e8d5a3;
  --gold-dark: #8b7355;
  
  /* 朱红色系 */
  --red-primary: #b54434;
  --red-light: #d4654a;
  
  /* 文字色 */
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0a0;
  --text-muted: #6b6b6b;
  
  /* 边框色 */
  --border-color: #333;
  --border-light: #444;
  
  /* 间距 */
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  
  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

html, body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  padding: var(--spacing-lg);
  position: relative;
}

/* 装饰背景 */
.bg-decoration {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(ellipse at top, rgba(201, 169, 98, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at bottom, rgba(181, 68, 52, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* 页面标题 */
.page-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
  position: relative;
  z-index: 1;
}

.main-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold-primary);
  margin-bottom: var(--spacing-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
}

.title-icon {
  font-size: 1.5rem;
  opacity: 0.8;
  display: inline-block;
  animation: rotate 8s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.sub-title {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* 表单区域 */
.bazi-form {
  position: relative;
  z-index: 1;
}

.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold-primary);
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--spacing-sm);
}

.section-icon {
  font-size: 0.8rem;
  color: var(--red-primary);
}

.section-note {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: auto;
}

/* 表单网格 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
}

.birth-grid {
  grid-template-columns: repeat(3, 1fr);
}

/* 表单组 */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.form-group-full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* 输入框 */
.form-input,
.form-select {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 2px rgba(201, 169, 98, 0.2);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* datetime-local 日历选择器样式 */
.form-input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7) sepia(1) saturate(3) hue-rotate(10deg);
  cursor: pointer;
}

/* 隐藏datetime-local原生的年/月/日格式提示 */
.form-input[type="datetime-local"]::-webkit-datetime-edit {
  opacity: 0;
}

/* 只有选择有效值后才显示日期时间 */
.form-input[type="datetime-local"]:valid::-webkit-datetime-edit {
  opacity: 1;
}

/* datetime-local placeholder 模拟 */
.datetime-wrapper {
  position: relative;
  display: block;
  cursor: pointer;
  min-height: 48px;
  box-sizing: border-box;
}

/* 让 input 铺满 wrapper，扩大可点击区域 */
.datetime-wrapper .form-input[type="datetime-local"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 48px;
  margin: 0;
  cursor: pointer;
  z-index: 1;
  box-sizing: border-box;
}

.datetime-placeholder {
  position: absolute;
  left: var(--spacing-md);
  right: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.9rem;
  transition: opacity 0.2s;
  z-index: 0;
  line-height: 1.4;
}

.datetime-placeholder.hidden {
  opacity: 0;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23c9a962' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* 单选按钮组 */
.radio-group {
  display: flex;
  gap: var(--spacing-md);
}

.radio-group-three {
  flex-wrap: wrap;
}

.radio-item {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.radio-item input[type="radio"] {
  display: none;
}

.radio-label {
  padding: var(--spacing-xs) var(--spacing-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all 0.3s;
}

.radio-item input[type="radio"]:checked + .radio-label {
  background: var(--gold-dark);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

/* 位置组 */
.location-group {
  display: contents;
}

/* 提交按钮 */
.form-actions {
  text-align: center;
  margin-top: var(--spacing-xl);
  position: relative;
  z-index: 1;
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-xl);
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
  border: none;
  border-radius: var(--radius-lg);
  color: var(--bg-primary);
  font-size: 1.1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  min-width: 200px;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(201, 169, 98, 0.3);
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* 加载动画 */
.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--bg-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 错误提示 */
.error-msg {
  background: rgba(181, 68, 52, 0.2);
  border: 1px solid var(--red-primary);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  color: var(--red-light);
  text-align: center;
  margin-top: var(--spacing-lg);
  position: relative;
  z-index: 1;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .container {
    padding: var(--spacing-md);
  }
  
  .main-title {
    font-size: 1.5rem;
    gap: var(--spacing-sm);
  }
  
  .title-icon {
    font-size: 1.2rem;
  }
  
  .form-section {
    padding: var(--spacing-md);
  }
  
  .section-title {
    font-size: 1rem;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .birth-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .radio-group {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
  }
  
  /* 性别和历类型：两列布局 */
  .radio-group.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm) 15px;
  }
  
  .radio-group.two-col .radio-item {
    margin: 0;
  }
  
  .radio-group.two-col .radio-label {
    width: 100%;
    text-align: center;
  }
  
  /* 移动端真太阳时选项布局：不使用单独一行，其他两列 */
  .radio-group-three {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm) 15px;
  }
  
  .radio-group-three .radio-item:first-child {
    grid-column: 1 / -1;
  }
  
  .radio-group-three .radio-item:first-child .radio-label {
    width: 100%;
    text-align: center;
  }
  
  .radio-group-three .radio-item:not(:first-child) .radio-label {
    width: 100%;
    text-align: center;
  }
  
  .submit-btn {
    width: 100%;
    padding: var(--spacing-md);
  }
}

/* 表单页热门问答 */
.form-faq-section {
  background: var(--bg-primary);
  padding: var(--spacing-lg) var(--spacing-md) var(--spacing-xl);
  margin-top: var(--spacing-md);
}

.form-faq-container {
  max-width: 800px;
  margin: 0 auto;
}

.form-faq-title {
  text-align: center;
  font-size: 1.5rem;
  color: var(--gold-primary);
  margin-bottom: var(--spacing-xl);
  font-weight: 600;
}

.form-faq-title .title-icon {
  display: inline-block;
  animation: rotate 8s linear infinite;
  margin: 0 0.5rem;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.form-faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.form-faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
}

.form-faq-item:hover {
  border-color: var(--gold-dark);
}

.form-faq-question {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  cursor: pointer;
  user-select: none;
}

.form-faq-q {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--gold-primary);
  color: var(--bg-primary);
  border-radius: 50%;
  font-weight: bold;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.form-faq-question-text {
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 500;
  flex: 1;
}

.form-faq-answer {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.8;
  max-height: 0;
  padding: 0 60px;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.form-faq-item.active .form-faq-answer {
  max-height: 1000px;
  padding: 0 var(--spacing-lg) var(--spacing-md) 60px;
}

.form-faq-item.active {
  border-color: var(--gold-primary);
}

/* 移动端FAQ适配 */
@media (max-width: 768px) {
  .form-faq-section {
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-lg);
    margin-top: var(--spacing-sm);
  }
  
  .form-faq-title {
    font-size: 1.25rem;
  }
  
  .form-faq-question {
    padding: var(--spacing-md);
  }
  
  .form-faq-question-text {
    font-size: 0.9rem;
  }
  
  .form-faq-answer {
    padding: 0 44px;
    font-size: 0.85rem;
  }
  
  .form-faq-item.active .form-faq-answer {
    padding: 0 var(--spacing-md) var(--spacing-md) 44px;
  }
}

/* 页脚（与首页一致） */
.footer {
  text-align: center;
  padding: var(--spacing-xl) 0;
  margin-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
}

.footer-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-text a {
  color: var(--gold-primary);
  text-decoration: none;
}
