/*
 * Main CSS for Product Review Website
 * Optimized for performance and responsiveness
 */

/* ===== CSS Reset and Base Styles ===== */
:root {
  --primary-color: #3b82f6;
  --primary-darker: #2563eb;
  --secondary-color: #1e293b;
  --accent-color: #f59e0b;
  --text-color: #334155;
  --light-text: #64748b;
  --background-color: #ffffff;
  --light-gray: #f8fafc;
  --border-color: #e2e8f0;
  --success-color: #10b981;
  --error-color: #ef4444;
  --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --box-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --border-radius: 0.5rem;
  --border-radius-lg: 0.75rem;
  --transition: all 0.2s ease;
  --container-width: 1200px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --transition-fast: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --header-height: 4rem;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  overflow-y: scroll;
  overscroll-behavior-y: none;
  height: 100%;
}

body {
  font-family: var(--font-family);
  color: var(--text-color);
  line-height: 1.6;
  background-color: var(--background-color);
  position: relative;
  min-height: 100%;
  overflow-x: hidden;
  /* Prevent content jumps during scrolling */
  overflow-anchor: none;
}

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

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

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

ul {
  list-style: none;
}

/* ===== Layout Containers ===== */
.container {
  width: 90%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1rem;
}

section {
  padding: 4rem 0;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--secondary-color);
}

h1 {
  font-size: 2.5rem;
}

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

h2:after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -0.5rem;
  width: 3rem;
  height: 0.25rem;
  background-color: var(--primary-color);
  border-radius: 2px;
}

h3 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1.5rem;
}

.lead {
  font-size: 1.25rem;
  font-weight: 300;
  line-height: 1.5;
}

/* ===== Header ===== */
.site-header {
  background-color: var(--background-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 1rem 0;
  transition: var(--transition-smooth);
  will-change: transform, opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.site-header.scrolled {
  box-shadow: var(--box-shadow);
  padding: 0.75rem 0;
}

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

.logo a {
  display: flex;
  align-items: center;
}

.site-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--secondary-color);
}

.main-nav {
  display: flex;
  align-items: center;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

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

.nav-links a:after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--primary-color);
  transition: width 0.2s ease;
}

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

/* ===== Mobile Menu Styling ===== */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  height: 20px;
  width: 30px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
  position: relative;
}

