/* Main CSS for Math Solver Website */

/* Base :root - can be empty or contain non-theme-specific variables */
:root {
  /* Define non-theme-specific variables if any */
}

/* Light Theme Styles (New Magenta Glow Theme) */
:root.theme-light {
  --primary-bg: #FAF7FB; /* Very light lavender/pink for general page background */
  --secondary-bg: #FFFFFF; 
  --card-bg: var(--secondary-bg); /* Cards will be white on the light pinkish bg */
  
  /* Text Colors */
  --primary-text: #000000; /* Main text on light backgrounds */
  --secondary-text: #000000; /* Amoled black */
  --text-on-gradient: #FFFFFF; /* For text on header/hero gradient */

  /* Accent Colors (Magenta/Purple Palette from image) */
  --accent-color: #E91E63;   /* Magenta - Primary Accent */
  --accent-color-2: #C86DD7; /* Purplish-pink - Secondary Accent */
  --accent-color-3: #0719e0; /* A mid-tone for gradients or less prominent accents */

  /* Header & Hero */
  --header-bg: url('../img/light_theme_header_bg.jpg'); /* New image for Light theme header */
  --hero-bg: linear-gradient(to bottom, var(--accent-color-2), var(--accent-color)); /* Gradient for hero */
  --header-text-color: var(--text-on-gradient);
  --hero-text-color: var(--text-on-gradient);
  --hero-subtitle-color: rgba(255, 255, 255, 0.9); /* Slightly more opaque for subtitle */

  /* Buttons */
  --button-primary-bg: var(--accent-color); 
  --button-primary-text: var(--text-on-gradient);
  --button-primary-hover-bg: #7a15ed; /* Darker magenta */
  
  --button-secondary-bg: #FFFFFF;
  --button-secondary-text: var(--accent-color);
  --button-secondary-border: var(--accent-color);
  --button-secondary-hover-bg: #FCE4EC; 
  --button-secondary-hover-text: #D81B60;
  --button-secondary-hover-border: #D81B60;

  /* Inputs */
  --input-bg-color: #FFFFFF;
  --input-text-color: var(--primary-text);
  --input-border-color: #CCCCCC;
  --input-focus-border-color: var(--accent-color);

  /* Navigation & Dropdowns */
  --nav-text: var(--header-text-color); /* Text for nav links */
  --menu-icon-color: var(--header-text-color); /* Color for burger menu icon */
  --logo-text-color: var(--header-text-color); /* For "Math" part of the logo */
  --logo-span-text-color: var(--header-text-color); /* For "Solver" part, can be same or different */

  --dropdown-bg: #FFFFFF;
  --dropdown-text: var(--primary-text);
  --dropdown-border: #E0E0E0;
  
  /* Footer */
  --footer-bg: #000000; /* AMOLED black for light theme footer */
  --footer-text: #EFEBEA;
  --footer-link-hover-color: var(--accent-color);

  /* Other */
  --border-color: #E0E0E0; /* General border color for cards, inputs etc. on light bg */
  --accent-shadow: 0 4px 12px rgba(233, 30, 99, 0.25); /* Shadow for magenta elements */
  --border-glow: 0 0 8px rgba(233, 30, 99, 0.35); /* Glow for magenta elements */

  /* Specifics from existing theme to retain/update */
  --feedback-title-color: var(--accent-color); 
  --comments-title-color: var(--accent-color); 
}


* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--primary-bg);
  color: var(--primary-text);
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header Styles */
header {
  background: var(--header-bg); /* Use the header-bg variable */
  padding: 20px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--logo-text-color); /* Updated to use variable */
  text-shadow: none; /* Removed shadow for light theme based on screenshot */
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

/* Animated light effect for logo */
.logo::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shine 3s infinite;
}

@keyframes shine {
  0% {
    left: -100%;
  }
  20% {
    left: 100%;
  }
  100% {
    left: 100%;
  }
}

.logo span {
  color: var(--logo-span-text-color); /* Updated to use variable */
}

