/* ============================================================
   SaaS Template — 可复用 CSS 框架
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* 颜色 — 改这里全局换色 */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --accent: #0ea5e9;
  --text: #1e293b;
  --text-muted: #64748b;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --border: #e2e8f0;
  --success: #22c55e;
  --danger: #ef4444;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1140px;
  --content-width: 780px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* --- Layout --- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }
.container-narrow { max-width: var(--content-width); margin: 0 auto; padding: 0 1.25rem; }

/* --- Navigation --- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 0; border-bottom: 1px solid var(--border);
}
.nav-brand { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.nav-brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { color: var(--text-muted); font-size: 0.95rem; font-weight: 500; }
.nav-links a:hover { color: var(--primary); text-decoration: none; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; transition: 0.3s; }

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    flex-direction: column; padding: 1rem 1.25rem; gap: 0.75rem;
    box-shadow: var(--shadow-md);
  }
  .nav-links.open { display: flex; }
}

/* --- Hero Section --- */
.hero {
  text-align: center; padding: 5rem 0 3rem;
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg) 100%);
}
.hero h1 { font-size: 2.75rem; font-weight: 800; line-height: 1.2; margin-bottom: 1rem; }
.hero p { font-size: 1.2rem; color: var(--text-muted); max-width: 600px; margin: 0 auto 2rem; }

@media (min-width: 900px) {
  .hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 3rem; align-items: center; text-align: left; padding: 6rem 0 4rem; }
  .hero-content { order: 1; }
  .hero-visual { order: 2; display: flex; justify-content: center; }
}

/* --- Buttons --- */
.btn {
  display: inline-block; padding: 0.75rem 1.75rem; border-radius: var(--radius);
  font-size: 1rem; font-weight: 600; cursor: pointer; border: none;
  transition: all 0.2s ease; text-decoration: none; text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; text-decoration: none; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }
.btn-group { display: flex; gap: 1rem; flex-wrap: wrap; }

@media (max-width: 640px) {
  .btn-group { flex-direction: column; }
  .btn-group .btn { width: 100%; }
}

/* --- Cards --- */
.card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.5rem; box-shadow: var(--shadow-sm); transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

/* --- Features Section --- */
.features { padding: 4rem 0; }
.section-title { text-align: center; font-size: 2rem; font-weight: 700; margin-bottom: 0.75rem; }
.section-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 3rem; font-size: 1.1rem; }
.feature-icon { font-size: 2rem; margin-bottom: 1rem; }
.feature-card h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-muted); font-size: 0.95rem; }

/* --- Pricing Section --- */
.pricing { padding: 4rem 0; background: var(--bg-alt); }
.pricing-card { text-align: center; }
.pricing-card .price { font-size: 2.5rem; font-weight: 800; color: var(--primary); margin: 1rem 0 0.5rem; }
.pricing-card .price span { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.pricing-card ul { list-style: none; text-align: left; margin: 1.5rem 0; }
.pricing-card ul li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 0.95rem; }
.pricing-card ul li::before { content: '✓'; color: var(--primary); font-weight: 700; margin-right: 0.5rem; }
.pricing-highlight { border: 2px solid var(--primary); position: relative; }

/* --- CTA Section --- */
.cta-section { padding: 4rem 0; text-align: center; }

