* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #fafafa;
    --text-primary: #333;
    --text-secondary: #555;
    --text-heading: #000000;
    --text-subheading: #1a1a1a;
    --border-color: #ddd;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-light: rgba(0, 0, 0, 0.05);
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --table-header-bg: #34495e;
    --table-header-text: #ffffff;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #363636;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-heading: #f0f0f0;
    --text-subheading: #d0d0d0;
    --border-color: #444;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-light: rgba(0, 0, 0, 0.2);
    --primary-color: #5dade2;
    --primary-hover: #3498db;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --table-header-bg: #404040;
    --table-header-text: #f0f0f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

h1 {
    text-align: center;
    color: var(--text-heading);
    font-size: 2.5em;
    margin: 0;
}

h2 {
    color: var(--text-subheading);
    margin-bottom: 20px;
    font-size: 1.8em;
}

h3 {
    color: var(--text-subheading);
    margin-bottom: 15px;
    font-size: 1.4em;
}

/* Theme Toggle */
.theme-toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-icon {
    font-size: 20px;
    transition: opacity 0.3s;
}

.theme-icon.sun {
    opacity: 1;
}

.theme-icon.moon {
    opacity: 0.3;
}

[data-theme="dark"] .theme-icon.sun {
    opacity: 0.3;
}

[data-theme="dark"] .theme-icon.moon {
    opacity: 1;
}

.theme-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    display: inline-block;
}

.theme-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--primary-color);
    transition: 0.4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--table-header-bg);
}

input:checked + .slider:before {
    transform: translateX(30px);
}

.theme-toggle:hover .slider {
    box-shadow: 0 0 10px var(--shadow);
}

/* Removed duplicate theme-slider styles - using .slider class instead */

/* Theme toggle in navigation and headers */
.nav-container .theme-toggle-container {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-with-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header-with-toggle h1 {
    margin: 0;
}

/* Ensure blog header toggle looks good */
.blog-header .theme-toggle-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

/* Legal pages header styling */
.legal-content .header-with-toggle {
    max-width: 100%;
    margin-bottom: 20px;
}

.legal-content .header-with-toggle h1 {
    flex: 1;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .header-with-toggle {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .header-with-toggle h1 {
        width: 100%;
    }

    .nav-container .theme-toggle-container {
        margin: 10px auto;
    }

    .theme-icon {
        font-size: 16px;
    }

    .theme-icon.sun,
    .theme-icon.moon {
        display: inline;
    }
}

/* Loan Input Form */
.loan-inputs {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow);
    margin-bottom: 30px;
    transition: background-color 0.3s, box-shadow 0.3s;
}

#loan-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.form-group input {
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: border-color 0.3s, background-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.add-loan-btn {
    grid-column: 1 / -1;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 18px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color 0.3s;
}

.add-loan-btn:hover {
    background-color: var(--primary-hover);
}

.plus-icon {
    font-size: 24px;
    font-weight: bold;
}

/* Loans List */
.loans-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.loan-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow);
    border-left: 5px solid;
    transition: background-color 0.3s, box-shadow 0.3s;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s, color 0.3s;
}

.close-btn:hover {
    background-color: var(--danger-color);
    color: white;
}

.loan-details p {
    margin-bottom: 8px;
}

/* Comparison Table Section */
.comparison-table-section {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow);
    margin-bottom: 30px;
    transition: background-color 0.3s, box-shadow 0.3s;
}

