/* calculators/shared/calculator.css - COMPLETE WITH DARK MODE */

/* ================= DARK MODE VARIABLES ================= */
:root {
    /* Light Mode (Default) */
    --brand-red: #e5322d;
    --brand-red-hover: #c9211d;
    --brand-dark: #33333b;
    --text-gray: #6d6d76;
    --bg-body: #f4f7f6;
    --bg-card: #ffffff;
    --border-light: #e6e6e6;
    --success-green: #2e7d32;
    --info-blue: #1976d2;
    --warning-orange: #ed6c02;
    
    /* Dark Mode Specific (will override when .dark-mode is applied) */
    --bg-body-dark: #121212;
    --bg-card-dark: #1e1e1e;
    --text-primary-dark: #ffffff;
    --text-secondary-dark: #b0b0b0;
    --border-dark: #333333;
    --input-bg-dark: #2d2d2d;
}

/* ================= BASE STYLES ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--brand-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ================= DARK MODE STYLES ================= */
body.dark-mode {
    --brand-dark: #ffffff;
    --text-gray: #b0b0b0;
    --bg-body: var(--bg-body-dark);
    --bg-card: var(--bg-card-dark);
    --border-light: var(--border-dark);
}

body.dark-mode {
    background-color: var(--bg-body-dark);
    color: var(--text-primary-dark);
}

/* Dark mode transitions */
body.dark-mode,
body.dark-mode *,
body.dark-mode header,
body.dark-mode .tool-card,
body.dark-mode .calculator-card,
body.dark-mode .input-group {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* ================= HEADER ================= */
header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.dark-mode header {
    background: var(--bg-card-dark);
    border-bottom: 1px solid var(--border-dark);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: var(--brand-dark);
    transition: color 0.3s ease;
}

.logo i {
    color: var(--brand-red);
    margin-right: 0.5rem;
}

.logo span {
    color: var(--brand-red);
}

body.dark-mode .logo {
    color: var(--text-primary-dark);
}

nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

nav a {
    text-decoration: none;
    color: var(--brand-dark);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s;
}

nav a:hover,
nav a.active {
    background: var(--brand-red);
    color: white;
}

body.dark-mode nav a {
    color: var(--text-secondary-dark);
}

body.dark-mode nav a:hover,
body.dark-mode nav a.active {
    background: var(--brand-red);
    color: white;
}

/* ================= DARK MODE TOGGLE BUTTON ================= */
.dark-mode-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s;
    color: var(--brand-dark);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode .dark-mode-toggle {
    color: var(--text-primary-dark);
}

.dark-mode-toggle:hover {
    background: rgba(229, 50, 45, 0.1);
    transform: rotate(15deg);
}

/* ================= CONTAINER ================= */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ================= HERO SECTION ================= */
.hero {
    text-align: center;
    padding: 3rem;
    background: linear-gradient(135deg, rgba(229, 50, 45, 0.08) 0%, rgba(229, 50, 45, 0.03) 100%);
    border-radius: 16px;
    margin-bottom: 2rem;
}

body.dark-mode .hero {
    background: linear-gradient(135deg, rgba(229, 50, 45, 0.15) 0%, rgba(229, 50, 45, 0.05) 100%);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--brand-dark);
}

body.dark-mode .hero h1 {
    color: var(--text-primary-dark);
}

.hero p {
    font-size: 1.1rem;
    color: white;
    max-width: 800px;
    margin: 0 auto;
}

body.dark-mode .hero p {
    color: var(--text-secondary-dark);
}

/* ================= SECTION HEADERS ================= */
.section-header {
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--brand-red);
    display: inline-block;
}

.section-label {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--brand-dark);
}

body.dark-mode .section-label {
    color: var(--text-primary-dark);
}

/* ================= TOOLS GRID ================= */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
    animation: fadeIn 0.5s ease;
}

.tool-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    min-height: 200px;
}

body.dark-mode .tool-card {
    background: #2f2e2e;
    border-color: #535353;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-color: var(--brand-red);
}

body.dark-mode .tool-card:hover {
    background: #2d2d2d;
    border-color: var(--brand-red);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.tool-icon {
    font-size: 2rem;
    color: var(--brand-red);
    margin-bottom: 1rem;
}

.tool-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--brand-dark);
}

