body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    line-height: 1.6;
}

/* Main Calculator Section Styling */
.calculator-section {
    margin: 0;
    padding: 15px;
    background-color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    width: 100%;
}

/* Title Styling */
.calculator-section .title-container {
    background-color: #0056b3;
    color: white;
    padding: 25px 15px;
    text-align: center;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
}
.indented-list {
    margin-left: 40px; /* Adjust value as needed for further indentation */
}

.calculator-section .title-container h1 {
    margin: 0;
    font-size: 28px;
    color: white;
}

/* Dynamic Equation Display */
.calculator-section .dynamic-equation {
    background-color: #e7f5ff;
    color: #000;
    padding: 10px;
    text-align: center;
    font-size: 20px;
    border-radius: 6px;
    min-height: 40px;
    margin-bottom: 10px;
    transition: all 0.3s ease-in-out;
}

/* Calculator Form */
.calculator-section #calculator-form {
    background-color: #fff;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Form Group Styling */
.calculator-section .form-group {
    margin-bottom: 15px;
    transition: all 0.3s ease-in-out;
}

.calculator-section .form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
}

/* Input and Select Styling */
.calculator-section .input-group {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.calculator-section .input-group input[type='number'],
.calculator-section .input-group input[type='text'],
.calculator-section .input-group select {
    padding: 8px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    height: 35px;
    width: 100%;
}

.calculator-section .input-group input[type='number'],
.calculator-section .input-group input[type='text'] {
    flex: 1 1 60%;
    margin-right: 10px;
}

.calculator-section .input-group select {
    flex: 1 1 35%;
}

/* Tooltip Styling */
.calculator-section .tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin-left: 8px;
    color: #0056b3;
}

.calculator-section .tooltip .fas {
    font-size: 16px;
}

/* Tooltip Positioning */
.calculator-section .tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: 125%; /* Position above the icon */
    transform: translateX(-50%);
    background-color: #0056b3;
    color: #fff;
    padding: 8px;
    border-radius: 4px;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    font-size: 12px;
    transition: opacity 0.3s ease-in-out;
    z-index: 1;
    min-width: 160px;
    max-width: 200px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.calculator-section .tooltip::after {
    /* Additional positioning for larger screens */
}

@media (min-width: 481px) {
    .calculator-section .tooltip::after {
        left: auto;
        right: 100%; /* Position to the left of the icon */
        bottom: 50%;
        transform: translateY(-50%);
        margin-right: 8px;
    }
}

/* Show Tooltip on Hover and Focus */
.calculator-section .tooltip:hover::after,
.calculator-section .tooltip:focus::after {
    opacity: 1;
    visibility: visible;
}

/* Highlighted Input Styles */
.highlight {
    border-color: #5cb85c; /* Green border */
}

.calculator-section .input-group input.highlight {
    background-color: #e0ffe0;
    border-color: #28a745;
}

.calculator-section .form-group label.highlight {
    color: #28a745;
}

/* Readonly and Disabled Input Styles */
input[readonly],
input[disabled] {
    background-color: #f9f9f9;
    cursor: not-allowed;
}

/* Reset Button Styling */
.calculator-section #calculator-form button[type='reset'] {
    background-color: #e7f5ff;
    color: #333;
    font-weight: bold;
    font-size: 16px;
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.3s ease-in-out;
}

.calculator-section #calculator-form button[type='reset']:hover {
    background-color: #d1e7ff;
}

/* Solution Steps Styling */
.calculator-section .solution-steps {
    background-color: #f9f9f9;
    border-left: 4px solid #0056b3;
    padding: 10px;
    border-radius: 6px;
    animation: fadeIn 0.5s ease-in-out;
    margin-bottom: 20px;
    overflow-x: auto;
}

.calcYulator-section .solution-steps h2 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #0056b3;
}

.calculator-section .solution-steps .steps-content {
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

.calculator-section .solution-steps .steps-content p {
    margin-bottom: 10px;
}

/* Existing styles ... */

/* Equation Styling */
.equation {
    background-color: #f9f9f9;
    border-left: 5px solid #0056b3;
    padding: 15px;
    margin: 20px 0;
    overflow-x: auto; /* Added to enable horizontal scrolling */
    white-space: nowrap; /* Prevents the equation from wrapping */
    /* font-family: "Courier New", Courier, monospace; */
}

.equation span {
    display: inline-block;
    font-size: 1.2em; /* Adjust as needed for better visibility */
}

/* Existing styles ... */

.equation-inline {
    font-size: 1em;
    background-color: #f9f9f9;
    padding: 2px 5px;
    border-radius: 3px;
}

.subscript {
    vertical-align: sub;
    font-size: smaller;
}

.superscript {
    vertical-align: super;
    font-size: smaller;
}

/* Table Styling */
.calculator-section table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    table-layout: auto;
}

