/* =============================================
   bestaitoolguides.com - Main Stylesheet
   ============================================= */

:root {
  --primary: #10b981;
  --primary-dark: #059669;
  --secondary: #3b82f6;
  --secondary-dark: #2563eb;
  --accent: #8b5cf6;
  --dark: #0f172a;
  --gray-900: #1e293b;
  --gray-700: #334155;
  --gray-500: #64748b;
  --gray-300: #cbd5e1;
  --gray-100: #f1f5f9;
  --white: #ffffff;
  --star-filled: #f59e0b;
  --star-empty: #e2e8f0;
  --pro: #10b981;
  --con: #ef4444;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width: 1200px;
  --header-height: 68px;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-sans);
  color: var(--gray-900);
  background: var(--white);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--secondary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--secondary-dark); }

img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 { line-height: 1.3; color: var(--dark); font-weight: 700; }
h1 { font-size: 2.4rem; margin-bottom: .8rem; }
h2 { font-size: 1.8rem; margin: 2rem 0 .8rem; }
h3 { font-size: 1.35rem; margin: 1.5rem 0 .5rem; }
p { margin-bottom: 1.2rem; color: var(--gray-700); }

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  height: var(--header-height);
  display: flex;
  align-items: center;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}
.site-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -.03em;
}
.site-logo span { color: var(--primary); }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a {
  font-size: .9rem;
  font-weight: 500;
  color: var(--gray-700);
  transition: color .2s;
}
.nav-links a:hover { color: var(--primary-dark); }

/* --- Hero --- */
.hero {
  background: linear-gradient(135deg, #ecfdf5 0%, #eff6ff 50%, #f5f3ff 100%);
  padding: 80px 0 60px;
  text-align: center;
}
.hero h1 { font-size: 2.8rem; max-width: 800px; margin: 0 auto .6rem; }
.hero p {
  font-size: 1.15rem;
  color: var(--gray-500);
  max-width: 650px;
  margin: 0 auto 2rem;
}
.hero-badge {
  display: inline-block;
  background: var(--primary);
  color: var(--white);
  font-size: .8rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 1.2rem;
}

/* --- Section --- */
.section { padding: 60px 0; }
.section-title {
  text-align: center;
  margin-bottom: 2.5rem;
}
.section-title h2 { margin-bottom: .4rem; }
.section-title p { color: var(--gray-500); max-width: 550px; margin: 0 auto; }

/* --- Cards Grid --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
}
.card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow .25s, transform .2s;
}
.card:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,.07);
  transform: translateY(-2px);
}
.card-body { padding: 24px; }
.card-category {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--primary-dark);
  background: #ecfdf5;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 10px;
}
.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--dark);
}
.card-title a { color: inherit; }
.card-title a:hover { color: var(--primary-dark); }
.card-excerpt {
  font-size: .9rem;
  color: var(--gray-500);
  margin-bottom: 14px;
}
.card-meta {
  font-size: .8rem;
  color: var(--gray-300);
  display: flex;
  align-items: center;
  gap: 12px;
}
.read-more {
  font-weight: 600;
  font-size: .9rem;
  color: var(--secondary);
}
.read-more:hover { color: var(--secondary-dark); }

/* --- Category Nav --- */
.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 2rem;
}
.category-nav a {
  background: var(--gray-100);
  color: var(--gray-700);
  padding: 8px 20px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  transition: .2s;
}
.category-nav a:hover {
  background: var(--primary);
  color: var(--white);
}

/* --- Article Page --- */
.article-wrapper {
  max-width: 780px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}
.article-header { margin-bottom: 2rem; }
.article-header .breadcrumbs {
  font-size: .85rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
}
.article-header .breadcrumbs a { color: var(--gray-500); }
.article-header h1 { font-size: 2.2rem; margin-bottom: .6rem; }
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: .88rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
}
.article-meta span { display: flex; align-items: center; gap: 4px; }

/* --- Rating Stars --- */
.rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 1rem 0;
}
.star {
  width: 22px;
  height: 22px;
  display: inline-block;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  background: var(--star-empty);
}
.star.filled { background: var(--star-filled); }
.star.half { background: linear-gradient(90deg, var(--star-filled) 50%, var(--star-empty) 50%); }

.rating-text {
  font-size: .9rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-left: 8px;
}

/* --- Pros / Cons --- */
.pros-cons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 2rem 0;
}
.pros-box, .cons-box {
  padding: 20px;
  border-radius: 10px;
}
.pros-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}
.cons-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
}
.pros-box h3, .cons-box h3 { margin-top: 0; font-size: 1.1rem; }
.pros-box h3 { color: var(--pro); }
.cons-box h3 { color: var(--con); }
.pros-box ul, .cons-box ul { list-style: none; padding: 0; }
.pros-box li, .cons-box li {
  padding: 4px 0;
  font-size: .92rem;
  color: var(--gray-700);
}
.pros-box li::before { content: '✓ '; color: var(--pro); font-weight: 700; }
.cons-box li::before { content: '✗ '; color: var(--con); font-weight: 700; }

