/* 塔罗牌网站 - 粉紫色碎花主题 */

/* ===== 基础变量 ===== */
:root {
  /* 粉紫色配色 */
  --primary-lightest: #F5EEF3;
  --primary-light: #E8D5E0;
  --primary: #C9B1C9;
  --primary-medium: #B899B8;
  --primary-dark: #9B7B9B;
  --primary-darker: #7A5D7A;

  /* 辅助色 */
  --accent-rose: #D4A5A5;
  --accent-lavender: #D4C5E2;
  --accent-cream: #F8F4F0;
  --accent-gold: #D4B896;

  /* 中性色 */
  --background: #FAF7F5;
  --background-dark: #F0EBE8;
  --card-bg: #FFFFFF;
  --text: #5A4A5A;
  --text-light: #8A7A8A;
  --text-lighter: #B5A5B5;
  --border: #E5D8E5;
  --border-light: #F0E5F0;

  /* 功能色 */
  --success: #A8C5A8;
  --warning: #E5C5A8;
  --error: #D4A5A5;
  --info: #A8B8D4;

  /* 阴影 */
  --shadow-sm: 0 2px 8px rgba(155, 123, 155, 0.08);
  --shadow-md: 0 4px 20px rgba(155, 123, 155, 0.12);
  --shadow-lg: 0 8px 32px rgba(155, 123, 155, 0.16);
  --shadow-card: 0 4px 16px rgba(155, 123, 155, 0.1);

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50%;

  /* 字体 */
  --font-serif: 'Playfair Display', 'Noto Serif SC', 'Source Han Serif CN', serif;
  --font-sans: 'Inter', 'Noto Sans SC', 'Source Han Sans CN', sans-serif;

  /* 过渡 */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  position: relative;
}

/* 碎花背景图案 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cpath d='M20,50 Q25,40 30,50 T40,50' stroke='%23E8D5E0' stroke-width='1' fill='none' opacity='0.4'/%3E%3Ccircle cx='25' cy='45' r='3' fill='%23D4C5E2' opacity='0.3'/%3E%3Ccircle cx='35' cy='52' r='2' fill='%23C9B1C9' opacity='0.3'/%3E%3Cpath d='M70,20 Q75,10 80,20 T90,20' stroke='%23E8D5E0' stroke-width='1' fill='none' opacity='0.4'/%3E%3Ccircle cx='75' cy='15' r='2.5' fill='%23D4A5A5' opacity='0.25'/%3E%3Cpath d='M60,70 Q65,60 70,70 T80,70' stroke='%23D4C5E2' stroke-width='1' fill='none' opacity='0.35'/%3E%3Ccircle cx='65' cy='65' r='2' fill='%23C9B1C9' opacity='0.3'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ===== 排版 ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 2rem;
  margin-bottom: 1.25rem;
}

h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

h4 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-darker);
}

/* ===== 布局 ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

.main-content {
  min-height: calc(100vh - 200px);
  padding: 2rem 0;
}

/* ===== 导航 ===== */
.navbar {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--text);
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent-rose));
  transition: width var(--transition-normal);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a.active {
  color: var(--primary-dark);
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: white;
}

.btn-secondary {
  background: white;
  color: var(--primary-dark);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  background: var(--primary-lightest);
  color: var(--primary-darker);
}

.btn-ghost {
  background: transparent;
  color: var(--primary-dark);
}

