/* Page-specific styles: multiple-loan-calculator.css */

body {
    font-family: 'Alibaba-PuHuiTi', sans-serif;
    background-color: var(--white);
    color: var(--dark-green);
    width: 100%;
    margin: 0 auto;
    overflow-x: hidden;
}

/* Typography Utilities */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'MiSans-Bold', sans-serif;
}


/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--medium-green) 0%, var(--teal-green) 100%);
    padding: 20px 5%;
    text-align: center;
    color: var(--white);
    position: relative;
}

.breadcrumb {
    display: none !important;
}

.hero h1 {
    font-size: 56px;
    color: var(--dark-color);
    margin-bottom: 15px;
    letter-spacing: -1px;
}

.hero p {
    font-size: 20px;
    color: var(--dark-color);
    opacity: 0.9;
    margin-bottom: 50px;
    font-weight: 500;
}

.search-container {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 22px 60px 22px 30px;
    border-radius: 60px;
    border: 4px solid var(--teal-green);
    font-size: 18px;
    outline: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    font-family: 'MiSans', sans-serif;
}

.search-icon {
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    color: var(--teal-green);
}

/* Quick Links */
.quick-links {
    background-color: var(--light-cream);
    padding: 40px 120px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.quick-label {
    font-weight: 700;
    margin-right: 10px;
    color: var(--dark-color);
    font-size: 18px;
}

.quick-btn {
    background-color: var(--white);
    color: var(--teal-green);
    border: 1px solid var(--teal-green);
    padding: 10px 25px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.quick-btn:hover {
    background-color: var(--teal-green);
    color: var(--white);
}

/* FAQ Categories */
.loan-section {
    padding: 100px 12px;
}

.loan-container {
    /*max-width: 1200px;*/
    /*margin: 0 auto;*/
    /*overflow-x: scroll;*/
}

.loan-container[hidden],
.saved-calc-load[hidden],
.calculator-entry[hidden],
.step-progress[hidden],
.btn-save[hidden] {
    display: none;
}

.calculator-entry {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    padding-top: 8px;
}

.calculator-entry .btn {
    min-width: 190px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 50px;
}

.section-icon {
    width: 50px;
    height: 50px;
    background-color: var(--teal-green);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 24px;
}

.section-title {
    font-size: 32px;
    color: var(--dark-color);
}

.loan-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* Accordion Styles */
.accordion-item {
    /*background-color: var(--white);*/
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
}

/* Simulate specific backgrounds for accordion items within sections if needed,
   but prompt says Section Background handles the main color.
   The items themselves usually are white or blend in.
   Let's keep items white or slightly off-white for contrast. */

.section-bg-cream .accordion-item {
    background-color: var(--white);
    border-color: rgba(0, 0, 0, 0.05);
}

.section-bg-pale-green .accordion-item {
    background-color: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.05);
}

.accordion-header {
    padding: 25px 30px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.accordion-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark-color);
    font-family: 'MiSans-Bold', sans-serif;
}

.accordion-icon {
    color: var(--teal-green);
    font-size: 24px;
    transition: transform 0.3s;
}

.accordion-content {
    padding: 0 30px 25px;
    font-size: 16px;
    line-height: 1.6;
    color: #5a6b7c;
    display: none;
}

/* Expanded State Simulation */
.accordion-item.expanded {
    border-left: 5px solid var(--teal-green);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.accordion-item.expanded .accordion-content {
    display: block;
}

.accordion-item.expanded .accordion-icon {
    transform: rotate(180deg);
}

/* Background Classes */
.bg-white {
    background-color: var(--white);
}

.bg-cream {
    background-color: var(--light-cream);
}

.bg-pale-green {
    background-color: var(--pale-green);
}

/* Still Have Questions */
.still-questions {
    background-color: var(--teal-green);
    padding: 100px 120px;
    text-align: center;
    color: var(--white);
}

.still-questions h2 {
    font-size: 42px;
    margin-bottom: 15px;
}

.still-questions p {
    font-size: 20px;
    margin-bottom: 50px;
    opacity: 0.9;
}

.cta-group {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.btn-cta-cream {
    background-color: var(--light-cream);
    color: var(--dark-color);
    padding: 16px 40px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 16px;
    border: none;
}

.btn-cta-medium {
    background-color: var(--medium-green);
    color: var(--dark-color);
    padding: 16px 40px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 16px;
    border: none;
}

.btn-cta-outline {
    background-color: var(--white);
    color: var(--teal-green);
    border: 2px solid var(--teal-green);
    /* Visual trick: white bg inside */
    /* The prompt says "white with teal border" */
    border: 2px solid #5aa58a;
    /* slightly darker teal for border visibility on white */
    padding: 14px 38px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 16px;
}


/*for calc*/


.subtitle {
    font-size: 24px;
    color: #6b7280;
    font-family: 'MiSans-Medium', sans-serif;
}

.calculator-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    background: #fff;
    border-radius: 40px;
    padding: 20px 0;
    box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

label {
    font-family: 'MiSans-Bold', sans-serif;
    font-size: 20px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

label i {
    color: #2563eb;
    font-size: 24px;
}




.output-section {
    background: linear-gradient(145deg, #1f2937, #111827);
    border-radius: 30px;
    padding: 50px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 40px;
    position: relative;
    overflow: hidden;
}

.output-section::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: rgba(37, 99, 235, 0.2);
    filter: blur(80px);
    border-radius: 50%;
}

.result-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.result-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.result-label {
    font-size: 20px;
    color: #9ca3af;
    font-family: 'MiSans-Medium', sans-serif;
    display: block;
    margin-bottom: 8px;
}

.result-value {
    font-size: 56px;
    font-family: 'MiSans-Bold', sans-serif;
    color: #60a5fa;
    line-height: 1.1;
}

.result-value.secondary {
    font-size: 40px;
    color: #34d399;
}

.table-container {
    background: #fff;
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.03);
    border: 1px solid #f3f4f6;
    margin-top: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.table-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.table-header h2 {
    font-size: 32px;
    font-family: 'MiSans-Bold', sans-serif;
    color: #1f2937;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 18px;
}

th {
    background: #f8fafc;
    padding: 24px;
    text-align: right;
    font-family: 'MiSans-Bold', sans-serif;
    color: #64748b;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
}

th:first-child {
    text-align: center;
    border-top-left-radius: 16px;
}

th:last-child {
    border-top-right-radius: 16px;
}

td {
    padding: 24px;
    /*text-align: right;*/
    border-bottom: 1px solid #f1f5f9;
    font-family: 'MiSans-Regular', sans-serif;
    color: #334155;
    transition: background-color 0.2s;
}

td:first-child {
    text-align: center;
    font-family: 'MiSans-Bold', sans-serif;
    color: #2563eb;
}

tr:hover td {
    background-color: #f8fafc;
}

tr:last-child td {
    border-bottom: none;
}

/* Decorative Elements */
.decoration-circle {
    position: fixed;
    border-radius: 50%;
    z-index: -1;
}

.circle-1 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(147, 197, 253, 0.05) 100%);
    top: -100px;
    left: -100px;
}

.circle-2 {
    width: 800px;
    height: 800px;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.03) 0%, rgba(249, 168, 212, 0.03) 100%);
    bottom: -200px;
    right: -200px;
}

