:root {
  /* Modern Palette */
  --primary-color: #4f46e5;
  /* Indigo 600 */
  --primary-hover: #4338ca;
  /* Indigo 700 */
  --primary-light: #e0e7ff;
  /* Indigo 100 */
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);

  --bg-color: #f1f5f9;
  /* Slate 100 */
  --surface-color: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.9);

  --text-main: #0f172a;
  /* Slate 900 */
  --text-secondary: #334155;
  /* Slate 700 */
  --text-muted: #64748b;
  /* Slate 500 */

  --border-color: #cbd5e1;
  /* Slate 300 */
  --radius: 16px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  --shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.03), 0 20px 40px -4px rgba(0, 0, 0, 0.08);
  /* Soft diffuse shadow */

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --max-width: 72rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
header {
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.container {
  width: 90%;
  max-width: var(--max-width);
  margin: 0 auto;
}

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

.logo {
  font-weight: 800;
  font-size: 2rem;
  text-decoration: none;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
}

/* Search Styles */
.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 420px;
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 1rem;
}

#search-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  font-size: 0.95rem;
  background: var(--bg-color);
  transition: all 0.2s ease;
}

#search-input:focus {
  background: var(--surface-color);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  outline: none;
}

/* Main Layout */
main {
  flex: 1;
  padding: 3rem 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}

@media (min-width: 1024px) {
  main {
    grid-template-columns: 2.5fr 1fr;
  }
}

@media (max-width: 768px) {
  header .container.header-container {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .logo {
    justify-content: center;
    margin-bottom: 0.5rem;
  }

  .search-wrapper {
    max-width: 100%;
    justify-content: space-between;
  }
}

/* Titles & Breadcrumbs */
.breadcrumbs {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  color: var(--text-main);
  line-height: 1.2;
}

.description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  max-width: 60ch;
}

/* Calculator Card */
.calculator-card {
  background: var(--surface-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem;
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

input[type="number"],
input[type="text"] {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--text-main);
  background-color: #fff;
  transition: all 0.2s;
}

input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
  /* Indigo shadow */
}

/* Custom Range Slider */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
  margin: 10px 0;
}

input[type=range]:focus {
  outline: none;
  box-shadow: none;
  border: none;
}

input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: var(--primary-light);
  border-radius: 99px;
  border: none;
}

input[type=range]::-webkit-slider-thumb {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -7px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

/* Custom Radio & Checkbox */
input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--primary-color);
  width: 1.1rem;
  height: 1.1rem;
}

button.btn-primary {
  width: 100%;
  background: var(--primary-gradient);
  color: white;
  font-weight: 600;
  font-size: 1.125rem;
  padding: 1rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
  transition: transform 0.1s, box-shadow 0.2s;
  margin-top: 1rem;
}

button.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}

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

/* Result Area */
#result-container {
  margin-top: 2rem;
  padding: 2.5rem;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid rgba(22, 163, 74, 0.2);
  border-radius: var(--radius);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Result Sparkle Effect */
#result-container::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 60%);
  opacity: 0.5;
  pointer-events: none;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-label {
  color: #047857;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: block;
}

.result-value {
  font-size: 3rem;
  font-weight: 800;
  color: #059669;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Content Area */
.content-area {
  background: var(--surface-color);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  margin-top: 3rem;
}

.content-area h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  color: var(--text-main);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.content-area h2:first-child {
  margin-top: 0;
}

.content-area p,
.content-area li {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.content-area ul {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.faq-item {
  margin-bottom: 2rem;
  background: var(--bg-color);
  padding: 1.5rem;
  border-radius: var(--radius);
}

.faq-item h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.faq-item p {
  margin-bottom: 0;
  font-size: 1rem;
}

/* Sidebar & Ads */
aside {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.ad-slot {
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-weight: 500;
  border-radius: var(--radius);
  min-height: 250px;
}

/* Footer */
footer {
  margin-top: auto;
  padding: 3rem 0;
  background: white;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.hidden {
  display: none !important;
}


* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Layout */
header {
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

.container {
  width: 90%;
  max-width: var(--max-width);
  margin: 0 auto;
}

header .container.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

/* Search Styles */
.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 400px;
  /* Increased width */
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

#search-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  /* Bigger padding for icon and height */
  border: 1px solid var(--border-color);
  border-radius: 50px;
  /* More rounded */
  font-size: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

#search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.search-results {
  position: absolute;
  top: 110%;
  /* Slight gap */
  left: 0;
  right: 0;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  margin-top: 0;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  padding: 0.5rem 0;
}

.search-result-item {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
  transition: background-color 0.1s;
}

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

.search-result-item:hover {
  background-color: var(--bg-color);
}

.search-result-category {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.hidden {
  display: none !important;
  /* Force hide */
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--primary-color);
}

main {
  flex: 1;
  padding: 2rem 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  main {
    grid-template-columns: 3fr 1fr;
    /* Content | Sidebar */
  }
}

/* Calculator Card */
.calculator-card {
  background: var(--surface-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 2rem;
}

h1 {
  font-size: 1.875rem;
  margin-bottom: 1rem;
}

.description {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

input[type="number"],
input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.2s;
}

input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-color);
}

.btn-primary {
  width: 100%;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  background-color: var(--primary-color);
  color: white;
  font-weight: 600;
  padding: 0.75rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

/* Result Area */
#result-container {
  margin-top: 1.5rem;
  padding: 1rem;
  background-color: #f0fdf4;
  /* Light green */
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  text-align: center;
}

.hidden {
  display: none;
}

.result-label {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.result-value {
  font-size: 2rem;
  font-weight: 700;
  color: #15803d;
  /* Green 700 */
}

/* Sidebar & Ads */
aside {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ad-slot {
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 0.875rem;
  border-radius: var(--radius);
  min-height: 250px;
  /* Standard sidebar ad height */
}

/* Content Area for SEO text */
.content-area {
  max-width: 65ch;
  /* Readable line length */
  margin-top: 2rem;
}

.content-area h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.content-area p {
  margin-bottom: 1rem;
}

footer {
  margin-top: auto;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  background: var(--surface-color);
  text-align: center;
  color: var(--text-muted);
}

/* Related Calculators Sidebar */
.related-calculators {
  background: var(--surface-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.related-calculators h3 {
  background: var(--primary-gradient);
  color: white;
  padding: 1rem 1.25rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.related-calculators ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.related-calculators ul::-webkit-scrollbar {
  width: 6px;
}

.related-calculators ul::-webkit-scrollbar-track {
  background: var(--bg-color);
}

.related-calculators ul::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.related-calculators ul::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.related-calculators li {
  border-bottom: 1px solid var(--border-color);
}

.related-calculators li:last-child {
  border-bottom: none;
}

.related-calculators li a {
  display: flex;
  align-items: center;
  padding: 0.875rem 1.25rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  position: relative;
}

.related-calculators li a::before {
  content: '→';
  margin-right: 0.75rem;
  color: var(--primary-color);
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.2s ease;
}

.related-calculators li a:hover {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.08) 0%, transparent 100%);
  color: var(--primary-color);
  padding-left: 1.5rem;
}

.related-calculators li a:hover::before {
  opacity: 1;
  transform: translateX(0);
}

/* Print Styles */
@media print {

  header,
  footer,
  aside,
  .ad-slot,
  .breadcrumbs {
    display: none !important;
  }

  main {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .calculator-card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* Badge for calculator count */
.related-calculators-count {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  margin-left: 0.5rem;
  font-weight: 500;
}