/* Ensure body has relative positioning for absolute overlay */
body#simulate {
  position: relative;
}

/* Background blur overlay for S&P 500 calculator - match fee-impact positioning */
body#simulate.loaded #background-blur-overlay,
body.sp500-calculator.loaded #background-blur-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: url(../tw-web-assets/home-page/BackgroundBlurs.webp) !important;
  background-size: 100% 100% !important;
  background-position: top !important;
  background-repeat: no-repeat !important;
  z-index: -1 !important;
  opacity: 1 !important;
  pointer-events: none !important;
}

:root {
  --primary: #67bc7c;
  --primary-pressed: #5aa86b;
  --third-color: #616a75;
  --primary-text-color: #ffffff;
  --secondary-text-color: rgba(255, 255, 255, 0.8);
  --input-bg: rgba(235, 240, 243, 0.05);
  --input-border: rgba(213, 221, 225, 0.25);
}

/* Remove conflicting pseudo-element - use main background system */
body#simulate::before {
  display: none;
}

/* Ensure content appears above the blur */
body#simulate > * {
  position: relative;
}



/* Header Section */
.top-section {
  margin-top: 150px;
  padding: 20px;
  position: relative;
}

.header-container {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  gap: 100px;
}

.title-container {
  flex: 1;
  text-align: left;
  max-width: 600px;
}

.map-section-header {
  flex: 0 0 auto;
  max-width: 400px;
}

/* Default visibility - show desktop, hide mobile */
.map-section-header.desktop-only {
  display: block;
}

.map-section-header.mobile-only {
  display: none;
}

.result-title {
  font-family: 'Cal Sans', sans-serif;
  font-size: 72px;
  font-weight: 400;
  color: white;
  margin-bottom: 20px;
  line-height: 77px;
}

.result-subtitle {
  font-family: 'SF Pro Display', sans-serif;
  font-size: 18px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.4;
  margin-bottom: 40px;
}

/* Input Styling */
#future-value-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 2;
  display: block !important;
}

.calc-card-div {
  display: flex !important;
  gap: 40px;
  align-items: flex-start;
  margin-bottom: 60px;
  visibility: visible !important;
}

.calc-card {
  flex: 1;
  max-width: 409px;
  display: block !important;
  visibility: visible !important;
  height: 100%;
  display: flex !important;
  flex-direction: column;
}

#calc-form-wrapper {
  display: block !important;
  visibility: visible !important;
}

.result-wrapper {
  display: block !important;
  visibility: visible !important;
}

.form-group {
  margin-bottom: 24px;
  overflow: visible;
}

.input-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  backdrop-filter: blur(10px);
  margin-bottom: 20px;
}

.input-container label {
  font-family: 'SF Pro Display', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: white;
  margin-bottom: 4px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 300px;
}

.info {
  position: relative;
  display: inline-block;
}

.info-icon {
  color: rgba(255, 255, 255, 0.6);
  font-size: 16px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.info-icon:hover {
  color: var(--primary);
}

.tooltiptext {
  visibility: hidden;
  width: 200px;
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  text-align: center;
  border-radius: 6px;
  padding: 8px 12px;
  position: absolute;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-family: 'SF Pro Display', sans-serif;
  font-size: 12px;
  line-height: 1.4;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

.info:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

.fv-calc-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  color: white;
  font-family: 'SF Pro Display', sans-serif;
  font-size: 18px;
  text-align: center;
  transition: all 0.3s ease;
}

.fv-calc-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(103, 188, 124, 0.2);
}

.fv-calc-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