/**/
/* Sidebar / Input Section */
.input-panel {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    height: fit-content;
    position: sticky;
    top: 40px;
}

.panel-header {
    margin-bottom: 30px;
}

.panel-title {
    font-family: 'Alibaba-PuHuiTi-Bold', sans-serif;
    font-size: 28px;
    color: var(--text-main);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-desc {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.form-group {
    margin-bottom: 24px;
}

.label {
    display: block;
    font-family: 'AlibabaSans-Medium', sans-serif;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    font-size: 20px;
}

.form-control {
    width: 100%;
    height: 56px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 0 16px 0 48px;
    font-size: 18px;
    font-family: 'AlibabaSans-Medium', sans-serif;
    color: var(--text-main);
    background: #f9fafb;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.btn-calculate {
    width: 100%;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 12px;
    font-family: 'Alibaba-PuHuiTi-Bold', sans-serif;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.4);
}

.btn-calculate:active {
    transform: translateY(0);
}

/* Results Section */
.results-panel {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.formula-card {
    background: linear-gradient(135deg, #1f2937, #111827);
    color: white;
    padding: 30px;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.formula-content {
    flex: 1;
}

.formula-title {
    font-family: 'AlibabaSans-Medium', sans-serif;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 12px;
}

.formula-display {
    font-family: 'Alibaba-PuHuiTi-Bold', sans-serif;
    font-size: 24px;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.formula-display sup {
    font-size: 0.6em;
}

.formula-vars {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 10px;
}

.monthly-payment-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px 30px;
    border-radius: 16px;
    text-align: right;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.monthly-payment-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 5px;
}

.monthly-payment-value {
    font-family: 'Alibaba-PuHuiTi-Bold', sans-serif;
    font-size: 42px;
    color: var(--accent-green);
}

.table-container {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.table-header-title {
    font-family: 'Alibaba-PuHuiTi-Bold', sans-serif;
    font-size: 24px;
    color: var(--text-main);
    margin-bottom: 25px;
    padding-left: 10px;
    border-left: 4px solid var(--primary-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

th {
    text-align: left;
    padding: 16px 20px;
    font-family: 'AlibabaSans-Medium', sans-serif;
    font-size: 14px;
    color: var(--text-secondary);
    background: #f9fafb;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
}

th:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

th:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

td {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 16px;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #f8fafc;
}

.currency {
    font-family: 'AlibabaSans-Medium', sans-serif;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.badge-month {
    background: #e0e7ff;
    color: var(--primary-color);
}

.empty-state {
    text-align: center;
    padding: 60px 0;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--border-color);
}

/* Animation */
@keyframes loanfadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: loanfadeIn 0.4s ease forwards;
}

/**/

.container {
    /*    width: 1400px;*/
    /*    margin: 60px auto;*/
    /*    background: var(--card-bg);*/
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.05);
    display: grid;
    grid-template-columns: 400px 1fr;
    overflow: hidden;
}

/* Sidebar / Input Section */
.input-section {
    background: var(--primary-color);
    color: white;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
}



h1 {
    font-family: 'MiSans-Bold', sans-serif;
    font-size: 36px;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

.subtitle {
    font-size: 16px;
    opacity: 0.7;
    margin-bottom: 40px;
    line-height: 1.6;
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-family: 'MiSans-Medium', sans-serif;
    font-size: 14px;
    opacity: 0.9;
}

.input-wrapper {
    position: relative;
}

.input-wrapper i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-size: 18px;
    opacity: 0.5;
}




/* Results Section */
.results-section {
    padding: 60px;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 900px;
}

.summary-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.summary-card {
    background: var(--bg-color);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.summary-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, transparent 50%, rgba(59, 130, 246, 0.05) 50%);
    border-radius: 0 20px 0 0;
}

.summary-label {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 10px;
    font-family: 'MiSans-Medium', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-value {
    font-family: 'MiSans-Bold', sans-serif;
    font-size: 42px;
    color: var(--heading-color);
    letter-spacing: -1px;
}

.summary-value.highlight {
    color: var(--accent-color);
}

.formula-box {
    background: #f1f5f9;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 40px;
    font-family: 'MiSans-Medium', sans-serif;
    color: #475569;
    font-size: 14px;
    border-left: 4px solid var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.formula-text {
    font-style: italic;
}

/* Table Section */
.table-container {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

.section-title {
    font-family: 'MiSans-Bold', sans-serif;
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--heading-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title span {
    width: 8px;
    height: 24px;
    background: var(--accent-color);
    border-radius: 4px;
    display: inline-block;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: #f8fafc;
}

th {
    text-align: left;
    padding: 20px;
    font-family: 'MiSans-Bold', sans-serif;
    color: #64748b;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: 'MiSans-Medium', sans-serif;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: #f1f5f9;
}

.col-month {
    width: 10%;
    color: var(--accent-color);
    font-weight: bold;
}

.col-right {
    text-align: right;
}

th.col-right {
    text-align: right;
}

/* Scrollbar styling */
.results-section::-webkit-scrollbar {
    width: 8px;
}

.results-section::-webkit-scrollbar-track {
    background: transparent;
}

.results-section::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 20px;
}

/* Initial State Hidden */
#results-content {
    opacity: 0;
    transition: opacity 0.5s ease;
}

#results-content.visible {
    opacity: 1;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94a3b8;
    text-align: center;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    color: #e2e8f0;
}

.empty-state p {
    font-size: 18px;
    max-width: 300px;
}

/* Calculator Section */
.loan-calculator-wrapper {
    /*max-width: 1200px;*/
    /*margin: -60px 5% 80px;*/
    /*width: 90%;*/
    /*margin-left: auto;*/
    /*margin-right: auto;*/
    /*margin:20px 20px;*/
    /*background: var(--white);*/
    /*border-radius: 20px;*/
    /*box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);*/
    /*border: 2px solid var(--teal-green);*/
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    overflow: hidden;
}

.loan-calc-form {
    display: none;
    margin: 20px 20px;
    /*padding: 40px;*/
    /*border-right: 1px solid var(--light-cream);*/
}

.calc-title {
    font-size: 32px;
    color: var(--dark-green);
    margin-bottom: 40px;
    font-weight: 700;
}

.input-group {
    margin-bottom: 35px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.label-row label {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-green);
}

.input-box {
    padding: 10px 15px;
    border: 2px solid var(--teal-green);
    border-radius: 8px;
    width: 180px;
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-green);
    text-align: right;
    font-family: inherit;
}

.range-slider {
    width: 100%;
    height: 8px;
    background: var(--light-cream);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--teal-green);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    border: 2px solid var(--white);
}

.dropdown {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--teal-green);
    border-radius: 12px;
    font-size: 18px;
    color: var(--dark-green);
    font-family: inherit;
    background: var(--white);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2377bfa3%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 20px top 50%;
    background-size: 16px auto;
}

.loan-calc-btn {
    width: 100%;
    padding: 20px;
    font-size: 20px;
    background: var(--teal-green);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 20px;
}

.loan-calc-btn:hover {
    background: var(--dark-green);
}

.loan-calc-results {
    background-color: var(--light-cream);
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.loan-result-row {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.loan-result-row .loan-result-card {
    flex: 1;
    min-width: 200px;
}

.loan-result-row,
.loan-result-grid {
    min-width: 0;
    width: 100%;
}

.loan-result-card {
    background: var(--white);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 2px solid var(--teal-green);
    position: relative;
}

.loan-result-header {
    font-size: 16px;
    color: var(--dark-green);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.loan-result-value-lg {
    font-size: clamp(30px, 2vw, 41px);
    font-weight: 800;
    color: var(--teal-green);
}

.loan-result-value-md {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark-green);
}

.loan-result-grid {
    display: flex;
    /*grid-template-columns: 1fr 1fr;*/
    gap: 100px;
    flex-wrap: wrap;
}

.chart-container {
    display: flex;
    align-items: center;
    gap: 30px;
    background: var(--white);
    padding: 20px;
    border-radius: 16px;
}

.pie-chart {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--teal-green) 0% 90%, var(--medium-green) 90% 100%);
    position: relative;
}

.pie-chart::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: var(--white);
    border-radius: 50%;
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.teal {
    background: var(--teal-green);
}

.dot.green {
    background: var(--medium-green);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 10px;
}

.schedule-table th {
    text-align: left;
    padding: 10px;
    color: var(--teal-green);
    border-bottom: 2px solid var(--teal-green);
}

.schedule-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    color: var(--dark-green);
}

/* Loan schedule table (injected by JS) - responsive with always-visible custom scrollbar */
.loan-schedule-wrapper {
    /* Use 'scroll' (not 'auto') so WebKit/Chrome renders a classic persistent
       scrollbar that does not fade out after inactivity (overlay-scrollbar mode). */
    overflow-x: scroll;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    /* Reserve space for the scrollbar so the layout never shifts */
    scrollbar-gutter: stable;
    border: 1px solid #eee;
    border-radius: 8px;
    background: var(--white);
    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: var(--teal-green) var(--light-cream);
}

/* Webkit / Chromium / Edge - always visible custom scrollbar */
.loan-schedule-wrapper::-webkit-scrollbar {
    height: 10px;
    -webkit-appearance: none;
    appearance: none;
}

.loan-schedule-wrapper::-webkit-scrollbar-track {
    background: var(--light-cream);
    border-radius: 5px;
}

.loan-schedule-wrapper::-webkit-scrollbar-thumb {
    background: var(--teal-green);
    border-radius: 5px;
    border: 2px solid var(--light-cream);
    min-width: 30px;
}

.loan-schedule-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--medium-green);
}

