/* === CSS Reset & Variables === */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --ad-bg: #fafbfc;
}

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

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;
}

/* === Layout === */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* === Header === */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}
.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-icon { width: 32px; height: 32px; background: linear-gradient(135deg, var(--primary), #7c3aed); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; font-size: 14px; }
.nav-links { display: flex; gap: 8px; list-style: none; }
.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--primary); background: var(--primary-light); }
.nav-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text); }

/* === Hero === */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg) 100%);
}
.hero h1 { font-size: 2.8rem; font-weight: 800; line-height: 1.15; margin-bottom: 16px; letter-spacing: -0.02em; }
.hero h1 span { background: linear-gradient(135deg, var(--primary), #7c3aed); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 1.15rem; color: var(--text-secondary); max-width: 640px; margin: 0 auto 32px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline { background: var(--bg); color: var(--primary); border: 2px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); background: var(--primary-light); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 16px 32px; font-size: 1.05rem; }

/* === Tool Cards Grid === */
.section-title { font-size: 1.8rem; font-weight: 700; margin-bottom: 32px; text-align: center; }
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 48px 0;
}
.tool-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.tool-card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.tool-card h3 { font-size: 1.15rem; font-weight: 600; }
.tool-card p { font-size: 0.9rem; color: var(--text-secondary); flex: 1; }
.tool-card .arrow { color: var(--primary); font-weight: 600; font-size: 0.85rem; }

/* === Ad Container === */
.ad-container {
  background: var(--ad-bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin: 32px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.ad-horizontal { min-height: 90px; }
.ad-vertical { min-height: 600px; width: 300px; }
.ad-in-article { min-height: 250px; margin: 24px 0; }

/* === Tool Page Layout === */
.tool-page { padding: 48px 0; }
.tool-page-header { text-align: center; margin-bottom: 40px; }
.tool-page-header h1 { font-size: 2.2rem; font-weight: 700; margin-bottom: 12px; }
.tool-page-header p { color: var(--text-secondary); max-width: 600px; margin: 0 auto; }
.tool-layout { display: grid; grid-template-columns: 1fr 300px; gap: 32px; }
.tool-main { min-width: 0; }

/* === Upload Zone === */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-secondary);
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
.upload-zone-icon { font-size: 3rem; margin-bottom: 12px; }
.upload-zone h3 { font-weight: 600; margin-bottom: 4px; }
.upload-zone p { color: var(--text-muted); font-size: 0.85rem; }
.upload-zone input[type="file"] { display: none; }

/* === Settings Panel === */
.settings-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 24px;
}
.settings-panel h3 { font-weight: 600; margin-bottom: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-group select, .form-group input[type="range"], .form-group input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--bg);
}
.form-group input[type="range"] { padding: 8px 0; }
.range-value { font-size: 0.85rem; color: var(--primary); font-weight: 600; }

/* === Preview === */
.preview-area { margin-top: 24px; }
.preview-area h3 { font-weight: 600; margin-bottom: 12px; }
.preview-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.preview-box img { max-width: 100%; max-height: 400px; object-fit: contain; }
.preview-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.preview-compare .preview-box { min-height: 250px; }
.compare-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; text-align: center; margin-bottom: 4px; }

/* === Results Bar === */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 20px;
}
.results-stats { display: flex; gap: 24px; }
.stat-item { text-align: center; }
.stat-value { font-size: 1.1rem; font-weight: 700; color: var(--success); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); }

/* === Sidebar === */
.sidebar { position: sticky; top: 80px; align-self: start; }
.sidebar-section { margin-bottom: 24px; }
.sidebar-section h4 { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 12px; }
.sidebar-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.sidebar-links a { text-decoration: none; color: var(--text-secondary); font-size: 0.9rem; padding: 6px 0; display: block; transition: color 0.15s; }
.sidebar-links a:hover { color: var(--primary); }