/* Menu icon color fix */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--menu-icon-color); /* Updated to use variable */
  font-size: 1.5rem;
  cursor: pointer;
}

/* Dropdown menu text color fix */
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--dropdown-bg); /* Updated to use variable */
  min-width: 200px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
  z-index: 1000;
  border-radius: 3px;
  display: none;
  padding: 5px 0;
  margin-top: 5px;
  border: 1px solid var(--border-color);
}

.dropdown-menu h4,
.dropdown-menu a,
.theme-toggle-container span {
  color: var(--dropdown-text); /* Updated to use variable */
}

/* Theme Toggle in Header - Styling handled by menu-dropdown.css or adjusted here */
/* You may need to move or adjust the .theme-toggle styles from your red-theme.css/old styles.css */
/* For now, keeping the general .theme-toggle from your latest styles.css */
.theme-toggle {
  background: var(--button-bg); /* Use button-bg variable */
  border: none;
  width: 60px;
  height: 30px;
  border-radius: 15px;
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
}

.theme-toggle::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  background-color: var(--accent-color); /* Use accent-color variable */
  border-radius: 50%;
  left: 4px;
  transition: transform 0.3s;
}

/* The class 'light' here might need to be adjusted based on your JS, or removed if JS handles the position directly */
/* If JS adds 'theme-light', 'theme-blue', etc. to the toggle itself, you might use those classes */
.theme-toggle.light::after {
  transform: translateX(30px);
}

.theme-toggle i {
  font-size: 14px;
  color: var(--primary-text); /* Use primary-text variable */
  z-index: 1;
}


/* Hero Section */
.hero {
  padding: 60px 0;
  text-align: center;
  background-color: var(--primary-bg); /* Use primary-bg variable */
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  background: linear-gradient(to right, var(--accent-color), var(--accent-color-2)); /* Use accent variables */
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

.hero p {
  font-size: 1.2rem;
  max-width: 800px;
  margin: 0 auto 40px;
  color: var(--secondary-text); /* Use secondary-text variable */
}

/* Grade Tools Section */
.grade-tools {
  padding: 40px 0;
}

.section-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 15px;
  color: var(--accent-color); /* Use accent-color variable */
  font-weight: 700;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.tool-card {
  background-image: url('../img/grade_section_bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}

.tool-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--border-glow); /* Use border-glow variable */
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(to right, var(--accent-color), var(--accent-color-2)); /* Use accent variables */
}

.tool-card h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: #555555; /* Changed to white for better visibility on image background */
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7); /* Added text shadow for readability */
}

.tool-card p {
  margin-bottom: 20px;
  color: #FFFFFF; /* Changed to white for better visibility on image background */
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5); /* Added text shadow for readability */
}

.tool-icon {
  font-size: 3rem;
  margin-bottom: 20px;
  color: var(--accent-color-2); /* Use accent-color-2 variable */
}

.btn {
  display: inline-block;
  background-color: var(--button-bg); /* Use button-bg variable */
  color: var(--primary-text); /* Use primary-text variable */
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background-color 0.3s, transform 0.3s;
  position: relative;
  overflow: hidden;
}

/* Animated light effect for buttons */
.btn-primary {
  background: linear-gradient(to right, var(--accent-color), var(--accent-color-2)); /* Use accent variables */
  color: #fff;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shine 3s infinite;
}

.btn:hover {
  background-color: var(--button-hover); /* Use button-hover variable */
  transform: scale(1.05);
}


/* Features Section */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.feature-item {
  text-align: center;
  padding: 20px;
  background-color: var(--card-bg); /* Use card-bg variable */
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color); /* Use border-color variable */
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
  color: var(--accent-color); /* Use accent-color variable */
}

.feature-item h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
  color: var(--primary-text); /* Use primary-text variable */
  font-weight: 700;
}


/* Footer Styles - Made smaller */
footer {
  background-color: var(--footer-bg); /* Use the footer-bg variable */
  padding: 25px 0; /* Reduced from 40px to 25px */
  margin-top: 40px; /* Reduced from 60px to 40px */
  color: var(--footer-text); /* Use footer-text variable for default footer text */
}