/* Keep the thumb visible in Chrome (prevent fade-in/out on inactivity) */
.loan-schedule-wrapper::-webkit-scrollbar-thumb:window-inactive {
    background: var(--teal-green);
}

/* When the table doesn't overflow, the scrollbar still shows but appears
   idle. Style the corner / horizontal-only state so it stays tidy. */
.loan-schedule-wrapper::-webkit-scrollbar-track:window-inactive {
    background: var(--light-cream);
}

.loan-schedule-wrapper table {
    width: 100%;
    min-width: 640px; /* force horizontal scroll on small screens */
    border-collapse: collapse;
    font-size: 14px;
    color: var(--dark-green);
}

.loan-schedule-wrapper thead th {
    text-align: left;
    padding: 12px 14px;
    color: var(--teal-green);
    border-bottom: 2px solid var(--teal-green);
    font-weight: 600;
    background: var(--white);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

.loan-schedule-wrapper tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    color: var(--dark-green);
    white-space: nowrap;
}

.loan-schedule-wrapper tbody tr:last-child td {
    border-bottom: none;
}

/* Sticky first column (Month) so user can scroll right while still seeing the month */
.loan-schedule-wrapper th:first-child,
.loan-schedule-wrapper td:first-child {
    position: sticky;
    left: 0;
    background: var(--white);
    z-index: 1;
    font-weight: 600;
    border-right: 1px solid #eee;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.04);
}

