/**
 * 运势走向图 - H5响应式样式
 * 支持移动端和PC端自适应
 */

/* ============ 基础重置 ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
               'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

/* ============ 容器 ============ */
.container {
  max-width: 100%;
  padding: 20px;
  min-height: 100vh;
  position: relative;
}

/* ============ 头部 ============ */
.header {
  text-align: center;
  padding: 30px 20px;
  position: relative;
  z-index: 1;
}

.app-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: white;
  margin-bottom: 10px;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  letter-spacing: 2px;
}

.app-subtitle {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ============ 卡片区域 ============ */
.section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.15);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.6s ease-out;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    rgba(102, 126, 234, 0.6), 
    rgba(118, 75, 162, 0.6), 
    rgba(102, 126, 234, 0.6)
  );
  border-radius: 5px 5px 0 0;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 20px;
  text-align: center;
  padding: 8px 0;
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: #667eea;
  border-radius: 2px;
}

/* ============ 表单 ============ */
.form-container {
  margin-bottom: 20px;
}

.picker-group {
  margin-bottom: 20px;
}

.label {
  display: block;
  font-size: 1rem;
  color: #333;
  margin-bottom: 12px;
  font-weight: 600;
}

/* 日期时间选择器容器 - 单行 flex-wrap，小屏自动换行 */
.datetime-picker-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* 日期/时间行 - 让子元素直接参与父级 flex */
.date-picker-row,
.time-picker-row {
  display: contents;
}

.picker-select {
  flex: 1;
  min-width: 70px;
  padding: 12px 15px;
  font-size: 1rem;
  border: 2px solid #e1e1e1;
  border-radius: 12px;
  background-color: white;
  color: #333;
  cursor: pointer;
  transition: all 0.3s ease;
  appearance: none;
  -webkit-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='%23667eea' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 35px;
}

/* 日期选择器宽度优化 - 年份需要更多空间 */
.picker-select.year {
  flex: 1.4;
  min-width: 90px;
}

.picker-select.month,
.picker-select.day {
  flex: 0.8;
  min-width: 70px;
}

.picker-select.hour,
.picker-select.minute {
  flex: 0.7;
  min-width: 65px;
}

.picker-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.picker-select:active {
  transform: scale(0.98);
}

.picker-separator {
  color: #667eea;
  font-size: 0.95rem;
  flex-shrink: 0;
  font-weight: 500;
}

/* 性别选择 */
.gender-picker-row {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 15px;
  border: 2px solid rgba(224, 224, 224, 0.5);
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 1.05rem;
  color: #333;
  transition: color 0.3s ease;
}

.radio-label:hover {
  color: #667eea;
}

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

.radio-custom {
  width: 22px;
  height: 22px;
  border: 2px solid #ddd;
  border-radius: 50%;
  position: relative;
  transition: all 0.3s ease;
}

.radio-label input[type="radio"]:checked + .radio-custom {
  border-color: #667eea;
  background-color: #667eea;
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

/* ============ 按钮 ============ */
.button-container {
  text-align: center;
  margin-top: 25px;
}

.btn {
  display: inline-block;
  width: 100%;
  max-width: 320px;
  padding: 15px 30px;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  margin: 8px 0;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.ad-note {
  font-size: 0.85rem;
  color: #777;
  margin-top: 15px;
  text-align: center;
}

/* ============ 图表区域 ============ */
.chart-section {
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

.chart-container {
  width: 100%;
  height: 300px;
  position: relative;
  margin-top: 15px;
}

#fortuneChart {
  width: 100% !important;
  height: 100% !important;
}

/* ============ 底部 ============ */
.footer {
  text-align: center;
  padding: 30px 20px;
  color: rgba(255, 255, 255, 0.8);
}

.copyright {
  font-size: 0.9rem;
}

.icp-beian {
  display: block;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  margin-top: 8px;
  transition: color 0.3s ease;
}

.icp-beian:hover {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: underline;
}

/* ============ Toast提示 ============ */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 15px 30px;
  border-radius: 10px;
  font-size: 1rem;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* ============ 响应式布局 ============ */

/* 小屏幕手机 */
@media (max-width: 375px) {
  .container {
    padding: 15px;
  }
  
  .section {
    padding: 20px 15px;
    border-radius: 15px;
  }
  
  .app-title {
    font-size: 1.8rem;
  }
  
  .app-subtitle {
    font-size: 0.9rem;
  }
  
  .datetime-picker-container {
    gap: 6px;
  }

  .picker-select {
    min-width: 55px;
    padding: 10px 8px;
    font-size: 0.9rem;
    padding-right: 28px;
    background-position: right 8px center;
  }
  
  .picker-select.year {
    flex: 1.2;
    min-width: 68px;
  }
  
  .picker-select.month,
  .picker-select.day,
  .picker-select.hour,
  .picker-select.minute {
    flex: 0.9;
    min-width: 55px;
  }

  .picker-separator {
    display: none;
  }
  
  .gender-picker-row {
    gap: 25px;
  }
  
  .btn {
    padding: 13px 25px;
    font-size: 1rem;
  }
  
  .chart-container {
    height: 250px;
  }
}

/* 大屏幕手机 */
@media (min-width: 376px) and (max-width: 768px) {
  .container {
    max-width: 600px;
    margin: 0 auto;
    padding: 25px;
  }
  
  .section {
    padding: 30px 25px;
  }
}

/* 平板 */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    max-width: 700px;
    margin: 0 auto;
    padding: 30px;
  }
  
  .section {
    padding: 35px 30px;
  }
  
  .app-title {
    font-size: 2.5rem;
  }
  
  .picker-select {
    max-width: 120px;
  }
  
  .picker-select.year {
    max-width: 140px;
  }
  
  .btn {
    max-width: 350px;
  }
  
  .chart-container {
    height: 350px;
  }
}

/* 桌面端 */
@media (min-width: 1025px) {
  .container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
  }
  
  .section {
    padding: 40px 35px;
    border-radius: 25px;
  }
  
  .app-title {
    font-size: 2.8rem;
  }
  
  .app-subtitle {
    font-size: 1.1rem;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  .form-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
  }
  
  .picker-group {
    flex: 1;
    min-width: 280px;
  }
  
  .picker-select {
    max-width: 130px;
  }
  
  .picker-select.year {
    max-width: 160px;
    flex: 1.6;
  }
  
  .picker-select.month,
  .picker-select.day {
    flex: 0.9;
  }
  
  .picker-select.hour,
  .picker-select.minute {
    flex: 0.8;
  }
  
  .gender-picker-row {
    justify-content: flex-start;
    padding: 20px;
  }
  
  .button-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
  }
  
  .btn {
    width: auto;
    min-width: 180px;
    flex: 1;
    max-width: 280px;
  }
  
  .ad-note {
    width: 100%;
  }
  
  .chart-section {
    margin-top: 30px;
  }
  
  .chart-container {
    height: 400px;
  }
  
  /* 悬停效果 */
  .section:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
  }
  
  .btn {
    transition: all 0.3s ease;
  }
}

/* ============ 动画 ============ */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.loading {
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============ 滚动条美化 ============ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* ============ 安全区域适配 ============ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .container {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  
  .footer {
    padding-bottom: calc(30px + env(safe-area-inset-bottom));
  }
}

/* ============ 打印样式 ============ */
@media print {
  body {
    background: white;
  }
  
  .container {
    max-width: 100%;
    padding: 20px;
  }
  
  .btn {
    display: none;
  }
}