/* Calculate Button */
.btn-os.btn-calculator {
  width: 100% !important;
  height: 50px !important;
  background: linear-gradient(135deg, #67bc7c 0%, #5aa86b 100%) !important;
  border: none !important;
  border-radius: 12px !important;
  color: white !important;
  font-family: 'SF Pro Text', sans-serif !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  box-shadow: 0 2px 8px rgba(103, 188, 124, 0.2) !important;
  margin: 0 !important;
  padding: 0 !important;
}

.btn-os.btn-calculator:hover {
  background: linear-gradient(135deg, #5aa86b 0%, #4a9a5b 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 20px rgba(103, 188, 124, 0.6) !important;
}

.btn-os.btn-calculator:active {
  transform: translateY(0) !important;
  box-shadow: 0 2px 8px rgba(103, 188, 124, 0.2) !important;
}

.btn-os.btn-calculator span {
  color: white !important;
  font-weight: 600 !important;
  text-align: center !important;
  width: 100% !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  position: relative !important;
}

.btn-os.btn-calculator span:after {
  display: none !important;
  content: none !important;
}

/* Results Display */
.estimated-title {
  flex: 1;
  background: linear-gradient(135deg, rgba(17, 42, 24, 0.5) 0%, rgba(5, 14, 8, 0.5) 100%);
  background-image: url(./img/fv-bg.webp);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(17, 42, 24, 1);
  border-radius: 12px;
  padding: 40px;
  position: relative;
  overflow: hidden;
  height: 100%;
  min-height: 535px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.estimated-title h2 {
  font-family: 'SF Pro Display', sans-serif;
  font-size: 28px;
  font-weight: 500;
  color: white;
  margin-bottom: 8px;
}

.estimated-title h6 {
  font-family: 'SF Pro Display', sans-serif;
  font-size: 18px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
}

.estimated-title h3 {
  font-family: 'Cal Sans', sans-serif;
  font-size: 98px;
  font-weight: 400;
  color: white;
  margin-bottom: 10px;
  line-height: 1;
}

.contributions-container {
  margin-bottom: 8px;
}

.contributions-container p {
  font-family: 'SF Pro Display', sans-serif;
  font-size: 18px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 4px;
  opacity: 0.8 !important;
}

.contributions-container h6 {
  font-family: 'SF Pro Display', sans-serif;
  font-size: 18px;
  font-weight: 500;
  opacity: 0.8 !important;
  color: rgba(255, 255, 255, 0.6);
}

.contributions-container p {
  opacity: 0.8 !important;
}

.disclosure-tag {
  font-family: 'SF Pro Display', sans-serif;
  font-size: 12px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.6);
  max-width: 400px;
}

/* Main Content Container */
.main-content-container {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
  gap: 40px;
}

.calc-section {
  flex: 1;
  max-width: 600px;
}

.map-section {
  flex: 1;
  max-width: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-section .map-section {
  max-width: 400px;
}

/* Map Section Compact */
.map-section-compact {
  padding: 40px 0;
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.map-section-compact .container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Map of the Markets Section */
#map-button-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 20px;
  position: relative;
}

#button-container {
  flex: 1;
  max-width: 100%;
  min-width: 225px;
  text-align: left;
}

#button-p {
  font-family: 'SF Pro Display', sans-serif;
  font-size: 14px;
  color: #a3a5a3;
  margin-bottom: 6px;
}

.troutwood-brand {
  font-family: 'Troutwood', sans-serif;
  color: white;
}

#button-title {
  font-family: 'Cal Sans', sans-serif;
  font-size: 25px;
  font-weight: 400;
  color: white;
  margin-bottom: 16px;
  line-height: 1.2;
}

#explore-button {
  background: #e06247;
  border: none;
  border-radius: 6px;
  color: white;
  font-family: 'SF Pro Display', sans-serif;
  font-size: 18px;
  font-weight: 600;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#explore-button:hover {
  background: #D45236;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(224, 98, 71, 0.3);
}

#finn-computer {
  flex: 0 0 auto;
  width: 70%;
  position: relative;
}