.loan-schedule-wrapper thead th:first-child {
    z-index: 3;
}

/* Examples Section */
.examples-section {
    background-color: var(--pale-green);
    padding: 80px 5%;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: 40px;
    color: var(--dark-green);
    margin-bottom: 15px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.example-card {
    background: var(--white);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
}

.example-card:hover {
    transform: translateY(-10px);
}

.ex-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--teal-green);
    border-bottom: 2px solid var(--light-cream);
    padding-bottom: 15px;
}

.ex-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 16px;
}

.ex-label {
    color: #666;
}

.ex-val {
    font-weight: 600;
    color: var(--dark-green);
}

.ex-highlight {
    background: var(--light-cream);
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.try-btn {
    margin-top: auto;
    width: 100%;
    padding: 15px;
    background: var(--white);
    color: var(--teal-green);
    border: 2px solid var(--teal-green);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.try-btn:hover {
    background: var(--teal-green);
    color: var(--white);
}

/* How It Works */
.how-it-works {
    padding: 80px 5%;
    background: var(--white);
    text-align: center;
}

.steps-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 60px;
    max-width: 1400px;
    margin: 60px auto 0;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.step-icon {
    width: 100px;
    height: 100px;
    background: var(--light-cream);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    color: var(--teal-green);
    font-size: 40px;
}

.step-item h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: var(--dark-green);
}

.step-item p {
    color: #666;
    line-height: 1.6;
    font-size: 16px;
    max-width: 300px;
}

/* FAQ */
.faq-section {
    background: var(--light-cream);
    padding: 80px 5%;
}

.faq-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.faq-item {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    border-left: 5px solid var(--teal-green);
}

.faq-q {
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
}

.faq-q i {
    color: var(--teal-green);
}

.faq-a {
    color: #555;
    font-size: 15px;
    line-height: 1.5;
}

/* CTA */


.cta-content {
    max-width: 800px;
    margin: 0 auto;
}

.cta-content h2 {
    font-size: clamp(32px, 6vw, 48px);
    margin-bottom: 20px;
}

.cta-content p {
    font-size: 20px;
    margin-bottom: 40px;
    opacity: 0.9;
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* Disclaimer */
.disclaimer {
    background: var(--white);
    padding: 30px 5%;
    text-align: center;
    font-size: 14px;
    color: #888;
    border-top: 1px solid #eee;
}

/* Footer */
footer {
    background: var(--dark-green);
    color: var(--white);
    padding: 80px 5% 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 60px;
}

.footer-logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--teal-green);
    margin-bottom: 20px;
    display: block;
}

.footer-desc {
    color: #aaa;
    line-height: 1.6;
    max-width: 300px;
}

.footer-col h4 {
    font-size: 18px;
    margin-bottom: 25px;
    color: var(--soft-sage);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: #ccc;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--teal-green);
}

.copyright {
    text-align: center;
    padding-top: 40px;
    color: #666;
    font-size: 14px;
}

/* Table Section */
.table-container {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

.section-title {
    font-family: 'MiSans-Bold', sans-serif;
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--heading-color);
    /* display: flex; */
    align-items: center;
    gap: 12px;
    text-align: center;
}

.section-title span {
    width: 8px;
    height: 24px;
    background: var(--accent-color);
    border-radius: 4px;
    display: inline-block;
}


/* Responsive Adjustments */
@media (max-width: 1024px) {
    .loan-calculator-wrapper {
        grid-template-columns: 1fr;
    }

    .loan-calc-form {
        border-right: none;
        border-bottom: 1px solid var(--light-cream);
    }

    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .faq-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

    .nav-links {
        gap: 15px;
        font-size: 14px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .cards-grid,
    .steps-container {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .cta-buttons {
        flex-direction: column;
    }

    .loan-result-grid {
        gap: 20px;
    }

    .loan-result-grid,
    .loan-result-row {
        flex-direction: column;
    }

    .loan-result-grid .loan-result-card,
    .loan-result-row .loan-result-card {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .loan-calculator-wrapper {
        width: 100%;
    }

    * {
        /*font-size: 8px!important;*/
        /* font-size: calc(1% + 1vw + 1vh) !important; */
        /* font-size: 14px; */
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .loan-calc-form,
    .loan-calc-results {
        padding: 20px;
    }
}

/* Accordion Styles */
.accordion-item {
    /*background-color: var(--white);*/
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
}


.section-bg-cream .accordion-item {
    background-color: var(--white);
    border-color: rgba(0, 0, 0, 0.05);
}

.section-bg-pale-green .accordion-item {
    background-color: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.05);
}

.accordion-header {
    padding: 25px 30px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.accordion-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark-color);
    font-family: 'MiSans-Bold', sans-serif;
}

.accordion-icon {
    color: var(--teal-green);
    font-size: 24px;
    transition: transform 0.3s;
}

.accordion-content {
    padding: 0 30px 25px;
    font-size: 16px;
    line-height: 1.6;
    color: #5a6b7c;
    display: none;
}

/* Expanded State Simulation */
.accordion-item.expanded {
    border-left: 5px solid var(--teal-green);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.accordion-item.expanded .accordion-content {
    display: block;
}

.accordion-item.expanded .accordion-icon {
    transform: rotate(180deg);
}

/**/


#calculate-btn.active {
    background: var(--medium-green);
}

#calculate-btn :hover {
    background: var(--teal-green);
}

#calculate-btn :disabled {
    background: var(--light-cream);
    color: #aaa;
    cursor: not-allowed;
}