.calculator-section table,
.calculator-section th,
.calculator-section td {
    border: 1px solid #ccc;
}

.calculator-section th,
.calculator-section td {
    padding: 8px;
    text-align: left;
    word-wrap: break-word;
}

.calculator-section th {
    background-color: #f2f2f2;
}

.calculator-section table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Keyframes for Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Social Share Bar Styling */
.social-share-container {
    max-width: 1200px;
    margin-top: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

.social-share-container:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.social-share-container .share-label {
    font-size: 1.25em;
    font-weight: bold;
    color: #0056b3;
}

.social-share-container .social-share-bar {
    display: flex;
    gap: 10px;
}

.social-share-container .share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #ffffff;
    font-size: 1em;
    width: 35px;
    height: 35px;
    border: 2px solid #0056b3;
    border-radius: 50%;
    transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-color: #0056b3;
}

.social-share-container .share-btn:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Specific Colors for Each Share Button */
.social-share-container .share-btn.facebook { background-color: #3b5998; }
.social-share-container .share-btn.x { background-color: #1da1f2; }
.social-share-container .share-btn.linkedin { background-color: #0077b5; }
.social-share-container .share-btn.email { background-color: #c71610; }
.social-share-container .share-btn.copy-link { background-color: #555555; }

/* Hover Effects for Each Share Button */
.social-share-container .share-btn.facebook:hover { background-color: #2d4373; }
.social-share-container .share-btn.x:hover { background-color: #0d95e8; }
.social-share-container .share-btn.linkedin:hover { background-color: #005582; }
.social-share-container .share-btn.email:hover { background-color: #a30b0b; }
.social-share-container .share-btn.copy-link:hover { background-color: #333333; }

/* Article and Paragraph Styling */
.calculator-section article {
    margin-bottom: 20px;
}

.calculator-section h2 {
    color: #0056b3;
    font-size: 22px;
    margin-bottom: 10px;
}

.calculator-section h3 {
    font-size: 18px;
    margin-bottom: 5px;
    color: #0056b3;
}

.calculator-section h4 {
    font-size: 16px;
    margin-bottom: 5px;
    color: #0056b3;
}

.calculator-section p {
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 15px;
}

.calculator-section ul {
    margin-left: 20px;
    list-style-type: disc;
}

.calculator-section ul li {
    margin-bottom: 10px;
}

/* Media Queries for Responsiveness */

/* NEW: Full-bleed Astra containers at ≤992px */
@media (max-width: 992px) {
    .ast-container,
    .site-content .ast-container,
    .ast-container-fluid {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

@media (max-width: 768px) {
    /* Adjust calculator section padding */
    .calculator-section {
        padding: 15px;
    }
    .ast-container,
    .ast-container-fluid {
        padding: 0;
        width: 100%;
        max-width: 100%;
        margin: 0 auto; /* Centers the container */
        overflow: hidden; /* Prevents child elements from causing overflow */
    }

    /* Adjust title font size */
    .calculator-section .title-container h1 {
        font-size: 20px;
        white-space: normal;
    }

    /* Adjust social share container layout */
    .social-share-container {
        margin-top: 10px;
        flex-direction: column;
        align-items: center;
        margin-bottom: 10px;
    }

    .social-share-container .share-label {
        margin-bottom: 5px;
    }

    .social-share-container .social-share-bar {
        gap: 8px;
    }

    /* Fallback for browsers not supporting gap */
    @supports not (gap: 8px) {
        .social-share-container .social-share-bar .share-btn:not(:last-child) {
            margin-right: 8px;
        }
    }

    /* Adjust share buttons margin */
    .social-share-container .share-btn {
        margin: 5px 0;
    }

    /* Adjust headings and equation font sizes */
    .calculator-section h2 {
        font-size: 20px;
    }

    .calculator-section .dynamic-equation {
        overflow-x: auto; /* Enables horizontal scrolling when content overflows */
        white-space: nowrap; /* Prevents text from wrapping to the next line */
        max-width: 100%; /* Ensures the container doesn't exceed the parent width */
        box-sizing: border-box; /* Includes padding and border in the element's total width */
    }
    .calculator-section .dynamic-equation span {
        display: inline-block;
        font-size: 1.2em; /* Adjust as needed for better visibility */
    }

    /* Adjust table font size */
    .calculator-section table,
    .calculator-section th,
    .calculator-section td {
        font-size: 14px;
    }

    .calculator-section .solution-steps .steps-content {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    /* Further reduce padding for very small screens */
    .calculator-section {
        padding: 10px;
    }

    /* Ensure title wraps correctly */
    .calculator-section .title-container h1 {
        white-space: normal;
    }

    /* Adjust input and select font sizes */
    .calculator-section .input-group input[type='number'],
    .calculator-section .input-group input[type='text'],
    .calculator-section .input-group select {
        font-size: 14px;
    }

    /* Adjust social share container padding */
    .social-share-container {
        padding: 10px;
    }

    /* Adjust share label */
    .social-share-container .share-label {
        display: block;
        margin-bottom: 10px;
        font-size: 1em;
    }

    /* Adjust share bar */
    .social-share-container .social-share-bar {
        margin-left: 0;
        gap: 8px;
    }

    /* Adjust headings and equation font sizes */
    .calculator-section h2 {
        font-size: 18px;
    }

    .calculator-section h3 {
        font-size: 16px;
    }

    .calculator-section .dynamic-equation {
        font-size: 14px;
    }

    /* Further adjust table font size */
    .calculator-section table,
    .calculator-section th,
    .calculator-section td {
        font-size: 12px;
    }

    .calculator-section .solution-steps .steps-content {
        font-size: 12px;
    }

    /* Adjust Tooltip Positioning on Mobile */
    .calculator-section .tooltip::after {
        left: 50%;
        bottom: 125%;
        transform: translateX(-100%);
        margin-right: 0;
    }
}

/* ===================================== */
/* ======= ADDITIONS / ENHANCEMENTS ===== */
/* (All new rules are appended only)     */
/* ===================================== */

/* 1) Buttons used by calculators (reusable) */
.calculator-section .btn {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
  cursor: pointer;
  transition: background-color .2s ease-in-out, box-shadow .2s ease-in-out, transform .02s;
  font-weight: 600;
  height: 38px;
  background-color: #f7f9ff;
  color: #0b3a75;
}
.calculator-section .btn:hover { box-shadow: 0 3px 10px rgba(0,0,0,.08); }
.calculator-section .btn:active { transform: translateY(1px); }

.calculator-section .btn-secondary {
  background-color: #f5f7fb;
  color: #0056b3;
  border-color: #b7c6e6;
}
.calculator-section .btn-secondary:hover { background-color: #e8eefc; }

/* Keep your reset button but allow class upgrade w/o conflicts */
.calculator-section #calculator-form button[type='reset'].btn {
  width: 100%;
  background-color: #e7f5ff;
  color: #333;
  font-size: 16px;
  margin-top: 10px;
  border: 1px solid #ccc;
}
.calculator-section #calculator-form button[type='reset'].btn:hover { background-color: #d1e7ff; }

/* 2) Cash-flow table inputs & remove button (scoped) */
.calculator-section #cashFlowsTable td input[type="number"],
.calculator-section #cashFlowsTable td input[type="text"] {
  width: 100%;
  height: 32px;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 6px 8px;
  box-sizing: border-box;
  font-size: 14px;
}

.calculator-section button.row-remove {
  background-color: #ffecec;
  color: #a30000;
  border: 1px solid #ffb3b3;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  height: 32px;
}
.calculator-section button.row-remove:hover { background-color: #ffd6d6; }

/* 3) Accessibility: better focus rings for inputs/selects/buttons */
.calculator-section input[type="number"]:focus-visible,
.calculator-section input[type="text"]:focus-visible,
.calculator-section select:focus-visible,
.calculator-section button:focus-visible,
.social-share-container .share-btn:focus-visible {
  outline: 2px solid #0056b3;
  outline-offset: 2px;
}

/* 4) Fix for minor selector typo so H2 styling always applies */
.calculator-section .solution-steps h2 { /* ensures it applies even if .calcYulator-section is present elsewhere */
  font-size: 20px;
  margin-bottom: 10px;
  color: #0056b3;
}

/* 5) Long numbers/strings: prevent layout breakage */
.calculator-section .steps-content,
.calculator-section table td,
.calculator-section table th,
.calculator-section .dynamic-equation {
  word-break: break-word;
}
.calculator-section .nowrap { white-space: nowrap; }

/* 6) MathJax/equation polish on narrow screens */
@media (max-width: 768px) {
  .calculator-section .dynamic-equation { overflow-x: auto; white-space: nowrap; }
  .calculator-section .equation { overflow-x: auto; white-space: nowrap; }
}

/* 7) Reduced motion preference (no color changes) */
@media (prefers-reduced-motion: reduce) {
  .calculator-section .solution-steps,
  .calculator-section .dynamic-equation,
  .calculator-section .form-group {
    animation: none !important;
    transition: none !important;
  }
}

/* 8) Optional dark-mode polish (no page/background color changes) */
/* Keeps your original color scheme. Only subtle borders/shadows are tuned. */
@media (prefers-color-scheme: dark) {
  /* Avoid altering body or base backgrounds to preserve site scheme */
  .calculator-section {
    /* keep original bg and colors; just refine shadow slightly in dark mode environments */
    box-shadow: 0 4px 10px rgba(0,0,0,.35);
  }
  .social-share-container {
    /* keep original bg; only soften shadow */
    box-shadow: 0 4px 12px rgba(0,0,0,.35);
  }
  /* maintain existing color palette; no overrides to background-color or text color */
}

/* 9) Utility alignment for icon tooltips near buttons */
.calculator-section .input-group > .tooltip { line-height: 0; }

/* 10) Make dynamic result fields look deliberately read-only */
.calculator-section input[readonly] {
  background-image: linear-gradient(180deg, rgba(255,255,255,.6), rgba(240,240,240,.6));
}

/* 11) Minor spacing for inline action groups under tables */
.calculator-section .input-group.actions,
.calculator-section .calc-actions {
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================= */
/* MOBILE/TABLET STABILITY PATCH */
/* (Append-only improvements)    */
/* ============================= */

/* 1) Keep inputs, selects, and the info (i) tooltip on the same line */
.calculator-section .input-group {
  /* allow children to shrink properly and avoid unexpected wrapping */
  min-width: 0;
}
.calculator-section .input-group input[type='number'],
.calculator-section .input-group input[type='text'],
.calculator-section .input-group select {
  min-width: 0;              /* allow shrinking instead of pushing tooltip to next line */
  flex-shrink: 1;            /* inputs/selects can shrink a bit */
}
.calculator-section .input-group select {
  /* prevent select from forcing wrap; still wide enough to be usable */
  min-width: 90px;
  flex-basis: 30%;
}
.calculator-section .input-group > .tooltip {
  display: inline-flex;      /* keep icon inline with fields */
  align-items: center;
  flex: 0 0 auto;            /* do not let the tooltip wrap to a new line */
  white-space: nowrap;
  line-height: 0;
}

/* 2) Make equation boxes reliably scrollable on iOS & tablets */
.calculator-section .dynamic-equation,
.calculator-section .equation {
  overflow-x: auto !important;          /* ensure horizontal scroll exists */
  -webkit-overflow-scrolling: touch;    /* momentum scrolling on iOS */
  max-width: 100%;
  white-space: nowrap;                   /* keep math in one line; user can scroll */
  scrollbar-width: thin;                 /* nicer scrollbar on Firefox */
}
.calculator-section .dynamic-equation span,
.calculator-section .equation span {
  display: inline-block;                 /* keeps MathJax blocks scrollable */
  max-width: 100%;
}

/* Optional: subtle fade to hint scroll on narrow screens (no layout change) */
@media (max-width: 600px) {
  .calculator-section .dynamic-equation,
  .calculator-section .equation {
    position: relative;
    mask-image: linear-gradient(to right, rgba(0,0,0,1) 85%, rgba(0,0,0,0.4) 95%, rgba(0,0,0,0) 100%);
  }
}

/* 3) Tooltips: keep bubble fully on-screen on small devices */
@media (max-width: 600px) {
  .calculator-section .tooltip::after {
    /* center below the icon instead of off to the side */
    top: calc(100% + 8px);
    bottom: auto;
    left: 50vw;                          /* anchor to viewport center to avoid clipping */
    right: auto;
    transform: translateX(-50%);
    max-width: calc(100vw - 24px);       /* keep inside viewport with margin */
    width: max-content;
    word-break: normal;
    white-space: normal;                  /* wrap text instead of overflowing */
    text-align: left;
    z-index: 9999;                        /* ensure above inputs on iOS */
  }
  /* Larger tap target for the icon on mobile without changing layout */
  .calculator-section .tooltip .fas {
    padding: 6px 4px;
  }
}

/* 4) Ultra-small screens: allow inputs/selects to rebalance space without wrapping the (i) */
@media (max-width: 380px) {
  .calculator-section .input-group input[type='number'],
  .calculator-section .input-group input[type='text'] {
    flex: 1 1 55%;
    margin-right: 8px;
  }
  .calculator-section .input-group select {
    flex: 0 0 85px; /* slightly narrower select to keep the (i) icon on same line */
  }
}

/* 5) Steps table/equations inside solution drawer: prevent sideways jump and enable smooth scroll */
.calculator-section .solution-steps {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.calculator-section .solution-steps .equation {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 6) Accessibility: show tooltip on focus on mobile keyboards too (no layout change) */
.calculator-section .tooltip:focus::after {
  opacity: 1;
  visibility: visible;
}
