/* ================= GLOBAL ================= */
:root {
  --main-color: #1f4e79;      /* Trustworthy blue */
  --accent-color: #d97706;    /* Solar amber */
  --text-color: #2f2f2f;
  --border-color: #e5e7eb;
}

body, html {
  margin: 0;
  padding: 0;
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  background: linear-gradient(to bottom, #f0f7ff 0%, #f9f9f9 100%);
  color: var(--text-color);
}

/* ================= GLOBAL LINKS ================= */
a {
  color: var(--main-color);           /* main blue (#1f4e79) */
  font-weight: 600;                   /* bold like menu */
  text-decoration: none;              /* remove default underline */
  position: relative;                 /* needed for pseudo-element underline */
  transition: color 0.3s ease;
  cursor: pointer;
}

/* Hover and focus */
a:hover,
a:focus {
  color: var(--accent-color);           /* keep text blue */
  outline: none;                      /* remove default focus outline */
}

/* Sliding underline effect using pseudo-element */
a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;                       /* distance from text */
  width: 0;
  height: 2px;
  background-color: var(--accent-color); /* amber underline */
  transition: width 0.3s ease;
}

a:hover::after,
a:focus::after {
  width: 100%;
}

/* Remove hover effect from .logo */
.logo a::after {
  display: none;
}

/* Remove hover effect from .footer-logo */
.footer-logo a::after {
  display: none;
}


/*-- html --*/

html {
  scroll-behavior: smooth;
}

#mapSection {
  scroll-margin-top: 120px; /* height of your sticky header, to adjust for anchor links  */
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  color: var(--main-color);
}

.logo {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  color: var(--main-color);
}

.container {
  width: 92%;
  max-width: 1320px;
  margin: 0 auto;
}

/* ================= TOOLTIPS IN HEADINGS ================= */
.tooltip-icon {
  display: inline-block;
  position: relative;
  margin-left: 4px;
  cursor: pointer;
  vertical-align: super;
}

.tooltip-i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  font-size: 9px;
  font-weight: bold;
  line-height: 1;
  text-align: center;
}

.tooltip-icon .tooltip-text {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-color);
  color: #fff;
  font-family: 'Open Sans', sans-serif;
  font-weight: 400;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 220px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.tooltip-icon .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: var(--accent-color) transparent transparent transparent;
}

.tooltip-icon:hover .tooltip-text,
.tooltip-icon:focus .tooltip-text {
  opacity: 1;
  visibility: visible;
}

/* ================= HEADER ================= */
.site-header {
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

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

.logo {
  font-size: 1.6em;
  font-weight: 700;
}

/* ================= NAVIGATION ================= */
.main-nav {
  position: relative;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 22px;
  margin: 0;
  padding: 0;
}

.nav-links li a {
  text-decoration: none;
  font-weight: 600;
  color: var(--main-color);
  transition: color 0.2s ease;
  position: relative;
  padding-bottom: 4px;
}

.nav-links li a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent-color);
  transition: width 0.2s ease;
}

.nav-links li a:hover {
  color: var(--accent-color);
}

.nav-links li a:hover::after {
  width: 100%;
}

.nav-links li a.active {
  color: var(--accent-color);
}

.nav-links li a.active::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6em;
  cursor: pointer;
  color: var(--main-color);
}

/* ================= MOBILE HEADER ================= */
@media screen and (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    flex-direction: column;
    position: absolute;
    right: 0;
    top: 100%;
    background: #ffffff;
    width: 240px;
    display: none;
    border: 1px solid var(--border-color);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  }

  .nav-links.nav-open {
    display: flex;
  }

  .nav-links li {
    padding: 5px 10px;
    line-height: 1.6;          /* reduce inherited line-height */

  }

  .nav-links li a {
    color: var(--main-color);
  }
}

/* ================= MAIN SECTIONS ================= */
.section {
  background: #fff;
  padding: 5px 20px 20px 20px;
  margin-bottom: 20px;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  background: linear-gradient(to bottom, #ffffff 0%, #f9f9f9 100%);
}

.section:first-of-type {
  margin-top: 40px;
}

/* ================= TOP LAYOUT ================= */
.top-layout {
  display: block;
}

@media (min-width: 900px) {
  .top-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    align-items: start;
  }
}

/* ================= MAP ================= */
#map {
  overflow: hidden;
  margin-bottom: 20px;
}

#map svg {
  height: 100%;
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

/* ================= INPUT ROWS ================= */
.input-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.input-row label {
  white-space: nowrap;
  font-weight: 500;
}

.input-row .value {
  min-width: 70px;
  text-align: right;
  font-weight: 600;
  color: var(--accent-color);
}