.loan-section {
    padding: 10px 5%;
}

.is-visible {
    opacity: 1;
    /* Final state: fully visible */
}

.loan-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* Mobile-first loan fields */
.loan-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 0;
}

.loan-fields label {
    width: 42%;
    flex-shrink: 0;
    padding: 5px 0;
    font-weight: 600;
}

.loan-fields input,
.loan-fields select {
    flex: 1;
    min-width: 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 12px 8px;
    font-size: 16px;
}

.loan-fields b {
    flex-basis: 100%;
    width: 100%;
}

/* Desktop layout for loan fields */
@media (min-width: 768px) {
    .loan-fields {
        flex-direction: row;
        gap: 10px;
        align-items: center;
    }

    .loan-fields label {
        width: 210px;
        padding: 10px 0;
        flex-shrink: 0;
    }

    .loan-fields input,
    .loan-fields select {
        width: 250px;
        flex-shrink: 0;
    }
}

input::placeholder {
    padding: 5px;
    font-weight: bolder;
}

input[readonly],
input[disabled] {
    font-size: 16px;
    font-weight: bolder;
    border-radius: 10px;
    text-align: end;
    background-color: #f5f5f5;
    cursor: not-allowed;
}

input[required],
select[required] {
    font-size: 16px;
    font-weight: bolder;
    border-radius: 10px;
    text-align: end;
    border: 2px solid #088760;
}

/* Better focus states for accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--teal-green);
    outline-offset: 2px;
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Prevent horizontal overflow on mobile */
.loan-calculator-wrapper,
.calculator-wrapper,
.container {
    max-width: 100%;
    overflow-x: hidden;
}

/* Mobile-friendly animations */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.d-none {
    display: none;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .loan-calculator-wrapper {
        grid-template-columns: 1fr;
        /*margin: -60px 3% 80px;*/
    }

    .loan-calc-form {
        border-right: none;
        border-bottom: 1px solid var(--light-cream);
    }
}