.menu-toggle .bar {
  width: 100%;
  height: 3px;
  background-color: var(--secondary-color);
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* Animation for hamburger to X */
.menu-toggle.active .bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active .bar:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active .bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.menu-toggle .bar.animate:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.menu-toggle .bar.animate:nth-child(2) {
  opacity: 0;
}

.menu-toggle .bar.animate:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ===== Hero Section ===== */
.hero {
  padding: 6rem 0;
  background-color: var(--primary-color);
  color: white;
}

.hero h1 {
  color: white;
}

.hero .lead {
  color: rgba(255, 255, 255, 0.9);
}

/* ===== Cards ===== */
.reviews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.review-card {
  border-radius: var(--border-radius);
  overflow: hidden;
  background-color: white;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  height: 100%;
}

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

.review-image {
  height: 200px;
  overflow: hidden;
}

.review-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.review-card:hover .review-image img {
  transform: scale(1.05);
}

.review-content {
  padding: 1.5rem;
}

.review-title {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.review-category {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background-color: var(--light-gray);
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--primary-color);
}

.review-rating {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.stars {
  display: flex;
  margin-right: 0.5rem;
}

.review-snippet {
  color: var(--light-text);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.read-more {
  font-weight: 600;
  color: var(--primary-color);
  position: relative;
  padding-right: 1.25rem;
}

.read-more:after {
  content: '→';
  position: absolute;
  right: 0;
  transition: transform 0.2s ease;
}

.read-more:hover:after {
  transform: translateX(5px);
}

/* ===== Categories ===== */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 2rem;
}

.category-card {
  border-radius: var(--border-radius);
  padding: 2rem;
  text-align: center;
  background-color: white;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

.category-card h3 {
  margin-top: 1rem;
}

.category-card:hover h3 {
  color: var(--primary-color);
}

.category-icon {
  font-size: 2.5rem;
  color: var(--accent-color);
  margin-bottom: 1rem;
}

/* ===== Footer ===== */
.site-footer {
  background-color: var(--secondary-color);
  padding: 3rem 0 1rem;
  margin-top: 4rem;
  position: relative;
}

.site-footer h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: white;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section {
  padding: 0 1rem;
}

.footer-section p {
  color: white !important;
  margin-bottom: 1rem;
}

.footer-section a {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

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

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: white !important;
  font-size: 0.875rem;
}

.social-icons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  transition: var(--transition);
}

.social-icons a:hover {
  transform: translateY(-3px);
  background-color: var(--primary-color);
  color: white;
}

/* ===== Back to Top Button ===== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 999;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: var(--primary-darker);
}

/* ===== Media Queries ===== */
@media (max-width: 992px) {
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
    z-index: 1001;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 400px;
    height: 100vh;
    background-color: white;
    flex-direction: column;
    align-items: flex-start;
    padding: 5rem 2rem 2rem;
    transition: right 0.3s ease;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
  }

  .nav-links.active {
    right: 0;
  }

  .nav-links li {
    width: 100%;
    margin-bottom: 1rem;
  }

  .nav-links a {
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.5rem 0;
    font-size: 1.1rem;
  }

  .nav-links a:after {
    display: none;
  }

  .nav-links a:hover {
    color: var(--primary-color);
  }
  
  /* Add overlay when mobile menu is open */
  body.nav-open::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  .footer-content {
    grid-template-columns: 1fr;
  }

  /* Ensure article containers use full width without excessive margins */
  .container,
  .article-container,
  .content-container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
  }
  
  /* Adjust article body text for readability */
  p, li, blockquote {
    font-size: 16px !important;
    line-height: 1.6 !important;
  }
  
  /* Make sure headers are properly sized */
  h1 {
    font-size: 24px !important;
    line-height: 1.3 !important;
  }
  
  h2 {
    font-size: 22px !important;
    line-height: 1.3 !important;
  }
  
  h3 {
    font-size: 20px !important;
    line-height: 1.3 !important;
  }
}