.input-row .house-size {
  display: block;
  text-align: right;
  color: var(--accent-color);
  font-weight: 600;
  margin-top: 2px;
}

/* Wrapper for slider + value to allow mobile flex */
.input-row-slider {
  display: contents; /* acts like the children are directly in grid for desktop */
}

.input-row-slider input[type="range"] {
  width: 100%;
}

.input-row-slider .value {
  min-width: 70px;
  text-align: right;
  font-weight: 600;
  color: var(--accent-color);
}

/* ========== MOBILE INPUT ROWS ================= */
@media screen and (max-width: 1320px) {
  .input-row {
    display: grid;
    grid-template-columns: 1fr; /* label full width, slider+value below */
    gap: 6px;
    align-items: start;
  }

  .input-row label {
    white-space: normal; /* wrap tooltip text */
  }

  .input-row-slider {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px; /* space below slider/value on mobile */
  }

  .input-row-slider input[type="range"] {
    flex: 1;
    min-width: 0;
  }

  .input-row-slider .value {
    width: 70px;
    text-align: right;
    white-space: nowrap;
  } 
}

/* ================= Color for other output values ================= */
#dailyKwhDisplay,
#systemCostDisplay {
  color: var(--accent-color); /* your highlight color */
  font-weight: 600;            /* optional: match slider/value style */
}

/* Small screens, stack other output values the text */
@media screen and (max-width: 1320px) {
  #dailyKwhDisplay,
  #systemCostDisplay {
    display: block;     /* forces onto its own line */
    margin-top: 2px;    /* small spacing from label */
  }
}

/* ================= CHARTS ================= */
.charts-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .charts-container {
    grid-template-columns: 1fr 1fr;
  }
}

/* ================= CHART BOXES ================= */
.chart-box {
  width: 100%;
  position: relative;
  display: block;
}

.chart-box h3 {
  margin: 0 0 6px 0;
  font-size: 1em;
  font-weight: 500;
  color: var(--main-color);
}

.chart-box canvas {
  width: 100% !important;
  height: 340px !important;
  display: block;
}

/* ================= HEADINGS INSIDE SECTION BOXES ================= */
.section h2 {
  margin-top: 0px;
  margin-bottom: 6px;
  font-size: 1.3em;
  font-weight: 500;
}

/* ================= TOTAL SAVINGS TEXT ================= */
.total-savings {
  font-weight: 600;
  color: var(--accent-color);
  margin: 4px 0 12px 0;
}

.total-savings-label {
  display: inline-block;
  font-weight: 500;
  margin: 10px 0 20px 0;
  padding: 5px 14px;
  border: 2px solid rgba(217, 119, 6, 0.65);
  border-radius: 3px;
  background: rgba(217, 119, 6, 0.05);
  font-size: 1.2em;
}

/* ============================================ 
   Subtle styling for numeric input boxes 
============================================ */
#downpayment,
#singleIncentive,
#stateSelect {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px 10px;
  background-color: #f9f9f9;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  box-sizing: border-box;
}

#downpayment:focus,
#singleIncentive:focus,
#stateSelect:focus {
  border-color: #80bdff;
  box-shadow: 0 0 4px rgba(0,123,255,0.3);
  outline: none;
}

#stateSelect {
  width: 180px;
  display: inline-block;
}

/* ================= FOOTER ================= */
.site-footer {
  background: var(--main-color);
  color: #fff;
  text-align: center;
  padding: 24px 0;
  font-size: 0.9em;
}

/* ================= SLIDER BASE ================= */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  outline: none;
  margin: 0;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-color);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: filter 0.2s, transform 0.2s;
}

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

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-color);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: filter 0.2s, transform 0.2s;
}

input[type="range"]::-moz-range-thumb:hover {
  filter: brightness(1.1);
  transform: scale(1.05);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
}

input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--accent-color);
}

input[type="range"]::-ms-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-color);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: pointer;
}

input[type="range"]::-ms-fill-lower {
  background: var(--accent-color);
  border-radius: 3px;
}

input[type="range"]::-ms-fill-upper {
  background: #e5e7eb;
  border-radius: 3px;
}

/* ================ Logo image ============== */
.logo a,
.footer-logo a {
  display: inline-block;
}

.logo-header-img {
  height: 60px;
  width: auto;
  display: block;
}

.footer-logo {
  margin-bottom: 1rem;
}

.logo-footer-img {
  height: 40px;
  width: auto;
  display: block;
  margin: 0 auto;
}

/* Mobile: smaller header logo only */
@media (max-width: 640px) {
  .logo-header-img {
    height: 40px;
    width: auto;
  }
}