@media (max-width: 1200px) {
    .hero,
    .quick-links,
    .loan-section,
    .still-questions,
    footer {
        padding-left: 40px;
        padding-right: 40px;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }

    .calculator-wrapper {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .container {
        grid-template-columns: 1fr;
    }

    .input-section {
        border-radius: 20px 20px 0 0;
    }

    .results-section {
        border-radius: 0 0 20px 20px;
    }
}

@media (max-width: 992px) {
    .nav-links,
    .header-actions {
        display: none;
    }

    .hero h1 {
        font-size: 42px;
    }

    .quick-links {
        padding: 30px 20px;
    }

    .loan-fields {
        flex-direction: column;
        gap: 15px;
    }

    .loan-fields label {
        width: 100%;
        padding: 5px 0;
    }

    .loan-fields input,
    .loan-fields select {
        width: 100%;
        max-width: 100%;
    }

    .summary-cards {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .loan-result-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 768px) {

    input[readonly],
    input[disabled] {
        font-size: 14px;

        text-align: start;

    }

    input[required],
    select[required] {
        font-size: 14px;

        text-align: start;

    }


    .hero {
        padding: 60px 20px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .hero p {
        font-size: 18px;
    }

    .search-input {
        padding: 15px 50px 15px 20px;
        font-size: 16px;
    }

    .loan-section {
        padding: 60px 20px;
    }

    .section-title {
        font-size: 24px;
    }

    .still-questions {
        padding: 60px 20px;
    }

    .still-questions h2 {
        font-size: 28px;
    }

    .cta-group {
        flex-direction: column;
        align-items: center;
    }

    .cta-group button {
        width: 100%;
        max-width: 300px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .footer-brand p {
        max-width: 100%;
    }

    .accordion-title {
        font-size: 16px;
    }

    /* Mobile calculator improvements */
    .loan-calculator-wrapper {
        /*margin: -40px 2% 60px;*/
        border-radius: 16px;
    }

    .loan-calc-form,
    .loan-calc-results {
        padding: 30px 20px;
    }

    .calc-title {
        font-size: 24px;
        margin-bottom: 30px;
    }

    .input-box {
        width: 120px;
        font-size: 16px;
    }

    .loan-result-value-lg {
        font-size: 28px;
    }

    .loan-result-value-md {
        font-size: 24px;
    }

    .loan-result-header {
        font-size: 13px;
        letter-spacing: 0.3px;
    }

    .loan-result-card {
        min-width: 0;
    }

    .chart-container {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

}

@media (max-width: 576px) {
    .hero {
        padding: 40px 15px;
    }

    .hero h1 {
        font-size: 28px;
        line-height: 1.2;
    }

    .hero p {
        font-size: 16px;
    }

    .search-input {
        padding: 12px 45px 12px 15px;
        font-size: 14px;
    }

    .loan-section {
        padding: 40px 15px;
    }

    .still-questions {
        padding: 40px 15px;
    }

    .still-questions h2 {
        font-size: 24px;
    }

    .quick-links {
        padding: 20px 15px;
        flex-direction: column;
        align-items: stretch;
    }

    .quick-label {
        margin-right: 0;
        margin-bottom: 10px;
        text-align: center;
    }

    .loan-calculator-wrapper {
        /*margin: -10px 1% 40px;*/
        border-radius: 12px;
    }

    .loan-calc-form,
    .loan-calc-results {
        padding: 20px 15px;
    }

    .calc-title {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .input-group {
        margin-bottom: 25px;
    }

    .input-box {
        width: 100%;
        font-size: 14px;
        padding: 8px 12px;
    }

    .loan-result-value-lg {
        font-size: 24px;
    }

    .loan-result-value-md {
        font-size: 20px;
    }

    .loan-result-header {
        font-size: 12px;
        letter-spacing: 0.2px;
    }

    /* Mobile table responsiveness */
    .schedule-table,
    .amortizationTable,
    .amortizationTable2 {
        font-size: 12px;
    }

    .schedule-table th,
    .schedule-table td,
    .amortizationTable th,
    .amortizationTable td,
    .amortizationTable2 th,
    .amortizationTable2 td {
        padding: 8px 4px;
    }

    /* Make tables scrollable on mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Loan schedule: compact layout on small screens */
    .loan-schedule-wrapper table {
        font-size: 12px;
        min-width: 560px;
    }

    .loan-schedule-wrapper thead th,
    .loan-schedule-wrapper tbody td {
        padding: 8px 10px;
    }

    /* Slightly thicker scrollbar thumb on touch devices for easier grabbing */
    .loan-schedule-wrapper::-webkit-scrollbar {
        height: 12px;
    }

    /* Form improvements */
    input[type="number"],
    select {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    button {
        padding: 16px;
        font-size: 16px;
    }

    .btn {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 24px;
    }

    .section-title {
        font-size: 20px;
    }

    .accordion-header {
        padding: 20px 15px;
    }

    .accordion-content {
        /*padding: 0 15px 20px;*/
    }

    .loan-result-value-lg {
        font-size: 20px;
    }

    .loan-result-value-md {
        font-size: 18px;
    }

    /* Hide some columns on very small screens */
    .amortizationTable th:nth-child(2),
    .amortizationTable td:nth-child(2),
    .amortizationTable2 th:nth-child(2),
    .amortizationTable2 td:nth-child(2) {
        display: none;
    }
}

/* Landscape orientation fixes */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        padding: 30px 20px;
    }

    .hero h1 {
        font-size: 24px;
        margin-bottom: 10px;
    }

    .hero p {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .loan-calculator-wrapper {
        /*margin: -20px 2% 30px;*/
    }

    .loan-calc-form,
    .loan-calc-results {
        padding: 20px;
    }
}

/* Mobile-first loan fields */
.loan-fields {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
}

.loan-fields label {
    width: 100%;
    padding: 5px 0;
    font-weight: 600;
}

.loan-fields input, .loan-fields select {
    width: 100%;
    max-width: 100%;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 12px;
    font-size: 16px;
}

/* Desktop layout for loan fields */
@media (min-width: 768px) {
    .loan-fields {
        flex-direction: row;
        gap: 10px;
        align-items: center;
    }

    .loan-fields label {
        width: 210px;
        padding: 10px;
        flex-shrink: 0;
    }

    .loan-fields input, .loan-fields select {
        width: 250px;
        flex-shrink: 0;
    }
}

input[readonly], input[disabled] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

input[required], select[required] {
    border: 2px solid #ff0000;
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
    .accordion-header {
        min-height: 44px; /* iOS touch target */
    }

    .quick-btn {
        min-height: 44px;
        padding: 12px 20px;
    }

    button {
        min-height: 44px;
    }

    .btn-cta-cream,
    .btn-cta-medium,
    .btn-cta-outline {
        min-height: 44px;
        padding: 12px 30px;
    }

    /* Remove hover effects on touch devices */
    .quick-btn:hover,
    button:hover,
    .btn-cta-cream:hover,
    .btn-cta-medium:hover,
    .btn-cta-outline:hover {
        transform: none;
        box-shadow: none;
    }

    /* Add active states for touch */
    .quick-btn:active,
    button:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
}

/* Calculator controls */
.loan-type-selector {
    max-width: 720px;
    margin: 8px 0 18px;
    padding: 18px 20px;
    border: 1px solid #dce9e2;
    border-radius: 14px;
    background: #f7fbf8;
}

.loan-type-label {
    display: block;
    margin-bottom: 10px;
    color: var(--dark-green);
    font-size: 15px;
    font-weight: 700;
}

.loan-type-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.loan-type-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    padding: 14px 32px;
    border: 1px solid #1c3148;
    border-radius: 999px;
    background: #1c3148;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: .01em;
    text-align: center;
    box-shadow: 0 6px 14px rgba(28, 49, 72, .25);
    transition: transform .2s ease, filter .2s ease, background-color .2s ease, color .2s ease, box-shadow .2s ease;
}

.loan-type-option input {
    position: absolute;
    opacity: 0;
}

.loan-type-option:focus-within {
    outline: 2px solid #1c3148;
    outline-offset: 3px;
}

.loan-type-option.is-selected {
    border-color: #1c3148;
    background: #1c3148;
    color: #fff;
    border-width: 3px;
    box-shadow: 0 6px 14px rgba(28, 49, 72, .25), inset 0 0 0 2px #fff;
}

.loan-type-help {
    margin: 10px 0 0;
    color: #c0392b;
    font-size: 13px;
}

.currency-input,
.percent-input {
    display: flex;
    align-items: center;
    width: 250px;
    overflow: hidden;
    border: 1px solid #cbd8d0;
    border-radius: 10px;
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.currency-input:focus-within,
.percent-input:focus-within {
    border-color: var(--teal-green);
    box-shadow: 0 0 0 3px rgba(72, 155, 116, .15);
}

.currency-input > span,
.percent-input > span {
    padding: 0 0 0 13px;
    color: #668075;
    font-weight: 700;
}

.currency-input input,
.percent-input input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
}

.percent-input > span {
    padding: 0 13px 0 0;
}

@media (max-width: 767px) {
    .loan-type-options {
        grid-template-columns: 1fr;
    }

    .currency-input,
    .percent-input {
        width: 100%;
    }
}

/* Required fields and primary calculator controls */
.required-mark {
    color: #c0392b;
    font-weight: 800;
}

.field-help {
    flex-basis: 100%;
    margin: -5px 0 0 222px;
    color: #c0392b;
    font-size: 12px;
}

.interest-options-help {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--dark-green);
}

.field-help.interest-help {
    color: var(--dark-green);
}

.loan-fields select {
    appearance: none;
    width: 250px;
    min-height: 48px;
    padding: 12px 42px;
    border: 1px solid #cbd8d0;
    border-radius: 10px;
    background-color: #fff;
    background-image: linear-gradient(45deg, transparent 50%, #4d7965 50%), linear-gradient(135deg, #4d7965 50%, transparent 50%);
    background-position: calc(100% - 18px) 21px, calc(100% - 12px) 21px;
    background-repeat: no-repeat;
    background-size: 6px 6px, 6px 6px;
    color: #284c3a;
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    text-align-last: center;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.loan-fields select option {
    text-align: center;
}

.duration-select {
    width: 250px;
    flex: 0 0 250px;
}

.duration-select select {
    display: block;
    width: 100%;
    max-width: 250px;
    box-sizing: border-box;
}

/* Within calculator steps, keep inputs/selects compact (desktop only) */
@media (min-width: 768px) {
    .calc-step .loan-fields input,
    .calc-step .loan-fields select {
        width: 200px;
    }

    .calc-step .currency-input,
    .calc-step .percent-input {
        width: 200px;
    }

    .calc-step .duration-select {
        width: 200px;
        flex: 0 0 200px;
    }

    .calc-step .duration-select select {
        max-width: 200px;
    }
}

.loan-fields select:hover {
    border-color: var(--teal-green);
    background-color: #fbfefc;
}

.loan-fields select:focus {
    border-color: var(--teal-green);
    box-shadow: 0 0 0 3px rgba(72, 155, 116, .15);
    outline: none;
}

#calculate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 190px;
    min-height: 48px;
    margin: 18px 0 4px;
    padding: 12px 24px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--teal-green), var(--dark-green));
    box-shadow: 0 8px 18px rgba(42, 107, 75, .22);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: .02em;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

#calculate-btn::after {
    content: '\2192';
    margin-left: 10px;
    font-size: 20px;
    line-height: 1;
}

#calculate-btn:hover:not(:disabled) {
    filter: brightness(1.06);
    transform: translateY(-2px);
    box-shadow: 0 11px 22px rgba(42, 107, 75, .3);
}

#calculate-btn:active:not(:disabled) {
    transform: translateY(0);
}

#calculate-btn:disabled {
    background: #9aaba1;
    box-shadow: none;
    cursor: wait;
    opacity: .8;
}