@media (max-width: 576px) {
  section {
    padding: 3rem 0;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .hero {
    padding: 4rem 0;
  }

  .reviews-grid,
  .categories-grid {
    grid-template-columns: 1fr;
  }
}

/* Extreme small screen fixes */
@media (max-width: 480px) {
  /* Further reduce padding to maximize content space */
  .container,
  .article-container,
  .content-container {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
}

/* Add smooth scrolling behavior for the website */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

/* Improve focus styles for accessibility */
:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Add styles for focus-visible for better UX */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Conversion Tools Showcase Section */
.conversion-tools-showcase {
  background-color: var(--light-gray);
  padding: 5rem 0;
}

.conversion-tools-showcase h2 {
  text-align: center;
}

.section-description {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 3rem;
  color: var(--light-text);
  font-size: 1.1rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
}

.tool-card {
  background-color: var(--background-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
}

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

.tool-header {
  background: linear-gradient(to right, var(--primary-color), var(--primary-darker));
  padding: 1.25rem 1.5rem;
  color: white;
}

.tool-header h3 {
  margin: 0;
  color: white;
  font-size: 1.25rem;
  font-weight: 600;
}

.tool-preview {
  padding: 1.5rem;
  flex: 1;
}

.tool-preview > * {
  transform: scale(0.9);
  margin: 0 auto;
}

.tool-preview .pros-cons-container,
.tool-preview .price-alert,
.tool-preview .social-proof-container,
.tool-preview .urgency-container {
  box-shadow: none;
  margin: 0;
}

/* Responsive adjustments for tools showcase */
@media (max-width: 768px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }

  .conversion-tools-showcase {
    padding: 4rem 0;
  }

  .section-description {
    margin-bottom: 2rem;
  }
}

/* Enhanced Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3.5rem;
  height: 3.5rem;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 99;
  box-shadow: 0 5px 15px rgba(37, 99, 235, 0.25);
  will-change: transform, opacity;
  transform: translateZ(0);
}

.back-to-top:before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: inherit;
  border-radius: inherit;
  z-index: -1;
  opacity: 0.7;
  transform: scale(0);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.back-to-top i {
  font-size: 1.25rem;
  transition: transform 0.3s ease;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.back-to-top:hover:before {
  transform: scale(1.5);
  opacity: 0;
}

.back-to-top:hover i {
  transform: translateY(-2px);
}

.back-to-top:active {
  transform: translateY(-2px);
}

/* Improve content section spacing */
section + section {
  padding-top: 0;
}

/* Make review cards clickable with proper styling */
a.review-card {
  color: inherit;
  text-decoration: none;
  display: block;
  height: 100%;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

a.review-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

a.review-card:hover .read-more {
  color: var(--primary-darker);
}

a.review-card:hover .review-title {
  color: var(--primary-color);
}

a.review-card .read-more {
  position: relative;
  display: inline-block;
  color: var(--primary-color);
  font-weight: 600;
  margin-top: 1rem;
}

a.review-card .read-more:after {
  content: "→";
  margin-left: 0.5rem;
  transition: transform 0.2s ease;
}

a.review-card:hover .read-more:after {
  transform: translateX(4px);
}

/* ===== Featured and Latest Reviews - FIXED WITH EXACT CLASS TARGETING ===== */

/* Ensure grid layout is fixed at exactly 3 columns */
#featured-reviews-container,
#latest-reviews-container {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 2rem !important;
  max-width: 1200px !important;
  margin: 2rem auto 0 !important;
}

/* Hard limit of 3 items using nth-child selector with extremely high specificity */
#featured-reviews-container > *:nth-child(n+4),
#latest-reviews-container > *:nth-child(n+4) {
  display: none !important;
}

/* Target all possible review elements with max specificity */
#featured-reviews-container > a,
#featured-reviews-container > div,
#latest-reviews-container > a,
#latest-reviews-container > div {
  color: inherit !important;
  text-decoration: none !important;
  display: block !important;
  height: 100% !important;
  cursor: pointer !important;
}

/* Specific targeting for review items */
.review-item {
  margin-bottom: 1rem !important;
  max-width: 100% !important;
}

/* Make sure review-content is properly styled within cards */
.review-content {
  padding: 1.5rem !important;
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

/* Responsive adjustments with high specificity */
@media (max-width: 992px) {
  #featured-reviews-container,
  #latest-reviews-container {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 576px) {
  #featured-reviews-container,
  #latest-reviews-container {
    grid-template-columns: 1fr !important;
  }
}

/* Scroll Stabilization */
html {
  scroll-behavior: smooth;
  height: 100%;
  overflow-y: scroll;
  overscroll-behavior-y: none;
}

body {
  position: relative;
  min-height: 100%;
  overflow-x: hidden;
  /* Prevent content jumps during scrolling */
  overflow-anchor: none;
}

/* Force hardware acceleration to reduce visual glitches */
.site-header,
.site-footer,
.back-to-top,
.search-overlay {
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
}

/* Prevent animations from causing layout shifts */
[data-aos] {
  transform: translateZ(0);
  will-change: transform, opacity;
  pointer-events: none;
}

[data-aos].aos-animate {
  pointer-events: auto;
}

/* Stabilize sticky elements */
.sticky-element {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Fix height calculations for dynamically loaded content */
.review-content,
.related-reviews {
  contain: layout style;
}