/* --- Tables --- */
.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
thead th {
  background: var(--gray-900);
  color: var(--white);
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: top;
}
tbody tr:hover { background: var(--gray-100); }
tbody tr:nth-child(even) { background: #f8fafc; }

/* --- FAQ --- */
.faq-item {
  border: 1px solid var(--gray-100);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-question {
  padding: 16px 20px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  background: var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-question::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--gray-500);
}
.faq-question.active::after { content: '−'; }
.faq-answer {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease, padding .3s ease;
}
.faq-answer.open {
  padding: 16px 20px;
  max-height: 500px;
}

/* --- Comparison Table --- */
.comparison-table th:first-child,
.comparison-table td:first-child { min-width: 140px; }

/* --- Footer --- */
.site-footer {
  background: var(--dark);
  color: var(--gray-300);
  padding: 50px 0 30px;
  margin-top: 60px;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 30px;
}
.footer-col h4 {
  color: var(--white);
  font-size: 1rem;
  margin-bottom: 14px;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a {
  color: var(--gray-300);
  font-size: .9rem;
}
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid var(--gray-700);
  padding-top: 24px;
  text-align: center;
  font-size: .85rem;
  color: var(--gray-500);
}

/* --- Page: About, Contact, Privacy, Terms --- */
.page-content { max-width: 780px; margin: 0 auto; padding: 50px 20px; }
.page-content h1 { margin-bottom: 1rem; }

/* --- Contact Form --- */
.contact-form label { display: block; font-weight: 600; margin: 1rem 0 .3rem; font-size: .9rem; }
.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-family: inherit;
  font-size: .95rem;
  transition: border-color .2s;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.contact-form textarea { min-height: 150px; }
.btn {
  display: inline-block;
  background: var(--primary);
  color: var(--white);
  padding: 11px 28px;
  border-radius: 8px;
  font-weight: 600;
  font-size: .95rem;
  border: none;
  cursor: pointer;
  transition: background .2s;
}
.btn:hover { background: var(--primary-dark); color: var(--white); }

/* --- Ad / Analytics Placeholders --- */
.adsense-placeholder {
  background: var(--gray-100);
  border: 2px dashed var(--gray-300);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  font-size: .8rem;
  color: var(--gray-500);
  margin: 1.5rem 0;
}

/* --- Newsletter --- */
.newsletter {
  background: var(--gray-100);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  margin: 3rem 0;
}
.newsletter h3 { margin-bottom: .5rem; }
.newsletter p { color: var(--gray-500); font-size: .95rem; margin-bottom: 1.2rem; }
.newsletter-form {
  display: flex;
  max-width: 450px;
  margin: 0 auto;
  gap: 8px;
}
.newsletter-form input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: .95rem;
}

/* --- Related Posts --- */
.related-posts { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--gray-100); }
.related-posts h3 { margin-bottom: 1rem; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.related-card {
  background: var(--gray-100);
  border-radius: 8px;
  padding: 16px;
  transition: .2s;
}
.related-card:hover { background: #e2e8f0; }
.related-card a { color: var(--dark); font-weight: 600; font-size: .92rem; }
.related-card .meta { font-size: .8rem; color: var(--gray-500); margin-top: 4px; }

/* --- Reading Progress --- */
.reading-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .85rem;
  color: var(--gray-500);
}

/* --- TOC --- */
.toc {
  background: var(--gray-100);
  border-radius: 8px;
  padding: 20px 24px;
  margin: 2rem 0;
}
.toc h3 { margin-bottom: .6rem; font-size: 1rem; }
.toc ol { padding-left: 20px; }
.toc li { margin-bottom: 4px; font-size: .9rem; }
.toc a { color: var(--gray-700); }
.toc a:hover { color: var(--primary-dark); }

/* --- Responsive --- */
@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }
  .hero { padding: 50px 0 40px; }
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }
  .card-grid { grid-template-columns: 1fr; }
  .pros-cons { grid-template-columns: 1fr; }
  .article-wrapper { padding: 24px 16px 40px; }
  .article-header h1 { font-size: 1.6rem; }
  .newsletter-form { flex-direction: column; }
  .nav-links { gap: 14px; }
  .nav-links a { font-size: .85rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .site-logo { font-size: 1.1rem; }
  .hero h1 { font-size: 1.6rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .category-nav { gap: 8px; }
  .category-nav a { padding: 6px 14px; font-size: .82rem; }
}

/* --- Print --- */
@media print {
  .site-header, .site-footer, .newsletter, .adsense-placeholder { display: none; }
  body { font-size: 12pt; }
  a { color: inherit; }
}