@media (max-width: 767px) {
    .duration-select,
    #calculate-btn {
        width: 100%;
        flex-basis: 100%;
    }

    .duration-select select {
        max-width: none;
    }

    .field-help {
        margin-left: 0;
    }

    .step-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Multi-step calculator flow */
.calc-step {
    display: none;
    padding: 18px 20px;
    margin-bottom: 18px;
    border-radius: 14px;
}

.calc-step.active {
    display: block;
}

/* Slightly different shade for each section */
.calc-step[data-step="1"] {
    background: #f8fbf9;
}

.calc-step[data-step="2"] {
    background: #f3f8f5;
}

.calc-step[data-step="3"] {
    background: #edf4ef;
}

.calc-step[data-step="4"] {
    background: #e7f0ea;
}

.step-progress {
    display: inline-block;
    margin: 0 0 14px;
    padding: 6px 16px;
    border-radius: 50px;
    background: #eef6f1;
    color: var(--dark-green);
    font-size: 13px;
    font-weight: 700;
}

.step-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 22px;
}

/* Within a step, hide the actions until the step's field is answered */
.calc-step .step-actions[hidden] {
    display: none;
}

.step-actions .btn {
    margin: 0;
}

.step-actions #calculate-btn {
    margin: 0;
}

.btn-back,
.btn-restart {
    width: auto;
    min-width: 130px;
    margin-top: 14px;
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
}

.btn-back {
    background: #fff;
    border: 1px solid #c9d8cf;
    color: var(--dark-green);
}

.btn-back:hover {
    background: #f0f7f3;
    border-color: var(--teal-green);
}

.btn-restart {
    background: #fff;
    border: 1px solid #e3b0ac;
    color: #b0413e;
}

.btn-restart:hover {
    background: #fdf1f0;
    border-color: #c0392b;
}

.step-next {
    width: auto;
    min-width: 150px;
    background: linear-gradient(135deg, var(--teal-green), var(--dark-green));
    color: #fff;
    box-shadow: 0 6px 14px rgba(42, 107, 75, .2);
}

.step-next:hover {
    filter: brightness(1.06);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(42, 107, 75, .3);
}

/* Saved calculation load bar */
.saved-calc-load {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    max-width: 720px;
    margin: 0 0 14px;
    padding: 12px 16px;
    border: 1px solid #dce9e2;
    border-radius: 12px;
    background: #f7fbf8;
}

.saved-calc-load label {
    font-weight: 700;
    color: var(--dark-green);
    font-size: 14px;
}

.saved-calc-load input {
    flex: 1 1 200px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #c9d8cf;
    border-radius: 8px;
    font-size: 15px;
    text-transform: uppercase;
}

.saved-calc-load input:focus {
    outline: 2px solid var(--teal-green);
    outline-offset: 2px;
}

.saved-calc-load .btn {
    min-width: 120px;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
}

/* Save button */
.btn-save {
    width: auto;
    min-width: 130px;
    min-height: 44px;
    margin: 0;
    padding: 11px 20px;
    border-radius: 12px;
    background: var(--teal-green);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 6px 14px rgba(42, 107, 75, .2);
}

.btn-save:hover {
    filter: brightness(1.06);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(42, 107, 75, .3);
}

.btn-save.is-saved,
.btn-save.is-saved:hover,
.btn-save:disabled {
    background: #aeb8b2;
    border-color: #aeb8b2;
    color: #fff;
    filter: grayscale(1);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#calculate-btn.is-calculated,
#calculate-btn.is-calculated:hover {
    background: #aeb8b2;
    border-color: #aeb8b2;
    color: #fff;
    filter: grayscale(1);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Save/load modal */
.save-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    box-sizing: border-box;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 40px);
    margin: auto;
    padding: 26px 24px;
    border: 0;
    border-radius: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}