#finn-img {
  width: 100%;
  height: auto;
  border-radius: 12px;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .header-container {
    flex-direction: column;
    gap: 40px;
    text-align: center;
  }
  
  .title-container {
    max-width: 100%;
  }
  
  .map-section-header.desktop-only {
    display: none;
  }
  
  .map-section-header.mobile-only {
    display: block;
    max-width: 400px;
    margin: 40px auto 0;
    padding: 0 20px;
  }
  
  .map-container {
    max-width: 400px;
    margin: 0 auto;
  }
  
  #map-button-container-mobile {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
  }
  
  #finn-computer-mobile {
    flex: 0 0 auto;
    width: 70%;
    position: relative;
    margin-bottom: 0;
  }
  
  #finn-img-mobile {
    width: 100%;
    height: auto;
    border-radius: 12px;
  }
  
  #button-container-mobile {
    flex: 1;
    max-width: 100%;
    min-width: 225px;
    text-align: left;
  }
  
  #button-p-mobile {
    font-family: 'SF Pro Display', sans-serif;
    font-size: 14px;
    color: #a3a5a3;
    margin-bottom: 8px;
    line-height: 1.4;
  }
  
  #button-title-mobile {
    font-family: 'Cal Sans', sans-serif;
    font-size: 25px;
    font-weight: 400;
    color: white;
    margin-bottom: 15px;
    line-height: 1.2;
  }
  
  #explore-button-mobile {
    background: #e06247;
    border: none;
    border-radius: 6px;
    color: white;
    font-family: 'SF Pro Display', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
  }
  
  #explore-button-mobile:hover {
    background: #D45236;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(224, 98, 71, 0.3);
  }
  
  /* Keep calculator and results side by side until 768px */
  .calc-card-div {
    flex-direction: row;
    gap: 30px;
  }
  
  .calc-card {
    flex: 1;
    max-width: 50%;
  }
  
  .estimated-title {
    flex: 1;
    max-width: 50%;
    min-height: 300px;
  }
  
  .future-value-amount {
    font-size: 64px;
  }
  
  #button-title {
    font-size: 48px;
    line-height: 1.2;
  }
}

/* iPad Pro (12.9") (834px - 1023px) */
@media (max-width: 1023px) and (min-width: 834px) {
  /* Keep calculator and results side by side */
  .calc-card-div {
    flex-direction: row;
    gap: 25px;
  }
  
  .calc-card {
    flex: 1;
    max-width: 50%;
  }
  
  .estimated-title {
    flex: 1;
    max-width: 50%;
    min-height: 280px;
  }
  
  .future-value-amount {
    font-size: 60px;
  }
  
  #button-title-mobile {
    font-size: 30px;
  }
}

/* iPad Pro (11") and iPad (10.2") (768px - 833px) */
@media (max-width: 833px) and (min-width: 768px) {
  /* Keep calculator and results side by side */
  .calc-card-div {
    flex-direction: row;
    gap: 20px;
  }
  
  .calc-card {
    flex: 1;
    max-width: 50%;
  }
  
  .estimated-title {
    flex: 1;
    max-width: 50%;
    min-height: 260px;
  }
  
  .future-value-amount {
    font-size: 56px;
  }
  
  #button-title-mobile {
    font-size: 28px;
  }
}

@media (max-width: 768px) {
  .top-section {
    margin-top: 120px;
    padding: 0 0 10px 0;
  }
  
  .header-container {
    flex-direction: column;
    gap: 30px;
    text-align: center;
  }
  
  .title-container {
    max-width: 100%;
    text-align: center;
  }
  
  /* Hide desktop map section on mobile */
  .map-section-header.desktop-only {
    display: none !important;
  }
  
  /* Show mobile map section on mobile */
  .map-section-header.mobile-only {
    display: block !important;
    max-width: 400px;
    margin: 30px auto 0;
    padding: 0 20px;
  }
  
  .result-title {
    font-size: 48px;
    line-height: 1.2;
  }
  
  .result-subtitle {
    font-size: 18px;
  }
  
  #map-button-container {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }
  
  #finn-computer {
    max-width: 120px;
  }
  
  #button-container {
    text-align: center;
  }
  
  #button-title {
    font-size: 36px;
  }
  
  /* Mobile map section styling */
  #map-button-container-mobile {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  #finn-computer-mobile {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
  }
  
  #finn-img-mobile {
    max-width: 100%;
    width: 100%;
  }
  
  #button-container-mobile {
    text-align: center;
  }
  
  #button-p-mobile {
    font-size: 14px;
  }
  
  #button-title-mobile {
    font-size: 24px;
  }
  
  #explore-button-mobile {
    padding: 10px 20px;
    font-size: 14px;
  }
  
  .future-value-amount {
    font-size: 56px;
  }
  
  .future-value-label {
    font-size: 24px;
  }
  
  /* Stack calculator and results vertically on mobile - calculator on top */
  .calc-card-div {
    flex-direction: column;
    gap: 30px;
  }
  
  /* Reorder elements so calculator appears first */
  .calc-card {
    order: 1;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
  }
  
  .estimated-title {
    order: 2;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
  }
  
  /* Mobile input sizing */
  .calc-card input[type="number"],
  .calc-card input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid rgba(213, 221, 225, 0.25);
    background: rgba(235, 240, 243, 0.05);
    color: white;
    box-sizing: border-box;
  }
  
  .calc-card input[type="number"]:focus,
  .calc-card input[type="text"]:focus {
    outline: none;
    border-color: #67BC7C;
    box-shadow: 0 0 0 2px rgba(103, 188, 124, 0.2);
  }
  
  .calc-card label {
    font-size: 14px;
    margin-bottom: 8px;
    display: block;
    color: rgba(255, 255, 255, 0.8);
  }
  
  .calc-card .form-group {
    margin-bottom: 20px;
  }
  
  /* Mobile input wrapper sizing */
  .input-wrapper {
    max-width: 100%;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .result-title {
    font-size: 36px;
  }
  
  .result-subtitle {
    font-size: 16px;
  }
  
  .future-value-amount {
    font-size: 42px;
  }
  
  #button-title {
    font-size: 28px;
  }
  
  .calc-card {
    max-width: 100%;
  }
}

