* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  --accent: #f59e0b;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --green: #059669;
  --green-light: #d1fae5;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --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);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
}

/* Header */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  background: var(--accent);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

nav {
  display: flex;
  gap: 0.25rem;
}

nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s;
}

nav a:hover, nav a.active {
  background: rgba(255,255,255,0.15);
  color: white;
}

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 3rem 1.5rem 4rem;
  text-align: center;
  margin-top: -1px;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: 2rem;
}

.hero-stat {
  text-align: center;
}

.hero-stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
}

.hero-stat-label {
  font-size: 0.875rem;
  opacity: 0.8;
}

/* Main */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.page-header .subtitle {
  color: var(--gray-500);
  font-size: 1.1rem;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--primary-light);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* Calculator Grid */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--gray-200);
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.calc-link {
  background: white;
  border-radius: 16px;
  padding: 1.75rem;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
  border: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
}

.calc-link:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.calc-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.calc-link h2 {
  color: var(--gray-900);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.calc-link p {
  color: var(--gray-500);
  font-size: 0.95rem;
  line-height: 1.5;
  flex: 1;
}

.calc-link .calc-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
  font-size: 0.8rem;
  color: var(--gray-400);
}

.calc-link .calc-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Calculator Card */
.calculator-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  border: 1px solid var(--gray-100);
}

.calculator-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--gray-100);
}

.input-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--gray-700);
  font-size: 0.9rem;
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

input[type="number"], input[type="text"] {
  flex: 1;
  padding: 0.875rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.2s;
  background: var(--gray-50);
}

input[type="number"]:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-light);
  background: white;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

select {
  padding: 0.875rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--gray-50);
  min-width: 110px;
  cursor: pointer;
  transition: all 0.2s;
}

select:focus {
  outline: none;
  border-color: var(--primary-light);
  background: white;
}

.btn {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  box-shadow: 0 4px 14px 0 rgba(30, 64, 175, 0.3);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px 0 rgba(30, 64, 175, 0.4);
}

.btn:active {
  transform: translateY(0);
}

/* Results */
.results {
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  display: none;
  border: 1px solid var(--gray-200);
}

.results.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.results-title {
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--gray-200);
}

.result-item:last-child {
  border-bottom: none;
}

.result-label {
  color: var(--gray-600);
  font-size: 0.95rem;
}

.result-value {
  font-weight: 700;
  color: var(--gray-800);
  font-size: 1rem;
}

.result-value.highlight {
  color: var(--primary);
  font-size: 1.35rem;
  background: white;
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

/* Tips Section */
.tips {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-left: 4px solid var(--primary);
  padding: 1.5rem;
  border-radius: 0 12px 12px 0;
  margin-top: 1.5rem;
}

.tips h3 {
  color: var(--primary);
  margin-bottom: 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  padding: 0;
}

.tips ul {
  margin-left: 1.25rem;
  color: var(--gray-600);
}

.tips li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

/* Info Box */
.info-box {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 2rem;
  border: 1px solid var(--gray-200);
}

.info-box h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 1rem;
}

.info-box ol, .info-box ul {
  margin: 1rem 0 0 1.5rem;
  color: var(--gray-600);
}

.info-box li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.info-box p {
  color: var(--gray-600);
  line-height: 1.6;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.data-table thead tr {
  background: var(--gray-100);
}

.data-table th {
  text-align: left;
  padding: 1rem;
  color: var(--gray-600);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 1rem;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-100);
}

.data-table tbody tr:hover {
  background: var(--gray-50);
}

/* Affiliate Shop Links */
.shop-links {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--gray-200);
}

.shop-links-title {
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.shop-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.shop-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.shop-btn-hd {
  background: #f96302;
  color: white;
}

.shop-btn-hd:hover {
  background: #e55a00;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(249, 99, 2, 0.3);
}

.shop-btn-lowes {
  background: #004990;
  color: white;
}

.shop-btn-lowes:hover {
  background: #003d7a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 73, 144, 0.3);
}

.shop-btn-amazon {
  background: #ff9900;
  color: #111;
}

.shop-btn-amazon:hover {
  background: #e88b00;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 153, 0, 0.3);
}

@media (max-width: 480px) {
  .shop-buttons {
    flex-direction: column;
  }

  .shop-btn {
    justify-content: center;
  }
}

/* Ad placeholder */
.ad-space {
  background: var(--gray-100);
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  color: var(--gray-400);
  margin: 2rem 0;
  font-size: 0.875rem;
}

/* Features Section */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}

.feature {
  text-align: center;
  padding: 1.5rem;
}

.feature-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1rem;
}

.feature h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.feature p {
  color: var(--gray-500);
  font-size: 0.95rem;
}

/* Footer */
footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 3rem 1.5rem;
  margin-top: 4rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.footer-section h4 {
  color: white;
  font-weight: 700;
  margin-bottom: 1rem;
}

.footer-section a {
  color: var(--gray-400);
  text-decoration: none;
  display: block;
  padding: 0.25rem 0;
  transition: color 0.2s;
}

.footer-section a:hover {
  color: white;
}

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--gray-800);
  text-align: center;
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary-dark);
    flex-direction: column;
    padding: 1rem;
  }

  nav.open {
    display: flex;
  }

  nav a {
    padding: 0.75rem 1rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero-stats {
    gap: 1.5rem;
  }

  .input-row {
    flex-direction: column;
  }

  .calculator-card {
    padding: 1.5rem;
  }

  .calc-grid {
    grid-template-columns: 1fr;
  }

  .result-value.highlight {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .header-content {
    padding: 0.75rem 1rem;
  }

  .logo {
    font-size: 1.25rem;
  }

  .hero {
    padding: 2rem 1rem 3rem;
  }

  .hero-stats {
    flex-direction: column;
    gap: 1rem;
  }
}