.save-modal::backdrop {
    background: rgba(13, 32, 22, .55);
}

.save-modal h3 {
    margin: 0 0 14px;
    color: var(--dark-green);
    font-size: 20px;
    font-weight: 800;
}

.save-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #667;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.save-modal-close:hover {
    background: #f0f7f3;
    color: var(--dark-green);
}

.save-modal label {
    display: block;
    margin: 0 0 6px;
    font-weight: 700;
    color: var(--dark-green);
    font-size: 14px;
}

.save-modal input[type="email"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #c9d8cf;
    border-radius: 10px;
    font-size: 15px;
}

.save-modal input[type="email"]:focus {
    outline: 2px solid var(--teal-green);
    outline-offset: 2px;
}

.save-email-confirm {
    margin: 0 0 10px;
    padding: 12px 14px;
    border: 1px solid #dce9e2;
    border-radius: 10px;
    background: #f0f7f3;
    color: var(--dark-green);
    font-size: 15px;
    font-weight: 700;
    word-break: break-all;
}

.save-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.save-modal-actions .btn {
    min-width: 130px;
    min-height: 44px;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
}

@media (min-width: 768px) {
    .save-modal-actions {
        flex-wrap: nowrap;
    }

    .save-modal-actions .btn {
        flex: 1 1 0;
    }
}

.save-id-label {
    margin: 4px 0;
    font-size: 13px;
    color: #60756a;
}

.save-id-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px dashed var(--teal-green);
    border-radius: 10px;
    background: #f0f7f3;
}

.save-id-box span {
    flex: 1;
    font-family: monospace;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .06em;
    color: var(--dark-green);
    word-break: break-all;
}

.save-id-box strong {
    flex: 1;
    font-family: monospace;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .06em;
    color: var(--dark-green);
    word-break: break-all;
}

.save-id-box .is-copied {
    background: var(--teal-green);
    color: var(--white);
}

.save-error {
    margin: 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fdf1f0;
    border: 1px solid #e3b0ac;
    color: #b0413e;
    font-size: 14px;
}

.save-note {
    margin: 0 0 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #f0f7f3;
    border: 1px solid #bfd9ca;
    color: #3c6b52;
    font-size: 14px;
}

body.modal-open {
    overflow: hidden;
}

@media (max-width: 767px) {
    .saved-calc-load {
        width: 100%;
    }

    .saved-calc-load .btn,
    .saved-calc-load input {
        width: 100%;
        flex-basis: 100%;
    }

    .save-modal {
        max-width: none;
        width: calc(100% - 40px);
    }

    .save-modal-actions {
        flex-direction: column;
    }

    .save-modal-actions .btn {
        width: 100%;
        min-width: 0;
    }
}

/* Improved scrolling and performance */
* {
    -webkit-tap-highlight-color: transparent;
}

body {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Keep calculator controls consistent while retaining clear action colors. */
.calculator-action,
.step-actions .btn,
.saved-calc-load .btn,
.save-modal-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 190px;
    min-width: 190px;
    min-height: 48px;
    margin: 0;
    padding: 12px 24px;
    /* border: 1px solid transparent; */
    border-radius: 999px;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: .01em;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease, background-color .2s ease, color .2s ease;
}

.results-actions .btn {
    margin: 0;
}

.calculator-action,
.calculator-action-start,
.step-next,
#calculate-btn {
    /* width: 190px; */
    background: #1c3148;
    border-color: #1c3148;
    color: #fff;
    box-shadow: 0 6px 14px rgba(28, 49, 72, .25);
}

.calculator-action-load,
.saved-calc-load .btn {
    background: #1c3148;
    border-color: #1c3148;
    color: #fff;
    box-shadow: 0 6px 14px rgba(28, 49, 72, .25);
}

.btn-save {
    background: #1c3148;
    border-color: #1c3148;
    color: #fff;
    box-shadow: 0 6px 14px rgba(28, 49, 72, .25);
}

.btn-restart {
    background: #fff;
    border-color: #d1847d;
    color: #a83d38;
    box-shadow: 0 4px 10px rgba(168, 61, 56, .1);
}

.btn-back {
    background: #fff;
    border-color: #c9d8cf;
    color: var(--dark-green);
}

.calculator-action:hover,
.step-actions .btn:hover,
.saved-calc-load .btn:hover,
.save-modal-actions .btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.btn-restart:hover {
    background: #fdf1f0;
    border-color: #c0392b;
    filter: none;
}

.btn-back:hover {
    /* background: #f0f7f3; */
    border-color: var(--teal-green);
    filter: none;
}

.calculator-action:focus-visible,
.step-actions .btn:focus-visible,
.saved-calc-load .btn:focus-visible,
.save-modal-actions .btn:focus-visible {
    outline: 2px solid #1c3148;
    outline-offset: 3px;
}

@media (max-width: 767px) {
    .calculator-action,
    .step-actions .btn,
    .saved-calc-load .btn,
    .save-modal-actions .btn {
        width: 100%;
        min-width: 0;
    }
}

/* Better focus states for accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--teal-green);
    outline-offset: 2px;
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Prevent horizontal overflow on mobile */
.loan-calculator-wrapper,
.calculator-wrapper,
.container {
    max-width: 100%;
    overflow-x: hidden;
}

/* Mobile-friendly animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.chart-container {
    width: 400px;
    height: 250px;
}

.d-none {
    display: none;
}

#rcl-container, #ilac-container, #ilac2-container {
    max-width: 1200px;
}

@media (min-width: 768px) {
    .save-modal-actions .btn {
        width: auto;
        min-width: 0;
        flex: 1 1 0;
    }
}

button[hidden],
.save-calc-button[hidden] {
    display: none !important;
}
