/* Base styles and variables */
:root {
  --primary-color: #0066cc;
  --secondary-color: #ff9900;
  --text-color: #333333;
  --light-bg: #f5f7fa;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Montserrat', sans-serif;
  --border-radius: 8px;
  --box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Reset and normalization */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

/* Typography */
body {
  font-family: var(--font-main);
  line-height: 1.6;
  color: var(--text-color);
  font-size: 16px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 2rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1rem;
}

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

a:hover {
  text-decoration: underline;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  width: 100%;
}

main {
  padding: 2rem 0;
}

/* Header */
header {
  background-color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

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

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

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

.nav-list {
  display: flex;
  list-style: none;
}

.nav-list li {
  margin-left: 1.5rem;
}

.language-selector {
  margin-left: 1.5rem;
  position: relative;
}

/* Mobile menu button */
.mobile-menu-button {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.menu-icon {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--primary-color);
  position: relative;
}

.menu-icon:before,
.menu-icon:after {
  content: "";
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--primary-color);
  position: absolute;
  transition: transform 0.3s ease;
}

.menu-icon:before {
  top: -6px;
}

.menu-icon:after {
  bottom: -6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Breadcrumb navigation */
.breadcrumb {
  margin-bottom: 2rem;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
}

.breadcrumb li {
  display: flex;
  align-items: center;
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  margin: 0 0.5rem;
  color: #ccc;
}

.breadcrumb a {
  color: var(--primary-color);
}

.breadcrumb li:last-child {
  color: #666;
}

/* Content styles */
.answer-box {
  background-color: var(--light-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: 2rem;
  border-left: 4px solid var(--primary-color);
}

.content-section {
  margin-bottom: 3rem;
}

/* Article layout */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.article-main {
  max-width: 800px;
}

.related-content {
  padding: 1.5rem;
  background-color: var(--light-bg);
  border-radius: var(--border-radius);
  position: sticky;
  top: 100px;
}

.related-content h3 {
  margin-bottom: 1rem;
}

.related-content ul {
  list-style: none;
}

.related-content li {
  margin-bottom: 0.5rem;
}

/* Home page */
.hero-section {
  background: linear-gradient(to right, var(--primary-color), #004999);
  color: white;
  padding: 4rem 0;
  text-align: center;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.hero-content h1 {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.hero-content p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.category-card {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.category-card h3 {
  margin-bottom: 0.5rem;
}

/* Search */
.search-container {
  max-width: 600px;
  margin: 0 auto 2rem;
}

.search-form {
  display: flex;
  box-shadow: var(--box-shadow);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.search-input {
  flex: 1;
  padding: 1rem;
  border: none;
  font-size: 1rem;
}

.search-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0 1.5rem;
  cursor: pointer;
  font-weight: 500;
}

/* Interactive elements */
.interactive-demo {
  background-color: var(--light-bg);
  padding: 2rem;
  border-radius: var(--border-radius);
  margin: 2rem 0;
}

/* Converters and calculators */
.converter-tool {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.input-group, .output-group {
  display: flex;
  align-items: center;
}

.input-group input {
  width: 100px;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  font-size: 1rem;
}

.input-group span, .output-group span {
  margin-left: 0.5rem;
}

.convert-button {
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.convert-button:hover {
  background-color: #0055b3;
}

.equals {
  font-size: 1.5rem;
  font-weight: bold;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

th {
  background-color: var(--light-bg);
  font-weight: 600;
}

tr.highlight {
  background-color: rgba(0, 102, 204, 0.1);
}

/* Cards and grids */
.examples-grid, .comparison-grid, .benefits-grid, .factors-grid, .reasons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.example-card, .comparison-item, .benefit-item, .factor-card, .reason-item, .implication-card, .strategy-card {
  background-color: white;
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

/* FAQs */
.faq-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-item h3 {
  margin-bottom: 0.75rem;
  color: var(--primary-color);
}

/* Warning and note boxes */
.caution-box, .medical-disclaimer {
  background-color: #fff9e6;
  border-left: 4px solid #f0ad4e;
  padding: 1.5rem;
  margin: 1.5rem 0;
  border-radius: var(--border-radius);
}

/* Tip accordion */
.tip-item {
  margin-bottom: 1rem;
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.tip-item h3 {
  padding: 1rem 1.5rem;
  background-color: var(--light-bg);
  margin-bottom: 0;
  cursor: pointer;
  position: relative;
}

.tip-item h3:after {
  content: "+";
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
}

.tip-item.active h3:after {
  content: "-";
}

.tip-content {
  padding: 0 1.5rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.tip-item.active .tip-content {
  padding: 1.5rem;
  max-height: 1000px;
}

/* Footer */
footer {
  background-color: #333;
  color: white;
  padding: 3rem 0;
}

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

.footer-column h3 {
  color: var(--secondary-color);
  margin-bottom: 1rem;
}

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

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

.footer-column a {
  color: #ccc;
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #555;
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
}

/* Media queries for responsive design */
@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 2fr 1fr;
  }
  
  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

@media (max-width: 768px) {
  body {
    font-size: 15px;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  h3 {
    font-size: 1.2rem;
  }
  
  .article-layout {
    grid-template-columns: 1fr;
  }
  
  .related-content {
    position: static;
    margin-top: 2rem;
  }
  
  .interactive-demo {
    padding: 1rem;
  }
  
  .category-grid, 
  .examples-grid, 
  .comparison-grid, 
  .benefits-grid, 
  .factors-grid {
    grid-template-columns: 1fr;
  }
  
  .hero-content h1 {
    font-size: 2rem;
  }
  
  .hero-content p {
    font-size: 1rem;
  }
  
  .converter-tool {
    flex-direction: column;
    align-items: stretch;
  }
  
  .equals {
    align-self: center;
  }
  
  .nav-list {
    display: none;
  }
  
  .nav-list.show {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: white;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  }
  
  .nav-list.show li {
    margin: 0.5rem 0;
  }
  
  .mobile-menu-button {
    display: block;
    margin-right: 1rem;
  }
  
  .main-nav {
    flex-direction: row-reverse;
  }
  
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .header-container {
    flex-wrap: wrap;
  }
  
  .language-selector {
    margin-left: auto;
  }
  
  main {
    padding: 1.5rem 0;
  }
  
  .answer-box {
    padding: 1rem;
  }
  
  .search-form {
    flex-direction: column;
  }
  
  .search-input {
    width: 100%;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
  }
  
  .search-button {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
  }
  
  .breadcrumb {
    font-size: 0.875rem;
  }
  
  .footer-container {
    grid-template-columns: 1fr;
  }
}

/* Utility classes */
.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: 1rem;
}

.mt-2 {
  margin-top: 2rem;
}

.mb-1 {
  margin-bottom: 1rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

.px-1 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.py-1 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #f5f5f5;
    --light-bg: #2a2a2a;
  }
  
  body {
    background-color: #1a1a1a;
    color: var(--text-color);
  }
  
  .main-nav, 
  header, 
  .nav-list.show {
    background-color: #333;
  }
  
  .category-card,
  .example-card, 
  .comparison-item, 
  .benefit-item, 
  .factor-card, 
  .reason-item,
  .implication-card,
  .strategy-card,
  .tip-item {
    background-color: #333;
    color: var(--text-color);
  }
  
  table th, 
  table td {
    border-color: #444;
  }
  
  table th {
    background-color: #2a2a2a;
  }
  
  tr.highlight {
    background-color: rgba(0, 102, 204, 0.2);
  }
  
  .input-group input {
    background-color: #333;
    border-color: #555;
    color: var(--text-color);
  }
  
  .caution-box, 
  .medical-disclaimer {
    background-color: #3d3517;
    border-color: #f0ad4e;
    color: var(--text-color);
  }
  
  .tip-item h3 {
    background-color: #333;
  }
  
  .faq-item {
    border-color: #444;
  }
}