.footer-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px; /* Reduced from 30px to 20px */
}

.footer-col h4 {
  font-size: 1.1rem; /* Reduced from 1.2rem to 1.1rem */
  margin-bottom: 15px; /* Reduced from 20px to 15px */
  color: var(--accent-color); /* Use accent-color variable */
  font-weight: 700;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 8px; /* Reduced from 10px to 8px */
}

.footer-col ul li a {
  color: var(--footer-text); /* Use footer-text variable */
  text-decoration: none;
  transition: color 0.3s;
}

.footer-col ul li a:hover {
  color: var(--accent-color); /* Use accent-color variable */
}

.copyright {
  text-align: center;
  margin-top: 25px; /* Reduced from 40px to 25px */
  padding-top: 15px; /* Reduced from 20px to 15px */
  border-top: 1px solid rgba(255, 255, 255, 0.1); /* Consider using a variable here too */
  color: var(--footer-text); /* Use footer-text variable */
}

/* Animations */
@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

.animated-icon {
  animation: float 3s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .footer-container {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .section-title {
    font-size: 1.8rem;
  }
}


/* Comment Section Background Fixes */
.comments-section {
  background-color: var(--secondary-bg) !important; /* Force theme background */
}

#comment-form {
  background-color: var(--card-bg) !important; /* Force theme background */
}

.comment {
  background-color: var(--card-bg) !important; /* Force theme background */
  color: var(--primary-text) !important; /* Ensure text is visible */
}

#comment-form input[type="text"],
#comment-form textarea {
  background-color: var(--input-bg-color) !important; /* Force theme background */
  color: var(--primary-text); /* Force text color to match theme */
  border: 1px solid var(--border-color) !important; /* Ensure border matches */
  -webkit-appearance: none; /* Add this to potentially remove default browser styling */
  -moz-appearance: none;
  appearance: none;
}

/* Ensure comment text color is correct */
.comment p {
    color: var(--primary-text) !important; /* Default */
}
.comment strong {
    color: var(--accent-color) !important; /* Accent for author */
}
.comment small {
    color: var(--secondary-text) !important; /* Secondary for date */
}

/* Ensure form labels are correct color */
#comment-form label {
    color: var(--primary-text) !important;
}

/* Ensure title backgrounds match the section background */
.comments-section h2.section-title,
#comments-list-container h3 {
  background-color: var(--secondary-bg) !important; /* Force background to match section */
  padding: 5px 10px; /* Add some padding to match the visual */
  display: inline-block; /* Make it inline-block to wrap content */
  color: var(--secondary-text-color, #ffffff); /* Set text color to be visible, using a variable if available, otherwise white */
}