/* Navigation Styles */
.main-nav {
    background: var(--bg-secondary);
    box-shadow: 0 2px 4px var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.nav-logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-menu a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

/* Footer Styles */
footer {
    margin-top: 60px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 40px 20px 20px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.footer-section h3 {
    color: var(--text-heading);
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 10px;
}

.footer-section a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    max-width: 1200px;
    margin: 30px auto 0;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Legal Content Pages */
.legal-content {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}

.legal-content h1 {
    color: var(--text-heading);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.legal-content h2 {
    color: var(--text-heading);
    font-size: 1.8rem;
    margin: 30px 0 15px;
    padding-top: 20px;
}

.legal-content h3 {
    color: var(--text-subheading);
    font-size: 1.3rem;
    margin: 20px 0 10px;
}

.legal-content p {
    margin-bottom: 15px;
    line-height: 1.8;
}

.legal-content ul,
.legal-content ol {
    margin: 15px 0 15px 30px;
}

.legal-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.last-updated {
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 30px;
}

.contact-info {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.important-notice {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin: 30px 0;
}

[data-theme="dark"] .important-notice {
    background: #3d3619;
    border-color: #ffc107;
}

.final-warning {
    background: #f8d7da;
    border: 2px solid #dc3545;
    border-radius: 8px;
    padding: 20px;
    margin: 30px 0;
}

[data-theme="dark"] .final-warning {
    background: #3d1519;
    border-color: #dc3545;
}

/* About Page Styles */
.about-content {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

.about-hero {
    text-align: center;
    margin-bottom: 50px;
}

.about-hero h1 {
    font-size: 3rem;
    color: var(--text-heading);
    margin-bottom: 20px;
}

.lead {
    font-size: 1.3rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

.mission-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.value-card {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 10px var(--shadow-light);
}

.value-card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.team-member {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow-light);
}

.team-member h3 {
    color: var(--text-heading);
    margin-bottom: 5px;
}

.role {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 15px;
}

.trust-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.trust-item {
    padding: 20px;
}

.impact-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 30px;
    margin: 40px 0;
    text-align: center;
}

.stat h3 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Contact Page Styles */
.contact-content {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin: 40px 0;
}

.contact-form {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow-light);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group textarea {
    resize: vertical;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-note {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 10px;
}

.contact-method {
    margin-bottom: 30px;
}

.contact-method h3 {
    color: var(--text-heading);
    margin-bottom: 10px;
}

.response-time {
    color: var(--primary-color);
    font-size: 0.9rem;
    margin-top: 5px;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-link {
    padding: 8px 15px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.social-link:hover {
    background: var(--primary-hover);
}

.feedback-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.feedback-type {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow-light);
}

/* Blog Styles */
.blog-content {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.blog-header {
    text-align: center;
    margin-bottom: 50px;
}

.blog-header h1 {
    font-size: 3rem;
    color: var(--text-heading);
    margin-bottom: 15px;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.article-card {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow-light);
    transition: transform 0.3s, box-shadow 0.3s;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px var(--shadow);
}

.article-card.featured {
    grid-column: span 1;
}

.article-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.category {
    color: var(--primary-color);
    font-weight: 600;
}

.date {
    color: var(--text-secondary);
}

.article-card h3 {
    margin-bottom: 15px;
}

.article-card h3 a {
    color: var(--text-heading);
    text-decoration: none;
    transition: color 0.3s;
}

.article-card h3 a:hover {
    color: var(--primary-color);
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.read-time {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.read-more {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.3s;
    display: inline-block;
}

.read-more:hover {
    transform: translateX(5px);
}

.article-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.category-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 5px var(--shadow-light);
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--shadow);
}

.category-card h3 {
    color: var(--text-heading);
    margin-bottom: 10px;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.article-count {
    color: var(--primary-color);
    font-weight: 600;
}

.category-card.active {
    border: 2px solid var(--primary-color);
    transform: translateY(-3px);
}

.category-card[style*="cursor: not-allowed"]:hover {
    transform: none;
    box-shadow: 0 2px 5px var(--shadow-light);
}

.show-all-button {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.show-all-button:hover {
    background-color: var(--primary-hover);
}

/* Newsletter styles removed - no longer in use */

/* Article Page Styles */
.article-content {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}

.breadcrumbs {
    margin-bottom: 30px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--primary-color);
}

.article-header {
    margin-bottom: 40px;
}

.article-header h1 {
    font-size: 2.5rem;
    color: var(--text-heading);
    margin: 20px 0;
}

.table-of-contents {
    background: var(--bg-tertiary);
    padding: 25px;
    border-radius: 8px;
    margin: 30px 0;
}

.table-of-contents h2 {
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.table-of-contents ul {
    list-style: none;
}

.table-of-contents li {
    margin-bottom: 10px;
}

.table-of-contents a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s;
}

.table-of-contents a:hover {
    color: var(--primary-color);
}

.article-body {
    line-height: 1.8;
}

.article-body h2 {
    font-size: 2rem;
    color: var(--text-heading);
    margin: 40px 0 20px;
    padding-top: 20px;
}

.article-body h3 {
    font-size: 1.5rem;
    color: var(--text-subheading);
    margin: 30px 0 15px;
}

.article-body p {
    margin-bottom: 20px;
}

.article-body ul,
.article-body ol {
    margin: 20px 0 20px 30px;
}

.article-body li {
    margin-bottom: 10px;
}

.key-point,
.example-box,
.warning-box,
.strategy-impact,
.case-study {
    padding: 20px;
    border-radius: 8px;
    margin: 30px 0;
}

.key-point {
    background: #d1ecf1;
    border-left: 4px solid #0c5460;
}

[data-theme="dark"] .key-point {
    background: #1a3a42;
    border-left-color: #5dade2;
}

.example-box {
    background: #d4edda;
    border-left: 4px solid #155724;
}

[data-theme="dark"] .example-box {
    background: #1a3a1f;
    border-left-color: #27ae60;
}

.warning-box {
    background: #f8d7da;
    border-left: 4px solid #721c24;
}

[data-theme="dark"] .warning-box {
    background: #3d1519;
    border-left-color: #e74c3c;
}

.strategy-impact {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.case-study {
    background: var(--bg-tertiary);
    border: 2px solid var(--primary-color);
}

.data-table,
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 2px 5px var(--shadow-light);
}

.data-table th,
.comparison-table th {
    background: var(--table-header-bg);
    color: var(--table-header-text);
    padding: 12px;
    text-align: left;
}

.data-table td,
.comparison-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:nth-child(even),
.comparison-table tr:nth-child(even) {
    background: var(--bg-tertiary);
}

.formula {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
    margin: 20px 0;
}

.cta-box {
    background: var(--primary-color);
    color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    margin: 40px 0;
}

.cta-box h3 {
    color: white;
    margin-bottom: 15px;
}

.cta-box p {
    margin-bottom: 20px;
}

.cta-box .btn {
    background: white;
    color: var(--primary-color);
}

.cta-box .btn:hover {
    background: #f0f0f0;
}

.author-bio {
    background: var(--bg-tertiary);
    padding: 25px;
    border-radius: 8px;
    margin: 40px 0;
    border-left: 4px solid var(--primary-color);
}

.related-articles {
    margin: 40px 0;
}

.related-articles h3 {
    margin-bottom: 20px;
}

.related-articles ul {
    list-style: none;
}

.related-articles li {
    margin-bottom: 15px;
}

.related-articles a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.related-articles a:hover {
    text-decoration: underline;
}

.faq-item {
    margin-bottom: 25px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.faq-item h3 {
    color: var(--text-heading);
    margin-bottom: 10px;
}

.conclusion {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        gap: 15px;
        font-size: 0.9rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .article-grid {
        grid-template-columns: 1fr;
    }

    .article-header h1 {
        font-size: 2rem;
    }

    .blog-header h1,
    .about-hero h1 {
        font-size: 2rem;
    }
}

/* Comparison Section */
.comparison-section {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow);
    transition: background-color 0.3s, box-shadow 0.3s;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-button {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s, border-color 0.3s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Amortization Table */
.amortization-table-wrapper {
    margin-top: 20px;
}

.amortization-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.amortization-table-wrapper label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 10px;
}

.download-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.3s;
}

.download-btn:hover {
    background-color: var(--primary-hover);
}

#loan-selector {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 20px;
    cursor: pointer;
}

#amortization-table {
    max-height: 500px;
    overflow-y: auto;
    display: block;
}

#amortization-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.chart-wrapper {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 1px 5px var(--shadow-light);
    transition: background-color 0.3s, box-shadow 0.3s;
    position: relative;
    width: 100%;
    min-height: 300px;
}

.chart-wrapper canvas {
    max-width: 100%;
    height: auto !important;
}

/* Comparison Table */
.comparison-table {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
}

thead {
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.remove-btn {
    background-color: var(--danger-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.remove-btn:hover {
    background-color: var(--danger-hover);
}

/* Extra Payment Toggle */
.extra-payment-toggle {
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 5px;
}

/* Responsive Design - Tablet */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 15px;
    }
    
    .loans-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
    /* Header adjustments */
    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        margin-bottom: 20px;
    }
    
    h1 {
        font-size: 1.8em;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.4em;
    }
    
    h3 {
        font-size: 1.2em;
    }
    
    .container {
        padding: 10px;
    }
    
    /* Form adjustments */
    .loan-inputs {
        padding: 15px;
        border-radius: 8px;
    }
    
    .comparison-section, .comparison-table-section {
        padding: 15px;
        border-radius: 8px;
    }
    
    #loan-form {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Button improvements for touch */
    .add-loan-btn {
        padding: 14px 24px;
        font-size: 16px;
        min-height: 48px;
    }
    
    .tab-button {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .download-btn {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .remove-btn {
        padding: 8px 14px;
        min-height: 36px;
    }
    
    .clear-all-btn {
        padding: 10px 14px !important;
        font-size: 13px !important;
    }
    
    /* Cards and lists */
    .loans-list {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .loan-card {
        padding: 15px;
    }
    
    /* Charts */
    .charts-container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0;
    }
    
    .chart-wrapper {
        padding: 15px 10px;
        min-height: 280px;
        max-width: 100%;
        overflow: hidden;
    }
    
    .chart-wrapper canvas {
        max-height: 400px;
    }
    
    /* Table responsive wrapper - ensure container allows overflow */
    .comparison-table-section {
        overflow: visible;
        padding-bottom: 20px;
    }
    
    #comparison-table table {
        min-width: 700px;
        font-size: 13px;
    }
    
    th, td {
        padding: 8px 6px;
        font-size: 13px;
    }
    
    /* Amortization controls */
    .amortization-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .amortization-controls > div {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    #loan-selector {
        width: 100%;
        padding: 10px;
        font-size: 16px;
    }
    
    #amortization-table {
        font-size: 13px;
        max-height: 400px;
    }
    
    /* Summary table responsive */
    .comparison-table-section > div:first-child {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .comparison-table-section h2 {
        margin-bottom: 0;
    }
    
    /* Tabs container */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-bottom: none;
        padding-bottom: 2px;
        margin-bottom: 15px;
    }
    
    /* Form inputs touch-friendly */
    .form-group input {
        padding: 12px;
        font-size: 16px;
        min-height: 44px;
    }
    
    /* Close button positioning */
    .close-btn {
        top: 5px;
        right: 5px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

/* Medium mobile devices */
@media (max-width: 480px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .chart-wrapper {
        padding: 12px 8px;
        min-height: 300px;
    }
    
    .chart-wrapper canvas {
        max-height: 380px;
    }
}

/* Small mobile devices */
@media (max-width: 414px) {
    h1 {
        font-size: 1.5em;
    }
    
    h2 {
        font-size: 1.2em;
    }
    
    .container {
        padding: 8px;
    }
    
    .loan-inputs,
    .comparison-section,
    .comparison-table-section {
        padding: 12px;
    }
    
    .chart-wrapper {
        padding: 10px 5px;
        min-height: 320px;
    }
    
    .chart-wrapper canvas {
        max-height: 360px;
    }
    
    .charts-container {
        gap: 15px;
    }
    
    /* Even smaller table font */
    th, td {
        padding: 6px 4px;
        font-size: 12px;
    }
    
    /* Stack theme toggle vertically if needed */
    .theme-toggle-container {
        transform: scale(0.9);
    }
}

.clear-all-btn:hover {
    background-color: #c82333 !important;
    transform: scale(1.05);
    transition: all 0.2s ease;
}

/* Ensure tables are scrollable on mobile */
@media (max-width: 768px) {
    .comparison-table-section {
        position: relative;
    }
    
    /* Table wrapper with visible scrollbar and gradient */
    #comparison-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -10px;
        padding: 0 10px;
        position: relative;
    }
    
    /* Always show scrollbar on mobile for clarity */
    #comparison-table::-webkit-scrollbar {
        height: 8px;
        display: block;
    }
    
    #comparison-table::-webkit-scrollbar-track {
        background: var(--bg-tertiary);
        border-radius: 4px;
    }
    
    #comparison-table::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 4px;
    }
    
    /* Gradient fade on right edge to indicate more content */
    .comparison-table-section::before {
        content: '';
        position: absolute;
        right: 0;
        top: 60px;
        bottom: 20px;
        width: 30px;
        background: linear-gradient(to right, transparent, var(--bg-secondary));
        pointer-events: none;
        z-index: 1;
        transition: opacity 0.3s;
    }
    
    /* Animated arrow indicator */
    .comparison-table-section::after {
        content: '👉 Swipe to see more';
        position: absolute;
        right: 10px;
        top: 65px;
        padding: 6px 12px;
        background: var(--primary-color);
        color: white;
        border-radius: 20px;
        font-size: 13px;
        font-weight: 600;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        animation: pulse-slide 3s ease-in-out infinite;
        z-index: 2;
    }
    
    @keyframes pulse-slide {
        0%, 100% { 
            transform: translateX(0);
            opacity: 0.9;
        }
        50% { 
            transform: translateX(-10px);
            opacity: 1;
        }
    }
    
    /* Hide indicators when table is scrolled */
    .comparison-table-section.scrolled::after,
    .comparison-table-section.scrolled::before {
        opacity: 0;
        pointer-events: none;
    }
    
    /* Add visible border to indicate scrollable area */
    #comparison-table table {
        border: 2px solid var(--border-color);
        border-radius: 8px;
        overflow: hidden;
    }
}

/* Improve select dropdown on mobile */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 40px;
}

/* Term unit selector styling */
#term-unit {
    cursor: pointer;
    transition: all 0.3s;
}

