/* Main Variables */
:root {
  --primary-color: #E25141;
  --secondary-color: #E3CDBA;
  --tertiary-color: #37bce5;
  --accent-color: #e8b974;
  --background-color: #ffffff;
  --dark-color: #2D3047;
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  margin: 0;
  padding: 0;
  background: var(--background-color);
  color: var(--dark-color);
  line-height: 1.6;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Header Styles */
.site-header {
  background-color: var(--dark-color);
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo a {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.main-nav a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.main-nav a:hover {
  color: var(--secondary-color);
}

.main-nav a.active {
  color: var(--secondary-color);
  font-weight: 700;
}

.mobile-menu-toggle {
  display: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

/* Hero Section */
.hero {
  padding: 4rem 2rem 8rem 2rem;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -50px;
  left: 0;
  right: 0;
  height: 100px;
  background: var(--background-color);
  transform: skewY(-3deg);
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  transform: translateY(20px);
  opacity: 0;
  animation: slideUp 1s ease forwards;
}

@keyframes slideUp {
  to { transform: translateY(0); opacity: 1; }
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
  color: white;
}

.hero p {
  font-size: 1.25rem;
  margin-bottom: 2.5rem;
  opacity: 0.9;
}

.hero-search {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.hero-search input {
  width: 100%;
  padding: 1rem 2rem;
  padding-right: 3rem;
  border: none;
  border-radius: 50px;
  font-size: 1.1rem;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
}

.hero-search .search-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dark-color);
}

/* Search Results Container */
#search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 5px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 10;
}

#search-results ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#search-results li {
  padding: 0.75rem;
  border-bottom: 1px solid #eee;
}

#search-results li a {
  color: var(--dark-color);
  text-decoration: none;
}

#search-results li a:hover {
  color: var(--secondary-color);
}

/* Calculator List Section */
.calculator-list {
  padding: 4rem 2rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
  background: var(--background-color);
}

.calculator-list h2 {
  text-align: center;
  font-size: 2.5rem;
  color: var(--dark-color);
  margin-top: 0.5rem;
  margin-bottom: 4rem;
  position: relative;
}

.calculator-list h2::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background-color: var(--secondary-color);
  border-radius: 2px;
}

.calculator-categories {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}

/* Category styles */
.category {
  background: white;
  border-radius: 15px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0,0,0,0.1);
}

.category h3 {
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.category-icon { font-size: 1.75rem; }

.category ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.category li {
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
}

.category a {
  color: var(--dark-color);
  text-decoration: none;
  transition: color 0.3s ease;
  display: block;
  padding: 0.5rem;
  border-radius: 5px;
}

.category a:hover {
  color: var(--secondary-color);
  background-color: rgba(227,205,186, 0.2);
}

/* Conversion grid specific styles */
.conversion-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(4, auto);
  gap: 0.5rem;
}

.conversion-grid li {
  padding: 0.5rem;
  border-bottom: none;
}

.conversion-grid li a {
  padding: 0.3rem;
  font-size: 0.9rem;
  text-align: center;
}

/* Calculator Page Styles */
.interactive-calculator-page {
  width: 100%;
  padding: 20px;
  background: #f9f9f9;
  box-sizing: border-box;
}

.page-header {
  padding: 2rem 0;
  text-align: center;
}

.page-header h1 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: 2.2rem;
}

.page-header p {
  max-width: 700px;
  margin: 0 auto;
  color: var(--dark-color);
  opacity: 0.8;
}

.page-content {
  font-size: 1.1em;
  line-height: 1.6;
  padding: 30px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 30px;
  max-width: 1000px;
  margin: 0 auto 30px;
}

/* Calculator Forms and Results */
.calculator-description {
  margin-bottom: 2rem;
}

.calculator-form {
  margin-bottom: 2rem;
  background: #f9f9f9;
  padding: 1.5rem;
  border-radius: 8px;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
}

.btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s ease;
}

.btn:hover {
  background: #c94435;
}

.calculator-results {
  margin-bottom: 2rem;
}

.calculator-results h3 {
  margin-bottom: 1rem;
  color: var(--dark-color);
}

.result-item {
  background: #f9f9f9;
  padding: 1rem;
  border-radius: 5px;
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.error {
  color: red;
  font-size: 0.9rem;
}

/* Calculator Instructions */
.calculator-instructions {
  margin-bottom: 2rem;
  background: #f9f9f9;
  padding: 1.5rem;
  border-radius: 8px;
}

.calculator-instructions h3 {
  margin-bottom: 1rem;
  color: var(--dark-color);
}

.calculator-instructions ol {
  padding-left: 1.5rem;
}

.calculator-instructions li {
  margin-bottom: 0.5rem;
}

/* Related Calculators */
.related-calculators {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.related-calculators h3 {
  margin-bottom: 1rem;
  color: var(--dark-color);
}

.related-calculators ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
}

.related-calculators li {
  background: #f9f9f9;
  border-radius: 5px;
  transition: transform 0.3s ease;
}

.related-calculators li:hover {
  transform: translateY(-3px);
}

.related-calculators a {
  display: block;
  padding: 1rem;
  color: var(--dark-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

.related-calculators a:hover {
  color: var(--primary-color);
}

/* Tab System for Calculators */
.calculator-tabs {
  display: flex;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}

.calculator-tab {
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
}

.calculator-tab.active {
  border-bottom-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 500;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Calculator Card Grid (All Calculators page) */
.calculator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.calculator-card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.05);
  padding: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.calculator-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.calculator-card h3 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.calculator-card .category-tag {
  display: inline-block;
  background: var(--secondary-color);
  color: var(--dark-color);
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}

.calculator-card .cta {
  display: inline-block;
  margin-top: 1rem;
  color: var(--primary-color);
  font-weight: 500;
  text-decoration: none;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 2rem 0;
}

.filter-btn {
  background: white;
  border: 1px solid var(--secondary-color);
  color: var(--dark-color);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* Footer Styles */
.site-footer {
  background: var(--dark-color);
  color: white;
  padding: 3rem 0 1rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-logo h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.footer-links h4, .footer-categories h4 {
  margin-bottom: 1rem;
  color: var(--secondary-color);
}

.footer-links ul, .footer-categories ul {
  list-style: none;
}

.footer-links li, .footer-categories li {
  margin-bottom: 0.5rem;
}

.footer-links a, .footer-categories a {
  color: white;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-links a:hover, .footer-categories a:hover {
  color: var(--secondary-color);
}

.copyright {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* Responsive Design */
@media (max-width: 992px) {
  .calculator-categories {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .footer-content {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .hero { 
    padding: 4rem 1rem 6rem; 
  }
  
  .hero h1 { 
    font-size: 2rem; 
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .calculator-list { 
    padding: 3rem 1rem; 
  }
  
  .calculator-categories {
    grid-template-columns: 1fr;
  }
  
  .conversion-grid {
    grid-template-columns: 1fr;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--dark-color);
    height: 0;
    overflow: hidden;
    transition: height 0.3s ease;
    z-index: 100;
  }
  
  .main-nav.active {
    height: auto;
    padding: 1rem 0;
  }
  
  .main-nav ul {
    flex-direction: column;
    padding: 0 1rem;
    gap: 0;
  }
  
  .main-nav li {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  .main-nav li:last-child {
    border-bottom: none;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.75rem;
  }
  
  .calculator-list h2 {
    font-size: 1.75rem;
  }
  
  .page-header h1 {
    font-size: 1.75rem;
  }
  
  .page-content {
    padding: 20px 15px;
  }
  
  .calculator-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
}