/* Global Variables & Theme */
:root {
  --primary-color: #10b981; /* Emerald 500 */
  --primary-dark: #059669; /* Emerald 600 */
  --secondary-color: #3b82f6; /* Blue 500 */
  --text-color: #1f2937; /* Gray 800 */
  --text-light: #6b7280; /* Gray 500 */
  --bg-color: #f3f4f6; /* Gray 100 */
  --card-bg: #ffffff;
  --border-color: #e5e7eb; /* Gray 200 */
  --error-color: #ef4444; /* Red 500 */
  --success-color: #10b981;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius: 0.5rem;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --max-width: 1200px;
  --header-height: 70px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.6;
  padding-top: 0;
}

a {
  color: var(--primary-color);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-color);
  line-height: 1.25;
  margin-bottom: 1rem;
}

h1 { font-size: 2rem; font-weight: 700; color: var(--primary-dark); }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }

.section-title {
  text-align: center;
  margin: 3rem 0 2rem;
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Header & Nav */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary-dark);
  text-decoration: none;
}
.logo img {
  height: 40px;
  width: 40px;
}

/* Desktop Nav */
.desktop-nav {
  display: none;
}
.desktop-nav ul {
  display: flex;
  gap: 2rem;
  list-style: none;
}
.desktop-nav a {
  color: var(--text-color);
  font-weight: 500;
}
.desktop-nav a:hover, .desktop-nav a.active {
  color: var(--primary-color);
  text-decoration: none;
}

/* Dropdown */
.has-submenu {
  position: relative;
}
.submenu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-bg);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius);
  padding: 1rem;
  min-width: 250px;
  display: none; /* JS will toggle or CSS hover */
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1001;
}
.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu {
  display: flex;
}
.submenu a {
  padding: 0.5rem;
  display: block;
  font-size: 0.95rem;
  border-radius: var(--radius);
  transition: background 0.2s;
}
.submenu a:hover {
  background: var(--bg-color);
}

@media (min-width: 900px) {
  .desktop-nav {
    display: block;
  }
}

/* Mobile Nav */
.mobile-nav-toggle {
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}
@media (min-width: 900px) {
  .mobile-nav-toggle { display: none; }
}

.mobile-menu {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--card-bg);
  padding: 1rem;
  box-shadow: var(--shadow-md);
  display: none;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
}
.mobile-menu.open {
  display: flex;
}
.mobile-menu a {
  font-size: 1.1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  display: block;
  color: var(--text-color);
}
.mobile-menu .submenu {
  position: static;
  transform: none;
  box-shadow: none;
  padding-left: 1rem;
  display: none;
}
.mobile-menu .has-submenu.open .submenu {
  display: flex;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-size: 1rem;
}
.btn-primary {
  background: var(--primary-color);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-dark);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
}
.btn-outline:hover {
  background: var(--bg-color);
}
.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
}

/* Forms & Calculator */
.calculator-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  margin-bottom: 3rem;
}

.form-group {
  margin-bottom: 1.5rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}
.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}
.input-group {
  display: flex;
  gap: 0.5rem;
}
.validation-msg {
  color: var(--error-color);
  font-size: 0.85rem;
  margin-top: 0.25rem;
  min-height: 1.25em; /* Prevent jump */
}

/* Results Display */
.results-panel {
  background: var(--bg-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  height: 100%;
}
.result-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}
.result-item:last-child {
  border-bottom: none;
}
.result-label { color: var(--text-light); }
.result-value { font-weight: 700; font-size: 1.25rem; color: var(--text-color); }
.result-value.highlight { color: var(--primary-dark); font-size: 1.5rem; }

/* Actions Bar */
.actions-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* Accordion */
.accordion-item {
  border-bottom: 1px solid var(--border-color);
}
.accordion-trigger {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 1.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.accordion-trigger::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 400;
}
.accordion-trigger[aria-expanded="true"]::after {
  content: '−';
}
.accordion-content {
  display: none;
  padding-bottom: 1.5rem;
  color: var(--text-light);
}
.accordion-trigger[aria-expanded="true"] + .accordion-content {
  display: block;
}


/* Footer */
.site-footer {
  background: #1F2937;
  color: #D1D5DB;
  padding: 3rem 0;
  margin-top: auto;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
.footer-title { color: white; font-weight: 700; margin-bottom: 1rem; }
.footer-links li { margin-bottom: 0.5rem; }
.footer-links a:hover { color: white; text-decoration: underline; }

/* Hero Section styles */
.hero {
  text-align: center;
  margin: 2rem 0 3rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
.last-updated {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

/* Print Styles */
@media print {
  .site-header, .site-footer, .actions-bar, .how-it-works, .faq-section, .hero p {
    display: none !important;
  }
  body, .container, .calculator-card, .results-panel {
    background: white !important;
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .grid-2 {
    display: block !important;
  }
  .form-group {
    page-break-inside: avoid;
  }
  .results-panel {
    border: 1px solid #ccc;
    margin-top: 2rem;
  }
}
