/* =====================================================
   国学命理测算网站 - 通用样式
   纯PHP项目·无依赖
   ===================================================== */

/* ============ Reset & Base ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --r-sm: 8px; --r-md: 12px; --r-lg: 20px;
  --tr: 0.3s ease;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --container: 1200px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  line-height: 1.6; color: #333; background: #f8f7f5; min-height: 100vh;
}
a { color: inherit; text-decoration: none; transition: color var(--tr); }
a:hover { color: var(--c-accent, #c8a878); }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

/* ============ Layout ============ */
.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.page-wrap { min-height: calc(100vh - 200px); padding-top: 64px; }
.section { padding: 48px 0; }
.section-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 8px; text-align: center; }
.section-sub { text-align: center; color: #999; margin-bottom: 32px; font-size: 0.95rem; }

/* ============ Grid ============ */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============ Card ============ */
.card {
  background: #fff; border-radius: var(--r-lg); padding: 24px;
  box-shadow: var(--shadow-sm); transition: all var(--tr);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 28px; border-radius: var(--r-md); font-size: 1rem; font-weight: 600;
  transition: all var(--tr); border: 2px solid transparent; white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, #c8a878, #b8935e); color: #fff; }
.btn-secondary { background: #fff; color: #c8a878; border-color: #c8a878; }
.btn-ghost { background: transparent; color: #666; }
.btn-lg { padding: 16px 40px; font-size: 1.1rem; }
.btn-sm { padding: 8px 16px; font-size: 0.875rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ============ Navbar ============ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000; height: 64px;
  display: flex; align-items: center; transition: all var(--tr);
  background: rgba(255,255,255,0.1); backdrop-filter: blur(10px);
}
.navbar.scrolled { background: rgba(255,255,255,0.98); box-shadow: var(--shadow-sm); }
.navbar-inner { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; }
.navbar-logo { display: flex; align-items: center; gap: 8px; font-size: 1.25rem; font-weight: 800; color: #333; }
.navbar-menu { display: flex; gap: 28px; }
.navbar-menu a { font-size: 0.95rem; color: #555; font-weight: 500; }
.navbar-menu a:hover { color: #c8a878; }
.navbar-right { display: flex; align-items: center; gap: 16px; }
.navbar-search { background: rgba(255,255,255,0.5); border-radius: 20px; padding: 8px 16px; border: 1px solid #eee; width: 200px; }
.navbar-user { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.navbar-user img { width: 36px; height: 36px; border-radius: 50%; }
.navbar-burger { display: none; font-size: 1.5rem; cursor: pointer; background: none; }

/* ============ Banner ============ */
.banner { position: relative; padding: 80px 0 60px; overflow: hidden; text-align: center; }
.banner h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 16px; }
.banner p { font-size: 1.1rem; color: #666; margin-bottom: 32px; }
.banner-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ============ Tool Grid ============ */
.tool-card { text-align: center; cursor: pointer; }
.tool-card .icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.tool-card .name { font-weight: 700; margin-bottom: 4px; }
.tool-card .desc { font-size: 0.875rem; color: #999; }

/* ============ Form ============ */
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 600; color: #555; }
.form-label .req { color: #e74c3c; }
.form-control {
  width: 100%; padding: 12px 16px; border: 2px solid #e5e5e5; border-radius: var(--r-md);
  font-size: 1rem; transition: border-color var(--tr); background: #fff;
}
.form-control:focus { outline: none; border-color: #c8a878; }
.form-control:disabled { background: #f5f5f5; }
.form-error { color: #e74c3c; font-size: 0.875rem; margin-top: 6px; display: none; }
.form-error.show { display: block; }
.form-hint { color: #999; font-size: 0.85rem; margin-top: 6px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }

/* ============ Result ============ */
.result-card { background: #fff; border-radius: var(--r-lg); padding: 32px; box-shadow: var(--shadow-sm); margin-bottom: 24px; }
.result-free { margin-bottom: 24px; }
.result-free h3 { font-size: 1.25rem; margin-bottom: 16px; }
.result-free .tag { display: inline-block; padding: 4px 12px; background: #f0ede8; border-radius: 20px; font-size: 0.8rem; color: #8b7355; margin: 4px; }
.unlock-box { text-align: center; padding: 32px; background: linear-gradient(135deg, #fdf8f0, #f5ede0); border-radius: var(--r-lg); margin-bottom: 24px; }
.unlock-box h3 { font-size: 1.3rem; margin-bottom: 12px; }
.unlock-box p { color: #888; margin-bottom: 20px; }
.unlock-box .price { font-size: 2rem; color: #c8a878; font-weight: 800; margin-bottom: 16px; }
.result-full { padding: 24px; background: #faf9f7; border-radius: var(--r-lg); line-height: 1.8; white-space: pre-wrap; }

/* ============ Tip(赞赏) ============ */
.tip-box { background: #fff; border-radius: var(--r-lg); padding: 24px; text-align: center; margin: 24px 0; box-shadow: var(--shadow-sm); }
.tip-box h3 { font-size: 1.1rem; margin-bottom: 8px; }
.tip-box p { color: #999; font-size: 0.875rem; margin-bottom: 16px; }
.tip-amounts { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.tip-amount { padding: 10px 20px; border: 2px solid #e5e5e5; border-radius: var(--r-md); font-weight: 700; cursor: pointer; transition: all var(--tr); background: #fff; }
.tip-amount:hover, .tip-amount.active { border-color: #c8a878; color: #c8a878; background: #fdf8f0; }
.tip-custom { width: 120px; text-align: center; }

/* ============ Poster Preview ============ */
.poster-preview { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.poster-preview-inner { max-width: 90%; max-height: 90vh; }
.poster-preview img { max-width: 100%; max-height: 80vh; border-radius: var(--r-md); }
.poster-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }

/* ============ User Center ============ */
.user-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding: 32px 0; min-height: 600px; }
.user-sidebar { background: #fff; border-radius: var(--r-lg); padding: 20px; height: fit-content; }
.user-menu a { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-md); color: #555; font-weight: 500; transition: all var(--tr); }
.user-menu a:hover { background: #f5f3f0; }
.user-menu a.active { background: linear-gradient(135deg, #fdf8f0, #f5ede0); color: #c8a878; }
.user-content { background: #fff; border-radius: var(--r-lg); padding: 32px; }

/* ============ Master Card ============ */
.master-card { display: flex; gap: 16px; min-width: 320px; }
.master-card .avatar { width: 80px; height: 80px; border-radius: 50%; background: linear-gradient(135deg, #c8a878, #b8935e); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: #fff; }
.master-card .info { flex: 1; }
.master-card .name { font-weight: 700; font-size: 1.1rem; margin-bottom: 4px; }
.master-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.master-card .tag { padding: 2px 8px; background: #f0ede8; border-radius: 12px; font-size: 0.75rem; color: #8b7355; }
.master-card .rating { color: #e6a23c; }
.master-card .price { color: #c8a878; font-weight: 700; }

/* ============ Empty State ============ */
.empty { text-align: center; padding: 60px 20px; color: #999; }
.empty .icon { font-size: 3rem; margin-bottom: 16px; }
.empty p { margin-bottom: 20px; }

/* ============ Pagination ============ */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 32px; }
.page-btn { padding: 8px 14px; border: 1px solid #e5e5e5; border-radius: var(--r-sm); cursor: pointer; transition: all var(--tr); background: #fff; }
.page-btn:hover { border-color: #c8a878; color: #c8a878; }
.page-btn.active { background: #c8a878; color: #fff; border-color: #c8a878; }

/* ============ Footer ============ */
.footer { background: #2a2a2a; color: #aaa; padding: 40px 0 20px; margin-top: 60px; }
.footer-inner { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 24px; }
.footer-grid h4 { color: #ddd; font-size: 1rem; margin-bottom: 12px; }
.footer-grid a { display: block; padding: 4px 0; font-size: 0.875rem; }
.footer-grid a:hover { color: #fff; }
.footer-bottom { text-align: center; padding-top: 20px; border-top: 1px solid #444; font-size: 0.8rem; }

/* ============ Badge ============ */
.badge-vip { display: inline-block; padding: 2px 10px; background: linear-gradient(135deg, #ffd700, #d4a017); color: #fff; border-radius: 12px; font-size: 0.75rem; font-weight: 700; }
.badge-member { display: inline-block; padding: 2px 10px; background: #c8a878; color: #fff; border-radius: 12px; font-size: 0.75rem; font-weight: 700; }

/* ============ Modal ============ */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 2000; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.show { display: flex; }
.modal-inner { background: #fff; border-radius: var(--r-lg); padding: 32px; max-width: 420px; width: 100%; }
.modal h3 { font-size: 1.25rem; margin-bottom: 16px; text-align: center; }

/* ============ Loading ============ */
.loading { display: inline-block; width: 20px; height: 20px; border: 2px solid #ddd; border-top-color: #c8a878; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Responsive ============ */
@media (max-width: 768px) {
  .navbar-menu { display: none; }
  .navbar-burger { display: block; }
  .navbar-search { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-2.mobile-2, .grid-3.mobile-2, .grid-4.mobile-2 { grid-template-columns: repeat(2, 1fr); }
  .banner h1 { font-size: 1.75rem; }
  .user-layout { grid-template-columns: 1fr; }
  .user-sidebar { order: 2; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .section { padding: 32px 0; }
  .section-title { font-size: 1.4rem; }
}

@media (max-width: 480px) {
  .grid-2.mobile-2, .grid-3.mobile-2, .grid-4.mobile-2 { grid-template-columns: 1fr; }
  .banner { padding: 40px 0 30px; }
  .banner h1 { font-size: 1.5rem; }
  .card { padding: 16px; }
  .tip-amounts { flex-direction: column; align-items: center; }
}
