/*  styles-compound-interest-calculator.css
    Purpose      Stand-alone Compound-Interest Calculator widget:
                 ▸ responsive two-row input grid with tool-tip help
                 ▸ Chart.js growth line-chart, live summary, fade-in updates
                 ▸ affiliate-banner slot, PDF download icon & print page-break
                 ▸ full mobile-portrait, tablet and ≤932 px landscape support
    Used by      public/compound-interest-calculator.html
    Depends on   Chart.js v4, global --cc-* colour variables
    Last updated 31 Jul 2025
*/

/* Compound Interest Calculator Styles */
.compound-calculator-container {
  position: relative;
  max-width: 1000px;
  width: 100%;
  margin: 50px auto;
  margin-top: 30px !important;
  padding: 25px;
  background: #333333;
  border-radius: 12px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
  color: #fff;
  text-align: center;
  border: 1px solid #cccccc;
}

h1 {
  margin-bottom: 10px;
  font-size: 28px;
}

.description {
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.4;
}

/* Input fields container styling */
.input-fields {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}

.input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
}

/* Default styling for input groups */
.input-group {
  /* Remove fixed min/max widths for dynamic resizing */
  /*flex: 1;*/ 
  text-align: left;
}

.input-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 5px;
  font-size: 16px;
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border-radius: 5px;
  border: 1px solid #ccc;
  background: #fff;
  color: #333;
  box-sizing: border-box;
}

/* Chart container */
.chart-container {
  margin-bottom: 20px;
}

.chart-container canvas {
  width: 100% !important;
  max-height: 400px;
}

/* Summary styling */
.summary {
  font-size: 16px;
  padding: 10px;
  background: #444;
  border-radius: 8px;
}

/* Fade-In Animation for updates */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

/* Affiliate Banner Styles */
.affiliate-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
}
.affiliate-banner a {
  display: inline-block;
}
.affiliate-banner img {
  width: 728px;
  height: 110px;
  object-fit: contain;
}

/* Mobile Portrait Styles for Affiliate Banner */
@media (max-width: 768px) and (orientation: portrait) {
  .affiliate-banner {
    display: flex !important;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
  }
  .affiliate-banner img {
    width: 100%;
    max-width: 300px;
    height: auto;
  }
}

.chart-container canvas {
  width: 100% !important;
  height: 400px;
}

div#result-text.result {
  margin-bottom: 20px !important;
  font-size: 24px;
}

div#summary.summary {
  border-radius: 12px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
  border: 1px solid #cccccc;
}

/* Smaller tooltip icon and inline with the title */
.cc-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 3px;
    background-color: var(--cc-primary-color, #4ea1d3);
    color: #fff;
    cursor: pointer;
    padding: 0;
    margin-right: 4px;  /* Gap between tooltip icon and label */
}

.cc-tooltip:hover {
    background-color: var(--cc-hover-color, #3b86a8);
}

.cc-info-icon {
    font-size: 12px;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Tooltip Text: positioned to the left of the tooltip icon */
.cc-tooltip-text {
    position: absolute;
    right: 110%;  /* Positions the tooltip text to the left of the icon */
    top: 50%;
    transform: translateY(-50%);
    visibility: hidden;
    opacity: 0;
    background-color: var(--cc-tooltip-bg-color, #2c3e50);
    color: var(--cc-tooltip-text-color, #fff);
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 12px;
    white-space: normal;
    max-width: 200px;
    min-width: 150px;
    transition: visibility 0.3s, opacity 0.3s;
    z-index: 10;
    text-align: center;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
}

/* Show tooltip text on hover */
@media (hover: hover) {
    .cc-tooltip:hover .cc-tooltip-text {
        visibility: visible;
        opacity: 1;
    }
}

/* For mobile tap activation */
.cc-tooltip.active .cc-tooltip-text {
    visibility: visible;
    opacity: 1;
}

.input-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px; /* Space between title and input */
}

.input-title label {
  transform: translateY(3px);
}

p.description {
  color: #cccccc;
}

/* --- NEW OVERRIDES for dynamic width alignment --- */
/* Top row: 3 input groups; subtract 2 gaps (15px each) */
.input-fields .input-row:first-child .input-group {
  flex: 0 0 calc((80% - 30px) / 3) !important;
  max-width: none !important;
  min-width: 0 !important;
}

/* Bottom row: 2 input groups; subtract 1 gap (15px) */
.input-fields .input-row:last-child .input-group {
  flex: 0 0 calc((80% - 15px) / 2) !important;
  max-width: none !important;
  min-width: 0 !important;
}


@media (max-width: 768px) and (orientation: portrait) {
    .compound-calculator-container {
    max-width: 1000px;
    width: 90%;
    margin: 50px auto;
    margin-top: 30px !important;
    padding: 25px;
    background: #333333;
    border-radius: 12px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
    color: #fff;
    text-align: center;
    border: 1px solid #cccccc;
  }

  .input-row {
    flex-direction: column;
    gap: 10px; /* space between stacked items */
  }
  .input-row .input-group {
    flex: 0 0 90% !important;
    max-width: 90% !important;
    min-width: 90% !important;
  }
  /* If you want uniform heights */
  .input-row .input-group input,
  .input-row .input-group select {
    height: 40px; /* set your preferred height */
  }

    .cc-tooltip-text {
      left: 105%; /* positions tooltip on the right */
      right: auto; 
      top: 50%;
      transform: translateY(-50%);
  }

}


@media (max-width: 932px) and (orientation: landscape) {
  /* Restore row layout similar to desktop */
  .input-row {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
  }

  /* First row: 3 columns */
  .input-fields .input-row:first-child .input-group {
    flex: 0 0 calc((80% - 30px) / 3) !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  /* Second row: 2 columns */
  .input-fields .input-row:last-child .input-group {
    flex: 0 0 calc((80% - 15px) / 2) !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  /* Force container to fit the landscape width */
  .compound-calculator-container {
    width: 90% !important;
    margin: 20px auto;
  }

  /* Ensure the chart doesn't overflow */
  .chart-container canvas {
    width: 100% !important;
    max-height: 300px !important; /* adjust height as needed */
  }

  /* Make titles smaller */
  .input-title label {
    font-size: 12px !important;
  }

  /* Match dropdown height to other fields */
  .input-row .input-group input,
  .input-row .input-group select {
    height: 40px !important; /* Adjust as needed */
  }
}


/* Tablet layout (mimicking desktop) */
@media (min-width: 769px) and (max-width: 1024px) {
  .input-row {
    flex-direction: row;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
  }

  /* First row: 3 columns */
  .input-fields .input-row:first-child .input-group {
    flex: 0 0 calc((80% - 30px) / 3) !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  /* Second row: 2 columns */
  .input-fields .input-row:last-child .input-group {
    flex: 0 0 calc((80% - 15px) / 2) !important;
    max-width: none !important;
    min-width: 0 !important;
  }
}



.download-icon {
  position: absolute;          /* Absolute so it can sit in top-right corner */
  top: 10px;
  right: 10px;
  background-color: #4ea1d3;   /* Or your desired color */
  color: #fff;
  padding: 8px 10px;
  border-radius: 5px;
  cursor: pointer;
  z-index: 999;               /* Make sure it sits on top of the container */
  transition: background-color 0.2s;
}

.download-icon:hover {
  background-color: #3b86a8;
}


.page-break {
  height: 0;
  page-break-before: always; /* For older browsers */
  break-before: page;        /* For modern browsers */
}