/* === Features Section === */
.features { padding: 64px 0; background: var(--bg-secondary); }
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 32px; }
.feature-item { text-align: center; padding: 24px; }
.feature-icon { font-size: 2rem; margin-bottom: 12px; }
.feature-item h3 { font-weight: 600; margin-bottom: 8px; }
.feature-item p { font-size: 0.9rem; color: var(--text-secondary); }

/* === How-To Section === */
.how-to { padding: 64px 0; }
.steps { max-width: 680px; margin: 0 auto; }
.step { display: flex; gap: 20px; margin-bottom: 32px; }
.step-num {
  width: 36px; height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.step-content h3 { font-weight: 600; margin-bottom: 4px; }
.step-content p { color: var(--text-secondary); font-size: 0.9rem; }

/* === Footer === */
.site-footer {
  background: var(--text);
  color: #cbd5e1;
  padding: 48px 0 24px;
  margin-top: 64px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}
.footer-col h4 { color: #fff; font-weight: 600; margin-bottom: 16px; }
.footer-col p { font-size: 0.85rem; line-height: 1.7; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul a { color: #94a3b8; text-decoration: none; font-size: 0.85rem; transition: color 0.15s; }
.footer-col ul a:hover { color: #fff; }
.footer-bottom {
  max-width: var(--max-width);
  margin: 32px auto 0;
  padding: 24px 24px 0;
  border-top: 1px solid #334155;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: #64748b;
}

/* === Blog === */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; padding: 48px 0; }
.blog-card { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: all 0.2s; }
.blog-card:hover { box-shadow: var(--shadow-lg); }
.blog-card-body { padding: 24px; }
.blog-card-body h3 { font-size: 1.1rem; margin-bottom: 8px; }
.blog-card-body h3 a { color: var(--text); text-decoration: none; }
.blog-card-body h3 a:hover { color: var(--primary); }
.blog-card-body p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 12px; }
.blog-meta { font-size: 0.8rem; color: var(--text-muted); }

/* === Article Page === */
.article { max-width: 720px; margin: 0 auto; padding: 48px 24px; }
.article h1 { font-size: 2.2rem; font-weight: 700; margin-bottom: 16px; line-height: 1.3; }
.article h2 { font-size: 1.4rem; font-weight: 600; margin: 32px 0 12px; }
.article p { margin-bottom: 16px; color: var(--text-secondary); line-height: 1.8; }
.article ul, .article ol { margin: 0 0 16px 24px; color: var(--text-secondary); }
.article li { margin-bottom: 8px; line-height: 1.7; }
.article .article-meta { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 32px; }

/* === FAQ === */
.faq { padding: 64px 0; max-width: 720px; margin: 0 auto; }
.faq h2 { text-align: center; margin-bottom: 40px; }
.faq-item { border-bottom: 1px solid var(--border); padding: 20px 0; }
.faq-item h3 { font-weight: 600; margin-bottom: 8px; font-size: 1rem; cursor: pointer; }
.faq-item p { color: var(--text-secondary); font-size: 0.9rem; }

/* === Page Content === */
.page-content { max-width: 720px; margin: 0 auto; padding: 48px 24px; }
.page-content h1 { font-size: 2rem; font-weight: 700; margin-bottom: 24px; }
.page-content h2 { font-size: 1.3rem; font-weight: 600; margin: 28px 0 12px; }
.page-content p { margin-bottom: 16px; color: var(--text-secondary); line-height: 1.8; }
.page-content ul { margin: 0 0 16px 24px; color: var(--text-secondary); }
.page-content li { margin-bottom: 8px; line-height: 1.7; }

/* === Responsive === */
@media (max-width: 900px) {
  .tool-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 2rem; }
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--border); flex-direction: column; padding: 8px; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
}
@media (max-width: 560px) {
  .hero h1 { font-size: 1.6rem; }
  .tools-grid { grid-template-columns: 1fr; }
  .blog-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .results-stats { flex-direction: column; gap: 8px; }
  .preview-compare { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
}