body.dark-mode .tool-card h3 {
    color: var(--text-primary-dark);
}

.tool-desc {
    font-size: 0.85rem;
    color: var(--text-gray);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

body.dark-mode .tool-desc {
    color: var(--text-secondary-dark);
}

/* ================= WORKSPACE VIEW ================= */
.workspace-view {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.back-btn {
    background: white;
    border: 1px solid var(--border-light);
    color: var(--text-gray);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
    text-decoration: none;
}

body.dark-mode .back-btn {
    background: var(--bg-card-dark);
    border-color: var(--border-dark);
    color: var(--text-secondary-dark);
}

.back-btn:hover {
    background: #f5f5f5;
    color: var(--brand-dark);
}

body.dark-mode .back-btn:hover {
    background: #2d2d2d;
    color: var(--text-primary-dark);
}

.workspace-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid var(--border-light);
}

body.dark-mode .workspace-card {
    background: var(--bg-card-dark);
    border-color: var(--border-dark);
}

/* ================= CALCULATOR CARD ================= */
.calculator-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid var(--border-light);
}

body.dark-mode .calculator-card {
    background: var(--bg-card-dark);
    border-color: var(--border-dark);
}

.calculator-card h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--brand-dark);
}

body.dark-mode .calculator-card h1 {
    color: var(--text-primary-dark);
}

/* ================= FORM ELEMENTS ================= */
.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.dark-mode .input-group label {
    color: var(--text-secondary-dark);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-card);
    color: var(--brand-dark);
    transition: all 0.3s;
}

body.dark-mode .input-group input,
body.dark-mode .input-group select {
    background: var(--input-bg-dark);
    border-color: var(--border-dark);
    color: var(--text-primary-dark);
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(229, 50, 45, 0.1);
}

/* ================= BUTTONS ================= */
.btn-calc {
    width: 100%;
    padding: 0.875rem;
    background: var(--brand-red);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.5rem;
}

.btn-calc:hover {
    background: var(--brand-red-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--brand-red);
    color: var(--brand-red);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--brand-red);
    color: white;
}

body.dark-mode .btn-secondary {
    border-color: var(--brand-red);
    color: var(--brand-red);
}

/* ================= RESULT BOX ================= */
.result-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #e8f5e9;
    border-radius: 12px;
    text-align: center;
}

body.dark-mode .result-box {
    background: #1a2a1a;
}

.result-box h3 {
    color: var(--success-green);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
}

body.dark-mode .result-box h3 {
    color: #4caf50;
}

#result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1b5e20;
    line-height: 1.3;
}

body.dark-mode #result-value {
    color: #4caf50;
}

.hidden {
    display: none;
}

/* ================= MORTGAGE SPECIFIC ================= */
.mortgage-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 900px) {
    .mortgage-layout {
        grid-template-columns: 1fr;
    }
}

.mortgage-form {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-light);
}

body.dark-mode .mortgage-form {
    background: var(--bg-card-dark);
    border-color: var(--border-dark);
}

.mortgage-results {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-light);
}

body.dark-mode .mortgage-results {
    background: var(--bg-card-dark);
    border-color: var(--border-dark);
}