.btn-ghost:hover {
  background: var(--primary-lightest);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* ===== 卡片 ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.card-text {
  color: var(--text-light);
  font-size: 0.95rem;
}

/* ===== 表单 ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text);
  background: white;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201, 177, 201, 0.2);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.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='%239B7B9B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* ===== 塔罗牌样式 ===== */
.tarot-card {
  position: relative;
  width: 100%;
  max-width: 200px;
  aspect-ratio: 2/3.5;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  background: linear-gradient(135deg, var(--primary-lightest) 0%, var(--accent-cream) 100%);
}

.tarot-card:hover {
  transform: translateY(-8px) rotateY(5deg);
  box-shadow: var(--shadow-lg);
}

.tarot-card.reversed {
  transform: rotate(180deg);
}

.tarot-card.reversed:hover {
  transform: rotate(180deg) translateY(-8px);
}

.tarot-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tarot-card-back {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-darker) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.tarot-card-back::before {
  content: '🌙';
  font-size: 3rem;
  opacity: 0.5;
}

.tarot-card-back::after {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: calc(var(--radius-md) - 4px);
}

.tarot-card-info {
  margin-top: 0.75rem;
  text-align: center;
}

.tarot-card-name {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.tarot-card-position {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

.tarot-card-orientation {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  margin-top: 0.25rem;
}

.tarot-card-orientation.upright {
  background: var(--primary-lightest);
  color: var(--primary-dark);
}

.tarot-card-orientation.reversed {
  background: var(--accent-rose);
  color: white;
}

/* ===== 首页英雄区 ===== */
.hero {
  text-align: center;
  padding: 4rem 0 3rem;
  position: relative;
}

.hero-title {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--accent-rose) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== 功能卡片网格 ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 2rem 0;
}

.feature-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-normal);
  border: 1px solid var(--border-light);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.feature-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, var(--primary-lightest) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.feature-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.feature-description {
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

/* ===== 页脚 ===== */
.footer {
  background: var(--primary-lightest);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ===== 装饰元素 ===== */
.floral-decoration {
  position: absolute;
  opacity: 0.15;
  pointer-events: none;
}

.floral-decoration.top-left {
  top: 0;
  left: 0;
}

.floral-decoration.bottom-right {
  bottom: 0;
  right: 0;
  transform: rotate(180deg);
}

/* 分割线装饰 */
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
  color: var(--primary);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* ===== 响应式 ===== */

/* 平板适配 */
@media (max-width: 768px) {
  .navbar .container {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-links {
    gap: 1rem;
    font-size: 0.9rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

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

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }
}

/* 手机端适配 */
@media (max-width: 480px) {
  /* 导航栏紧凑 */
  .navbar {
    padding: 0.5rem 0;
  }

  .navbar .container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .logo {
    font-size: 1.2rem;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .nav-links {
    gap: 0.5rem;
    font-size: 0.8rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-links a {
    padding: 0.25rem 0.5rem;
  }

  /* 容器边距减小 */
  .container {
    padding: 0 1rem;
  }

  /* 首页 */
  .hero {
    padding: 2rem 0;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .hero-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .hero-actions .btn {
    width: 100%;
    max-width: 280px;
  }

  /* 功能卡片 */
  .features-grid {
    gap: 1rem;
    padding: 1rem 0;
  }

  .feature-card {
    padding: 1.25rem;
  }

  .feature-icon {
    width: 60px;
    height: 60px;
    font-size: 1.75rem;
  }

  .feature-title {
    font-size: 1.25rem;
  }

  /* 塔罗牌尺寸调整 */
  .tarot-card {
    max-width: 120px;
  }

  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }

  .card-item-image {
    aspect-ratio: 2/3.2;
  }

  .card-item-name {
    font-size: 0.8rem;
  }

  /* 牌阵布局调整 */
  .spread-layout {
    gap: 0.75rem;
  }

  .card-slot {
    max-width: 100px;
  }

  .card-slot .tarot-card {
    max-width: 100px;
  }

  .card-slot-label {
    font-size: 0.8rem;
  }

  .card-slot-description {
    font-size: 0.7rem;
    max-width: 100px;
  }

  /* 按钮尺寸 */
  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
  }

  .btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }

  /* 模态框全屏 */
  .modal {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-body {
    max-height: calc(100vh - 80px);
  }

  .card-detail {
    flex-direction: column;
    align-items: center;
  }

  .card-detail-image {
    width: 150px;
  }

  /* 表单 */
  .form-input,
  .form-textarea,
  .form-select {
    padding: 0.625rem 0.875rem;
    font-size: 16px; /* 防止iOS缩放 */
  }

  /* 归档列表 */
  .reading-item {
    padding: 1rem;
  }

  .reading-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .reading-title {
    font-size: 1.1rem;
  }

  /* 设置页面 */
  .settings-container {
    padding: 0 0.5rem;
  }

  .settings-section {
    padding: 1rem;
  }

  /* 步骤指示器 */
  .draw-steps {
    gap: 0.5rem;
  }

  .step {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
  }

  /* 牌阵选择卡片 */
  .spreads-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .spread-card {
    padding: 1rem;
  }

  .spread-icon {
    font-size: 2rem;
  }

  .spread-name {
    font-size: 1rem;
  }

  /* 笔记区域 */
  .notes-section {
    padding: 1rem;
  }

  .card-notes-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .card-notes-image {
    width: 50px;
    height: 87px;
  }

  /* 详情网格 */
  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .detail-card-image {
    width: 100px;
    height: 175px;
  }

  /* AI区域 */
  .ai-section {
    padding: 1rem;
  }

  .ai-content {
    padding: 1rem;
    font-size: 0.9rem;
  }

  /* 浮动按钮 */
  .new-archive-btn {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
    bottom: 1rem;
    right: 1rem;
  }

  /* 页脚 */
  .footer {
    padding: 1.5rem 0;
    font-size: 0.85rem;
  }
}

/* 超小屏幕 */
@media (max-width: 360px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .nav-links {
    font-size: 0.75rem;
    gap: 0.25rem;
  }

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

/* ===== 动画 ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.animate-fade-in {
  animation: fadeIn 0.6s ease forwards;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* ===== 标签 ===== */
.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
}

.tag-primary {
  background: var(--primary-lightest);
  color: var(--primary-dark);
}

.tag-secondary {
  background: var(--accent-cream);
  color: var(--text);
}

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(90, 74, 90, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text);
}

/* ===== 提示框 ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1001;
  transform: translateX(150%);
  transition: transform var(--transition-normal);
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--error);
}

/* ===== 加载动画 ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem;
}

.loading-dot {
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  animation: loadingBounce 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes loadingBounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}