/* --- Footer --- */
.footer { padding: 3rem 0 2rem; border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-grid h4 { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text); margin-bottom: 0.75rem; }
.footer-grid a { display: block; color: var(--text-muted); font-size: 0.9rem; padding: 0.2rem 0; }
.footer-grid a:hover { color: var(--primary); text-decoration: none; }
.footer-brand { font-size: 1.15rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.footer-desc { color: var(--text-muted); font-size: 0.9rem; }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* --- Forms (Auth pages) --- */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-alt); }
.auth-card { background: var(--bg); padding: 2.5rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand a { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.auth-brand a:hover { text-decoration: none; }
.auth-card h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.auth-card .subtitle { color: var(--text-muted); margin-bottom: 2rem; font-size: 0.95rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 0.4rem; }
.form-group input { width: 100%; padding: 0.7rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; transition: border 0.2s; }
.form-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.form-footer { text-align: center; margin-top: 1.5rem; font-size: 0.9rem; color: var(--text-muted); }
.form-divider { display: flex; align-items: center; gap: 1rem; margin: 1.5rem 0; color: var(--text-muted); font-size: 0.85rem; }
.form-divider::before, .form-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn-social { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem 1.75rem; border-radius: var(--radius); font-size: 1rem; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.btn-social:hover { background: var(--bg-alt); }
.form-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: var(--text-muted); cursor: pointer; }
.text-sm { font-size: 0.9rem; }

/* --- Admin Dashboard --- */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; background: var(--text); color: #fff; padding: 1.5rem 0;
  display: flex; flex-direction: column;
}
.admin-sidebar .brand { font-size: 1.15rem; font-weight: 700; padding: 0 1.25rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 1rem; }
.admin-sidebar a { color: rgba(255,255,255,0.7); display: block; padding: 0.6rem 1.25rem; font-size: 0.95rem; transition: 0.2s; }
.admin-sidebar a:hover, .admin-sidebar a.active { color: #fff; background: rgba(255,255,255,0.08); text-decoration: none; }
.admin-main { flex: 1; background: var(--bg-alt); }
.admin-header {
  background: var(--bg); padding: 1rem 2rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.admin-header h1 { font-size: 1.25rem; font-weight: 600; }
.admin-user { display: flex; align-items: center; gap: 1rem; }
.admin-username { font-size: 0.9rem; color: var(--text-muted); }
.admin-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.9rem; }
.admin-content { padding: 2rem; }

/* Admin: Stats cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg); padding: 1.25rem; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.stat-card .stat-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-change { font-size: 0.8rem; font-weight: 600; margin-top: 0.25rem; }
.stat-up { color: var(--success); }
.stat-down { color: var(--danger); }

/* Admin: Table */
.table-wrapper { background: var(--bg); border-radius: var(--radius-lg); border: 1px solid var(--border); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { background: var(--bg-alt); font-weight: 600; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fee2e2; color: #991b1b; }

/* Admin: Mobile Sidebar Toggle */
.admin-toggle {
  display: none; background: none; border: none; cursor: pointer;
  padding: 0.5rem; font-size: 1.5rem; color: var(--text);
}
.admin-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99;
}
.admin-overlay.open { display: block; }

/* Admin: Responsive */
@media (max-width: 768px) {
  .admin-toggle { display: block; }
  .admin-sidebar {
    position: fixed; left: -260px; top: 0; bottom: 0; z-index: 100;
    transition: left 0.3s ease; width: 260px;
  }
  .admin-sidebar.open { left: 0; }
  .admin-content { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Blog --- */
.blog-list { padding: 3rem 0 4rem; }
.blog-grid { display: grid; gap: 2rem; }
.blog-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.75rem; transition: box-shadow 0.2s; }
.blog-card:hover { box-shadow: var(--shadow-md); }
.blog-card h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
.blog-card h2 a { color: var(--text); }
.blog-card h2 a:hover { color: var(--primary); text-decoration: none; }
.blog-card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1rem; line-height: 1.7; }
.blog-date { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.read-more { font-size: 0.9rem; font-weight: 600; }

/* --- Content Pages (About, Privacy, Terms) --- */
.content-page { padding: 3rem 0 4rem; }
.page-title { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; }
.page-subtitle { color: var(--text-muted); margin-bottom: 2.5rem; font-size: 1.1rem; }

.prose { line-height: 1.8; }
.prose h2 { font-size: 1.25rem; font-weight: 600; margin: 2rem 0 0.75rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.prose h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.prose p { color: var(--text-muted); margin-bottom: 1rem; }
.prose ul { margin: 1rem 0; padding-left: 1.5rem; }
.prose li { color: var(--text-muted); margin-bottom: 0.5rem; }

/* --- Contact --- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.contact-card { background: var(--bg-alt); border-radius: var(--radius-lg); padding: 2rem; text-align: center; }
.contact-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.contact-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.contact-card p { color: var(--text-muted); font-size: 0.9rem; }

/* --- Utilities --- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none; }

/* --- Social Proof (optional) --- */
.social-proof { padding: 2rem 0; text-align: center; }
.logo-strip { display: flex; justify-content: center; align-items: center; gap: 2.5rem; flex-wrap: wrap; opacity: 0.5; }