.monthly-pay-card {
    background: linear-gradient(135deg, var(--brand-red) 0%, #c9211d 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 1.5rem;
}

.monthly-pay-card h3 {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.monthly-pay-card .amount {
    font-size: 2.5rem;
    font-weight: 700;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-card {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
}

body.dark-mode .result-card {
    background: #2d2d2d;
}

.result-card .label {
    font-size: 0.7rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.dark-mode .result-card .label {
    color: var(--text-secondary-dark);
}

.result-card .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-dark);
}

body.dark-mode .result-card .value {
    color: var(--text-primary-dark);
}

.breakdown-table {
    width: 100%;
    margin-bottom: 1rem;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}

body.dark-mode .breakdown-row {
    border-bottom-color: var(--border-dark);
    color: var(--text-secondary-dark);
}

.breakdown-row.total {
    font-weight: 700;
    color: var(--brand-red);
    border-bottom: none;
    padding-top: 0.5rem;
}

body.dark-mode .breakdown-row.total {
    color: var(--brand-red);
}

/* ================= AMORTIZATION SECTION ================= */
.amortization-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    border: 1px solid var(--border-light);
}

body.dark-mode .amortization-section {
    background: var(--bg-card-dark);
    border-color: var(--border-dark);
}

.amortization-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.5rem 1rem;
    background: #f0f0f0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

body.dark-mode .view-btn {
    background: #2d2d2d;
    color: var(--text-secondary-dark);
}

.view-btn.active {
    background: var(--brand-red);
    color: white;
}

body.dark-mode .view-btn.active {
    background: var(--brand-red);
    color: white;
}

.amortization-table-container {
    overflow-x: auto;
}

.amortization-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.amortization-table th,
.amortization-table td {
    padding: 0.75rem;
    text-align: right;
    border-bottom: 1px solid var(--border-light);
}

body.dark-mode .amortization-table th,
body.dark-mode .amortization-table td {
    border-bottom-color: var(--border-dark);
}

.amortization-table th:first-child,
.amortization-table td:first-child {
    text-align: left;
}

.amortization-table th {
    background: var(--brand-dark);
    color: white;
    font-weight: 600;
}

body.dark-mode .amortization-table th {
    background: #2d2d2d;
    color: var(--text-primary-dark);
}

.amortization-table td {
    color: var(--brand-dark);
}

body.dark-mode .amortization-table td {
    color: var(--text-secondary-dark);
}

.amortization-table tr:hover {
    background: #f8f9fa;
}

body.dark-mode .amortization-table tr:hover {
    background: #2d2d2d;
}

/* ================= RATE BANNER ================= */
.rate-banner {
    background: #f0f7ff;
    border-left: 4px solid var(--brand-red);
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

body.dark-mode .rate-banner {
    background: #1a2a3a;
}

.rate-banner .rates {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.rate-banner .rate-item {
    font-size: 0.85rem;
    color: var(--brand-dark);
}

body.dark-mode .rate-banner .rate-item {
    color: var(--text-secondary-dark);
}

.rate-banner .rate-value {
    font-weight: 700;
    color: var(--brand-dark);
}

body.dark-mode .rate-banner .rate-value {
    color: var(--text-primary-dark);
}

/* ================= TIPS BOX ================= */
.tips-box {
    background: #fff;
    border-left: 4px solid var(--brand-red);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 8px;
    color:white;
}

body.dark-mode .tips-box {
    background: #1a1a0a;
}

.tips-box h3 {
    margin-bottom: 1rem;
    color: var(--brand-dark);
}

body.dark-mode .tips-box h3 {
    color: var(--text-primary-dark);
}

.tips-box ul {
    margin-left: 1.5rem;
}

.tips-box li {
    color: var(--text-gray);
    margin-bottom: 0.5rem;
}

body.dark-mode .tips-box li {
    color: var(--text-secondary-dark);
}

/* ================= PRO TIP ================= */
.pro-tip {
    background: #e8f0fe;
    padding: 1.5rem;
    border-radius: 10px;
    margin: 1.5rem 0;
}

body.dark-mode .pro-tip {
    background: #1a2a3a;
}

.pro-tip h3 {
    color: var(--info-blue);
    margin-bottom: 0.5rem;
}

body.dark-mode .pro-tip h3 {
    color: #64b5f6;
}

/* ================= WARNING BOX ================= */
.warning-box {
    background: #fff3e0;
    border-left: 4px solid var(--warning-orange);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 8px;
}

body.dark-mode .warning-box {
    background: #2a1a0a;
}

.warning-box h3 {
    color: var(--warning-orange);
    margin-bottom: 0.5rem;
}

.warning-box ul {
    margin-left: 1.5rem;
}

/* ================= CALCULATOR NOTE ================= */
.calculator-note {
    background: #f8f9fa;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-size: 0.85rem;
    border-left: 3px solid var(--brand-red);
}

body.dark-mode .calculator-note {
    background: #2d2d2d;
}

.calculator-note i {
    color: var(--brand-red);
    margin-right: 0.5rem;
}

/* ================= FOOTER ================= */
footer {
    background: var(--brand-dark);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

body.dark-mode footer {
    background: var(--bg-card-dark);
    border-top: 1px solid var(--border-dark);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.footer-links a {
    color: #bbb;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: white;
    text-decoration: underline;
}

body.dark-mode .footer-links a {
    color: var(--text-secondary-dark);
}

body.dark-mode .footer-links a:hover {
    color: var(--text-primary-dark);
}

/* ================= SEO CONTENT ================= */
.seo-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    margin-top: 2rem;
    border: 1px solid var(--border-light);
}

body.dark-mode .seo-content {
    background: var(--bg-card-dark);
    border-color: var(--border-dark);
}

.seo-content h2 {
    color: var(--brand-dark);
    margin: 1.5rem 0 1rem;
}

body.dark-mode .seo-content h2 {
    color: var(--text-primary-dark);
}

.seo-content h3 {
    color: var(--brand-dark);
    margin: 1rem 0 0.5rem;
}

body.dark-mode .seo-content h3 {
    color: var(--text-primary-dark);
}

.seo-content p {
    margin-bottom: 1rem;
    color: var(--text-gray);
    line-height: 1.6;
}

body.dark-mode .seo-content p {
    color: var(--text-secondary-dark);
}

.seo-content ul {
    margin: 1rem 0 1rem 2rem;
}

.seo-content li {
    color: var(--text-gray);
    margin-bottom: 0.25rem;
}

body.dark-mode .seo-content li {
    color: var(--text-secondary-dark);
}

/* ================= FAQ SECTION ================= */
.faq-section {
    margin: 2rem 0;
}

.faq-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

body.dark-mode .faq-item {
    border-bottom-color: var(--border-dark);
}

.faq-item h3,
.faq-item h4 {
    color: var(--brand-dark);
    margin-bottom: 0.5rem;
}

body.dark-mode .faq-item h3,
body.dark-mode .faq-item h4 {
    color: var(--text-primary-dark);
}

.faq-item p {
    color: var(--text-gray);
    line-height: 1.5;
}

body.dark-mode .faq-item p {
    color: var(--text-secondary-dark);
}

/* ================= RELATED TOOLS ================= */
.related-tools {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

body.dark-mode .related-tools {
    border-top-color: var(--border-dark);
}

.related-tools h3 {
    margin-bottom: 1rem;
    color: var(--brand-dark);
}

body.dark-mode .related-tools h3 {
    color: var(--text-primary-dark);
}

.tool-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    text-decoration: none;
    color: var(--brand-dark);
    border-radius: 8px;
    transition: all 0.3s;
}

body.dark-mode .tool-link {
    background: #2d2d2d;
    color: var(--text-secondary-dark);
}

.tool-link:hover {
    background: var(--brand-red);
    color: white;
    transform: translateY(-2px);
}

body.dark-mode .tool-link:hover {
    background: var(--brand-red);
    color: white;
}

/* ================= BREADCRUMBS ================= */
.breadcrumbs {
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.breadcrumbs ol {
    display: flex;
    list-style: none;
    padding: 0;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0;
}

.breadcrumbs li {
    color: var(--text-gray);
}

body.dark-mode .breadcrumbs li {
    color: var(--text-secondary-dark);
}

.breadcrumbs a {
    color: var(--brand-red);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* ================= TOGGLE SWITCH ================= */
.toggle-group {
    margin: 0.75rem 0;
}

.toggle-switch {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.toggle-switch span {
    font-size: 0.85rem;
    color: var(--text-gray);
}

body.dark-mode .toggle-switch span {
    color: var(--text-secondary-dark);
}

.toggle-switch input {
    width: 40px;
    height: 20px;
    appearance: none;
    background: #ccc;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-switch input:checked {
    background: var(--brand-red);
}

.toggle-switch input::before {
    content: '';
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: 0.3s;
}

.toggle-switch input:checked::before {
    left: 22px;
}

/* ================= EXTRA PAYMENTS ================= */
.extra-payments {
    display: none;
    margin-top: 1rem;
}

.extra-payments.show {
    display: block;
}

/* ================= ANIMATIONS ================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tools-grid {
    animation: fadeIn 0.5s ease;
}

/* ================= RESPONSIVE DESIGN ================= */
@media (max-width: 900px) {
    .mortgage-layout {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .amortization-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .hero {
        padding: 1.5rem;
    }
    
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .hero p {
        font-size: 0.9rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .tool-card {
        padding: 1rem;
        min-height: auto;
    }
    
    .tool-icon {
        font-size: 1.5rem;
    }
    
    .tool-card h3 {
        font-size: 1rem;
    }
    
    .tool-desc {
        font-size: 0.8rem;
    }
    
    .workspace-card {
        padding: 1rem;
    }
    
    .calculator-card {
        padding: 1rem;
    }
    
    .monthly-pay-card .amount {
        font-size: 1.5rem;
    }
    
    .breakdown-row {
        font-size: 0.75rem;
    }
    
    .result-card .value {
        font-size: 0.9rem;
    }
    
    .amortization-table {
        font-size: 0.7rem;
    }
    
    .amortization-table th,
    .amortization-table td {
        padding: 0.5rem;
    }
    
    .rate-banner {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .rate-banner .rates {
        gap: 0.75rem;
    }
    
    .seo-content {
        padding: 1rem;
    }
    
    .seo-content h2 {
        font-size: 1.25rem;
    }
    
    header {
        padding: 0.75rem 1rem;
    }
    
    nav {
        gap: 0.5rem;
    }
    
    nav a {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }
}

/* ================= PRINT STYLES ================= */
@media print {
    header,
    footer,
    .dark-mode-toggle,
    .rate-banner,
    .btn-calc,
    .back-btn,
    .view-toggle {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .calculator-card,
    .mortgage-results,
    .amortization-section {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ================= ERROR MESSAGES ================= */
.error {
    color: #d32f2f;
    font-size: 0.85rem;
    padding: 0.75rem;
    background: #ffebee;
    border-radius: 8px;
    margin: 0.5rem 0;
}

body.dark-mode .error {
    background: #2a1a1a;
    color: #ef5350;
}
/* ================= Add system ================= */
.content-with-sidebar {
            display: flex;
            gap: 2rem;
            flex-wrap: wrap;
        }
        
        .main-content {
            flex: 7;
            min-width: 0;
        }
        
        .sidebar {
            flex: 3;
            min-width: 280px;
        }
        
        /* Single Sidebar Ad Container */
        .ad-sidebar {
            position: sticky;
            top: 100px;
            background: var(--bg-card, #ffffff);
            border-radius: 12px;
            padding: 1rem;
            text-align: center;
            border: 1px solid var(--border-light, #e6e6e6);
            transition: background-color 0.3s ease, border-color 0.3s ease;
        }
        
        body.dark-mode .ad-sidebar {
            background: #2d2d2d;
            border-color: var(--border-dark, #333);
        }
        
        .ad-label {
            font-size: 0.7rem;
            color: var(--text-gray, #999);
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 0.5rem;
        }
        
        .ad-placeholder {
            background: #f5f5f5;
            min-height: 250px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 8px;
            color: var(--text-gray, #999);
            font-size: 0.85rem;
        }
        
        body.dark-mode .ad-placeholder {
            background: #3d3d3d;
        }
        
        /* Mobile: Sidebar moves below content */
        @media (max-width: 900px) {
            .content-with-sidebar {
                flex-direction: column;
            }
            
            .sidebar {
                order: 2;
            }
            
            .main-content {
                order: 1;
            }
            
            .ad-sidebar {
                position: static;
                margin-top: 1rem;
            }
        }

        /* ================= HAMBURGER MENU STYLES (NON-INTRUSIVE) ================= */
.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.hamburger {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--brand-dark);
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
}

.hamburger:hover {
    background: rgba(229, 50, 45, 0.1);
}

body.dark-mode .hamburger {
    color: var(--text-primary-dark);
}

.nav-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Preserve original nav styling - DO NOT override */
nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Keep original nav links styling */
nav a {
    text-decoration: none;
    color: var(--brand-dark);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s;
}

nav a:hover,
nav a.active {
    background: var(--brand-red);
    color: white;
}

/* Desktop navigation - keep original */
.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links li a {
    text-decoration: none;
    color: var(--brand-dark);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s;
    display: inline-block;
}

.nav-links li a:hover,
.nav-links li a.active {
    background: var(--brand-red);
    color: white;
}

body.dark-mode .nav-links li a {
    color: var(--text-secondary-dark);
}

body.dark-mode .nav-links li a:hover,
body.dark-mode .nav-links li a.active {
    background: var(--brand-red);
    color: white;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.3s, opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    visibility: visible;
    opacity: 1;
}

.mobile-menu-container {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: var(--bg-card);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    transition: right 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    border-left: 1px solid var(--border-light);
}

body.dark-mode .mobile-menu-container {
    background: var(--bg-card-dark);
    border-left-color: var(--border-dark);
}

.mobile-menu-overlay.active .mobile-menu-container {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 1rem;
}

body.dark-mode .mobile-menu-header {
    border-bottom-color: var(--border-dark);
}

.close-menu {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--brand-dark);
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-menu:hover {
    background: rgba(229, 50, 45, 0.1);
}

body.dark-mode .close-menu {
    color: var(--text-primary-dark);
}

.mobile-nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.mobile-nav-links li {
    margin: 0;
}

.mobile-nav-links li a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1.5rem;
    text-decoration: none;
    color: var(--brand-dark);
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.2s;
}

body.dark-mode .mobile-nav-links li a {
    color: var(--text-primary-dark);
}

.mobile-nav-links li a i {
    width: 24px;
    color: var(--brand-red);
}

.mobile-nav-links li a:hover,
.mobile-nav-links li a.active {
    background: rgba(229, 50, 45, 0.1);
}

.mobile-dark-toggle {
    margin: 1rem 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark-mode .mobile-dark-toggle {
    border-top-color: var(--border-dark);
}

.mobile-dark-toggle span {
    font-weight: 500;
    color: var(--brand-dark);
}

body.dark-mode .mobile-dark-toggle span {
    color: var(--text-primary-dark);
}

/* Hide desktop nav links and show hamburger ONLY on mobile */
@media (max-width: 768px) {
    /* Hide the original nav element on mobile */
    nav {
        display: none;
    }
    
    /* Hide the nav-links on mobile */
    .nav-links {
        display: none;
    }
    
    /* Show hamburger button */
    .hamburger {
        display: flex;
    }
    
    /* Adjust header padding for mobile */
    header {
        padding: 0.75rem 1rem;
    }
}

/* Prevent body scroll when menu open */
body.menu-open {
    overflow: hidden;
}



/*=========mortgate hamburger============*/
/* ================= HAMBURGER MENU STYLES ================= */
.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.hamburger {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--brand-dark);
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
}

.hamburger:hover {
    background: rgba(229, 50, 45, 0.1);
}

body.dark-mode .hamburger {
    color: var(--text-primary-dark);
}

.nav-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.3s, opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    visibility: visible;
    opacity: 1;
}

.mobile-menu-container {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: var(--bg-card);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    transition: right 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    border-left: 1px solid var(--border-light);
}

body.dark-mode .mobile-menu-container {
    background: var(--bg-card-dark);
    border-left-color: var(--border-dark);
}

.mobile-menu-overlay.active .mobile-menu-container {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 1rem;
}

.close-menu {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--brand-dark);
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-menu:hover {
    background: rgba(229, 50, 45, 0.1);
}

.mobile-nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.mobile-nav-links li a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1.5rem;
    text-decoration: none;
    color: var(--brand-dark);
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.2s;
}

.mobile-nav-links li a i {
    width: 24px;
    color: var(--brand-red);
}

.mobile-nav-links li a:hover,
.mobile-nav-links li a.active {
    background: rgba(229, 50, 45, 0.1);
}

.mobile-dark-toggle {
    margin: 1rem 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.menu-open {
    overflow: hidden;
}

/* Show hamburger only on mobile */
@media (max-width: 768px) {
    nav {
        display: none !important;
    }
    
    .hamburger {
        display: flex;
    }
    
    header {
        padding: 0.75rem 1rem;
    }
}