/* ColorSplash Theme Styles (New Default) */
:root.theme-colorsplash {
  --primary-bg: #000000;
  --secondary-bg: #111111; /* Slightly off-black */
  --card-bg: #1f1f1f;
  --primary-text: #ffffff;
  --secondary-text: #cccccc;
  --accent-color: #FFD700; /* Gold */
  --accent-color-2: #008000; /* Green */
  --accent-color-3: #FFA500; /* Orange */
  --accent-shadow: 0 0 10px rgba(255, 215, 0, 0.5); /* Gold shadow */
  --border-glow: 0 0 5px rgba(255, 215, 0, 0.3); /* Gold glow */
  --button-bg: #FFD700;    /* Gold button background */
  --button-hover: #DAA520; /* Darker gold on button hover */
  --input-bg-color: #282828;  /* Dark background for input fields */
  --header-bg: #121212;
  --footer-bg: #121212;
  --nav-text: #ffffff;
  --menu-icon-color: #ffffff;
  --dropdown-text: var(--primary-text);
  --dropdown-bg: var(--card-bg);
  --footer-text: #ffffff;
  --feedback-title-color: #FFD700; /* Gold color for titles */
  --comments-title-color: #FFD700; /* Gold color for titles */
  --border-color: #333333; /* Adding border color for consistency */

  /* Science Spark Promotional Banner - ColorSplash Theme */
  /* Overrides to make it look like the light theme promo */
  .science-spark-promo {
    background: linear-gradient(135deg, #4295e7, #5799c7) !important; /* Blue gradient */
    color: #ffffff !important;
    padding: 50px 15px !important;
    text-align: center !important;
    border-radius: 12px !important;
    margin: 40px auto !important;
    max-width: 95% !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
  }

  .science-spark-promo .container {
      max-width: 800px !important;
  }

  .science-spark-promo h3 {
    color: #ffffff !important;
    font-weight: 600 !important;
    font-size: 2em !important;
    margin-bottom: 15px !important;
  }

  .science-spark-promo p {
    color: #e0f7ff !important; /* Lighter text */
    font-size: 1.05em !important;
    margin-bottom: 25px !important;
    max-width: 600px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .science-spark-promo .btn {
    background: linear-gradient(135deg, #ffeb3b, #fbc02d) !important; /* Yellow/Orange gradient */
    color: #333 !important; /* Dark text for yellow button */
    border: none !important;
    padding: 12px 30px !important;
    border-radius: 25px !important; /* Pill shape */
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    display: inline-block !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15) !important;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease !important;
  }

  .science-spark-promo .btn:hover {
    background: linear-gradient(135deg, #fbc02d, #ffeb3b) !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2) !important;
  }

  /* Smaller version for chapter pages in ColorSplash theme */
  .science-spark-promo.small {
    padding: 30px 15px !important; /* Reduced padding */
    margin: 30px auto !important; /* Reduced margin */
    max-width: 90% !important; /* Slightly narrower */
  }

  .science-spark-promo.small h3 {
    font-size: 1.6em !important; /* Smaller heading */
    margin-bottom: 10px !important;
  }

  .science-spark-promo.small p {
    font-size: 0.95em !important; /* Smaller text */
    margin-bottom: 20px !important;
  }

  .science-spark-promo.small .btn {
    padding: 10px 25px !important; /* Slightly smaller button */
    font-size: 0.9em !important;
  }
}




/* Light Theme Logo - Magenta Glow Theme */
.theme-light .logo {
  color: var(--logo-text-color); /* White */
  text-shadow: none; /* Clean white text as per reference image style */
}

.theme-light .logo span {
  color: var(--logo-span-text-color); /* White */
}



/* ColorSplash Theme Specific Overrides for Tool Card */
.theme-colorsplash .tool-card {
  background-image: none;
  background-color: var(--card-bg);
}

.theme-colorsplash .tool-card h3,
.theme-colorsplash .tool-card p {
  color: var(--primary-text);
  text-shadow: none;
}




/* Light Theme Specific Styles for Tool Card */
.theme-light .tool-card {
  background-image: url('../img/light_theme_grade_bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.theme-light .tool-card h3,
.theme-light .tool-card p {
  color: #FFFFFF; /* Ensure white text for readability on new image */
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7); /* Add text shadow for better contrast */
}



/* Style for Grade Titles and Descriptions (Light Theme - Bold white) */
.grade-tools .tool-card h3,
.grade-tools .tool-card p {
    color: #FFFFFF !important; /* Ensure WHITE color overrides others */
    font-weight: bold !important; /* Ensure bold weight overrides others */
}

/* Specificity for dark theme to override the above if needed */
body.dark-theme .grade-tools .tool-card h3,
body.dark-theme .grade-tools .tool-card p {
    /* Revert to dark theme colors/weights if they exist, or define them */
    /* Assuming dark theme uses --text-color and normal weight */
    color: var(--text-color) !important; 
    font-weight: normal !important; /* Or specific weight for dark theme */
}




/* --- Light Theme Overrides for Science Spark Style --- */

/* Welcome Banner (Hero Section) */
body.light-theme .hero {
  background: linear-gradient(135deg, #4295e7, #5799c7); /* Gradient from analysis */
  color: #ffffff; /* White text for contrast */
  padding: 80px 15px; /* Adjust padding, add side padding */
  text-align: center;
  border-radius: 0; /* Remove any previous border-radius */
  box-shadow: none; /* Remove any previous shadow */
  margin-top: 0; /* Ensure no top margin */
}

body.light-theme .hero .container {
    max-width: 900px; /* Adjust container width if needed */
}

body.light-theme .hero h1 {
  color: #ffffff;
  font-weight: 700; /* Make title bold like screenshot */
  font-size: 2.8em; /* Adjust size */
  margin-bottom: 15px;
}

body.light-theme .hero p {
  color: #e0f2ff; /* Lighter text color for description */
  font-size: 1.1em;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 0; /* Remove margin since buttons are gone */
}

/* Hide buttons in hero section for light theme */
body.light-theme .hero .btn {
  display: none;
}

/* Hide the animated SVG icon in the hero section for light theme */
body.light-theme .hero .animated-icon {
    display: none;
}

/* Adjust header for light theme to ensure visibility */
body.light-theme header {
    background-color: rgba(255, 255, 255, 0.95); /* Slightly transparent white */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky; /* Make header sticky */
    top: 0;
    z-index: 1000;
}

body.light-theme header .logo span {
   color: #5799c7; /* Match darker blue from gradient */
}

body.light-theme header .nav-menu .dropdown-toggle,
body.light-theme header .nav-menu .menu-toggle i {
    color: #333; /* Darker text/icon for light header */
}

/* Ensure content below hero doesn't overlap header */
body.light-theme .grade-tools {
    padding-top: 60px; /* Add padding equivalent to header height */
}




/* Grade Selection Cards (Grade Tools Section) */
body.light-theme .grade-tools {
  background-color: #f8f9fa; /* Light grey background for the section */
  padding-top: 80px; /* Increased padding to avoid overlap with sticky header */
  padding-bottom: 60px;
}

body.light-theme .grade-tools .section-title {
    color: #333; /* Darker title for light theme */
    margin-bottom: 40px;
}

body.light-theme .tool-card {
  background-color: #ffffff; /* White background for the card body */
  border-radius: 12px; /* More rounded corners like screenshot */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Subtle shadow */
  border: none; /* Remove previous border */
  overflow: hidden; /* Ensure gradient doesn't bleed */
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

body.light-theme .tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* Grade Card Header (replacing .tool-icon) */
body.light-theme .tool-card .tool-icon {
  display: none; /* Hide the old icon */
}

body.light-theme .tool-card h3 {
  background: linear-gradient(135deg, #2979ff, #0d47a1); /* Blue gradient like screenshot header */
  color: #ffffff;
  padding: 20px 15px;
  margin: 0;
  font-size: 1.6em;
  font-weight: 600;
  text-align: center;
  border-top-left-radius: 12px; /* Match card radius */
  border-top-right-radius: 12px;
}

/* Grade Card Body Content */
body.light-theme .tool-card p {
  color: #555; /* Slightly darker grey text */
  padding: 20px;
  flex-grow: 1; /* Allow paragraph to take available space */
  margin-bottom: 15px;
  font-size: 0.95em;
  line-height: 1.6;
}

/* Grade Card Button */
body.light-theme .tool-card .btn.btn-primary {
  background: linear-gradient(135deg, #42a5f5, #1e88e5); /* Blue gradient like screenshot button */
  color: #ffffff;
  border: none;
  padding: 12px 25px;
  border-radius: 25px; /* Pill shape */
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 auto 25px auto; /* Center button horizontally, add bottom margin */
  display: inline-block; /* Ensure margin auto works */
  transition: background 0.3s ease, transform 0.2s ease;
}

body.light-theme .tool-card .btn.btn-primary:hover {
  background: linear-gradient(135deg, #1e88e5, #42a5f5); /* Slightly darker/shifted gradient on hover */
  transform: scale(1.03);
}