/* App Button Section Styles */
.map-section-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#map-button-container {
  width: 100%;
  max-width: 400px;
}

#dynamic-link {
  text-decoration: none;
  display: block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#dynamic-link:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

#app-button {
  background: transparent;
  border: 1px solid rgba(17, 42, 24, 1);
  border-radius: 16px;
  padding: 30px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 8px 25px rgba(103, 188, 124, 0.2);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

#app-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(103, 188, 124, 0.1) 0%, rgba(95, 142, 232, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#app-button:hover::before {
  opacity: 1;
}

#app-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(103, 188, 124, 0.3);
  border-color: rgba(103, 188, 124, 0.5);
}

#app-store-icon {
  max-width: 60px !important;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
  position: relative;
}

#app-button:hover #app-store-icon {
  transform: scale(1.05);
}

#map-text {
  color: white;
  font-family: 'SF Pro Display', sans-serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  margin: 0;
  position: relative;
  flex: 1;
}

#map-text span {
  color: #67BC7C;
  font-family: 'Troutwood', sans-serif;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
}

#app-button:hover #map-text span {
  color: #5f8ee8;
}

/* Responsive adjustments for app button */
@media (max-width: 768px) {
  .map-section-header {
    padding: 15px;
  }
  
  #app-button {
    padding: 20px;
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }
  
  #map-text {
    font-size: 16px;
  }
  
  #app-store-icon {
    max-width: 50px !important;
  }
}

/* Slider Styles */
input[type="range"].spend-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px !important;
  background: linear-gradient(90deg, #67BC7C 0%, #5f8ee8 100%);
  outline: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 1px 4px rgba(103, 188, 124, 0.2);
}

input[type="range"].spend-slider:hover {
  box-shadow: 0 2px 8px rgba(103, 188, 124, 0.3);
}

input[type="range"].spend-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border: 2px solid #67BC7C;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

input[type="range"].spend-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(103, 188, 124, 0.3);
  border-color: #5f8ee8;
}

input[type="range"].spend-slider::-webkit-slider-thumb:active {
  transform: scale(0.95);
}

input[type="range"].spend-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #ffffff;
  border: 2px solid #67BC7C;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

input[type="range"].spend-slider::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(103, 188, 124, 0.3);
  border-color: #5f8ee8;
}

input[type="range"].spend-slider::-moz-range-thumb:active {
  transform: scale(0.95);
}

.slider-container {
  position: relative;
  margin: 10px 0;
}

.slider-value {
  position: absolute;
  top: -20px;
  background: none;
  background: linear-gradient(135deg, #67BC7C 0%, #5f8ee8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
  font-size: 14px;
  min-width: 50px;
  text-align: center;
  transform: translateX(-50%);
  transition: left 0.1s ease;
  left: 50%; /* Start at 50% position to match initial slider value */
}