#term-unit:hover {
    border-color: var(--primary-color);
}

#term-unit:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Enhanced content sections styling */
.loan-guides-section,
.how-to-guides,
.financial-literacy,
.comparison-tips,
.faq-section,
.glossary-section {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* FAQ Details styling */
details {
    transition: all 0.3s ease;
}

details:hover {
    box-shadow: 0 2px 8px var(--shadow);
    transform: translateY(-2px);
}

details summary {
    cursor: pointer;
    user-select: none;
    padding-right: 30px;
    position: relative;
}

details summary::after {
    content: '+';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
    transition: transform 0.3s;
}

details[open] summary::after {
    transform: translateY(-50%) rotate(45deg);
}

details summary:hover {
    color: var(--primary-color);
}

/* Loan type guide cards */
.loan-type-guide {
    transition: all 0.3s ease;
}

.loan-type-guide:hover {
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(-3px);
}

/* Glossary grid items */
.glossary-section > div > div {
    transition: all 0.3s ease;
}

.glossary-section > div > div:hover {
    box-shadow: 0 2px 8px var(--shadow);
    transform: translateY(-2px);
    border-left: 3px solid var(--primary-color);
    padding-left: 14px;
}

/* Improve readability of long content */
.loan-guides-section p,
.how-to-guides p,
.financial-literacy p,
.comparison-tips p,
.faq-section p {
    max-width: 800px;
}

/* Numbered lists styling */
ol {
    counter-reset: item;
    padding-left: 0;
}

ol li {
    counter-increment: item;
    position: relative;
    padding-left: 35px;
}

ol li::before {
    content: counter(item);
    position: absolute;
    left: 0;
    top: 0;
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

/* Mobile adjustments for new content */
@media (max-width: 768px) {
    .loan-guides-section,
    .how-to-guides,
    .financial-literacy,
    .comparison-tips,
    .faq-section,
    .glossary-section {
        padding: 15px;
    }

    details {
        padding: 12px;
    }

    details summary {
        font-size: 0.95em;
    }

    ol li {
        padding-left: 30px;
    }

    ol li::before {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
}