@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #64748b;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #475569;
  --border-color: #e2e8f0;
  --success: #10b981;
  --success-bg: #d1fae5;
  --error: #ef4444;
  --error-bg: #fee2e2;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Border Radius */
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.header p {
  color: var(--text-muted);
  font-size: 1.125rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Cards */
.card {
  background-color: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

.card-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--bg-color);
  padding-bottom: 0.75rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  font-size: 0.95rem;
}

.form-row-double {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.form-row-double > div {
  display: flex;
  flex-direction: column;
}

.form-row-double input,
.form-row-double select {
  margin-top: auto;
}

@media (max-width: 600px) {
  .form-row-double {
      flex-direction: column;
      gap: 1.25rem;
  }
}

.helper-text {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -0.25rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

input[type="number"],
select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background-color: #fff;
}

input::placeholder {
  color: #94a3b8;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background-color: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 1rem;
}

.btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

/* Results Section */
.results-container {
  display: none;
  background-color: var(--success-bg);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-top: 2rem;
  animation: slideDown var(--transition-normal);
}

.results-container.show {
  display: block;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

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

.result-label {
  font-weight: 500;
  color: #065f46;
}

.result-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #047857;
}

.result-note {
  font-size: 0.875rem;
  color: #059669;
  text-align: right;
  margin-top: 0.5rem;
  font-style: italic;
}

/* --- Navbar Upgrade (Two-Tier Premium Design) --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #ffffff; /* Solid white top row */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); /* Softer shadow */
}

/* Top Tier - Logo Row */
.nav-top-row {
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  background-color: #ffffff;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.nav-logo {
  font-weight: 800;
  font-size: 1.4rem;
  color: #111827; /* Darker, crisper text */
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10;
  letter-spacing: -0.5px;
}

.nav-logo-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

/* Bottom Tier - Tools Menu */
.nav-bottom-row {
  background-color: #f9fafb; /* Very light subtle grey for the tool belt */
  border-bottom: 1px solid var(--border-color);
}

.nav-menu-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Hidden Checkbox */
.menu-toggle-input {
  display: none;
}

/* Hamburger Label (Mobile Only) */
.menu-label {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 32px;
  height: 24px;
  cursor: pointer;
  z-index: 10;
}

.hamburger-line {
  width: 100%;
  height: 3px;
  background-color: #111827;
  border-radius: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animated Hamburger to X */
.navbar:has(.menu-toggle-input:checked) .hamburger-line:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}
.navbar:has(.menu-toggle-input:checked) .hamburger-line:nth-child(2) {
  opacity: 0;
}
.navbar:has(.menu-toggle-input:checked) .hamburger-line:nth-child(3) {
  transform: translateY(-11px) rotate(-45deg);
}

/* Mobile Menu Hidden by Default */
.nav-menu {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 0;
  background-color: #ffffff;
}

/* Expand menu when checkbox is checked */
.navbar:has(.menu-toggle-input:checked) .nav-menu {
  max-height: 800px; 
  opacity: 1;
  padding: 1rem 0;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); /* Drop shadow on mobile menu open */
}

/* Pill-Shaped Links */
.nav-menu-link {
  color: #4b5563; /* Slate 600 */
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.75rem 1.25rem;
  border-radius: 9999px; /* Pill shape */
  transition: all 0.2s ease;
  margin: 0.25rem 1.25rem; /* Mobile spacing */
}

.nav-menu-link:hover {
  background-color: var(--primary); /* Deep green background on hover */
  color: #ffffff; /* White text on hover */
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

/* Desktop Styles */
@media (min-width: 900px) {
  .menu-label {
      display: none; /* Hide hamburger completely */
  }
  
  .nav-bottom-row {
      display: block; /* Ensure toolbelt visible */
  }

  /* Reset mobile menu overrides */
  .nav-menu {
      max-height: none; 
      overflow: visible;
      flex-direction: row;
      justify-content: center; /* Center tools horizontally */
      flex-wrap: wrap; /* Allow wrapping if screen tightens */
      width: 100%;
      padding: 0.5rem 0 !important;
      opacity: 1;
      background-color: transparent;
      gap: 0.5rem; /* Tighter gap, pill shapes give natural border */
  }
  
  .menu-toggle-input:checked ~ .nav-bottom-row .nav-menu {
      box-shadow: none; /* Remove mobile shadow */
  }

  .nav-menu-link {
      margin: 0; /* Remove mobile vertical margin */
      padding: 0.4rem 1rem; /* Sleek desktop pill padding */
      font-size: 0.85rem; /* Slightly smaller text for desktop cluster */
      background-color: #f3f4f6; /* Very subtle default pill background */
      border: 1px solid #e5e7eb; /* Fine border */
  }
}

/* Home Grid */
.calculator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.calc-card {
  display: flex;
  flex-direction: column;
  background-color: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-normal);
}

.calc-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

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

.calc-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.calc-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-grow: 1;
}

/* Affiliate Links */
.affiliate-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.affiliate-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.affiliate-list {
  list-style: none;
}

.affiliate-list li {
  margin-bottom: 0.75rem;
}

.affiliate-list a {
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.affiliate-list a:hover {
  text-decoration: underline;
}

.affiliate-list a::before {
  content: '🛒';
  margin-right: 0.5rem;
}

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Utilities */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* FAQ Dropdowns (details/summary) */
details.faq-item {
    border-bottom: 1px solid var(--border-color);
}
details.faq-item:last-of-type {
    border-bottom: none;
}
details.faq-item summary {
    font-size: 1.1rem;
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    padding: 1.25rem 0;
    list-style: none; /* remove default arrow in firefox */
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.3s ease;
}
details.faq-item summary:hover {
    color: var(--primary);
}
details.faq-item summary::-webkit-details-marker {
    display: none; /* remove default arrow in chrome/safari */
}
details.faq-item summary::after {
    content: '+';
    font-size: 1.5rem;
    line-height: 1;
    color: var(--primary);
    transition: transform 0.3s ease;
    display: inline-block;
    width: 20px;
    text-align: center;
}
details.faq-item[open] summary::after {
    transform: rotate(45deg); /* turns '+' into 'x' */
}
details.faq-item[open] summary {
    padding-bottom: 0.5rem;
    color: var(--primary);
}
details.faq-item p {
    color: var(--text-muted);
    font-size: 0.95rem;
    padding-bottom: 1.5rem;
    line-height: 1.6;
    margin-top: 0;
    animation: fadeInDown 0.3s ease forwards;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* --- Affiliate CTA Button --- */
.affiliate-cta-container {
    display: none; /* Hidden until affiliate applications are approved */
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border-color);
    text-align: center;
}

.affiliate-cta-btn {
    display: inline-block;
    background-color: #10b981;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.4), 0 2px 4px -1px rgba(16, 185, 129, 0.2);
}

.affiliate-cta-btn:hover {
    background-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(16, 185, 129, 0.5), 0 4px 6px -1px rgba(16, 185, 129, 0.3);
    color: white;
}
