:root {
    --primary: #2c3e50;
    --secondary: #ff6b6b;
    --accent: #3d5a80;
    --light-bg: #f8f9fa;
    --teal: #4ecdc4;
    --border-color: #e0e0e0;
    --text-color: #000000;
    --text-light: #666;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Times New Roman', Times, serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #000;
    background-color: var(--light-bg);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 10px;
}

.calculator-content {
   
}

/* Mobile Layout (≤767px) - Default */
.calculator-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.calculator-main {
    width: 100%;
}

.calculator-sidebar {
    display: none;
}

.ad-zone {
    background-color: var(--light-bg);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
    color: var(--text-light);
    font-size: 1rem;
}

#ad-mobile {
    width: 100%;
    max-width: 320px;
    height: 100px;
    margin: 20px auto 0 auto;
}

#ad-tablet, #ad-left {
    width: 300px;
    height: 250px;
    margin: 0 auto;
}

#ad-right {
    width: 300px;
    height: 600px;
    margin: 0 auto;
}

.related-tools {
    width: 100%;
    max-width: 100%;
    margin: 20px auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.related-tools h3 {
    margin-bottom: 15px;
    color: #000;
    font-size: 1rem;
}

.tools-list {
    list-style: none;
}

.tools-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.tools-list li:last-child {
    border-bottom: none;
}

.tools-list a {
    color: #000;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tools-list a:hover {
    color: var(--teal);
}

/* Calculator Styles */
.calculator {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.calculator h1 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: #000;
    text-align: center;
}

.calculator h2 {
    font-size: 1.125rem;
    margin: 20px 0 15px;
    color: #ff6b6b;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.calculator h3 {
    font-size: 1rem;
    margin: 15px 0 10px;
    color: #000;
}

h1 {
    font-size: 1.25rem;
    color: #000;
}

h2 {
    font-size: 1.125rem;
    color: #ff6b6b;
}

h3 {
    font-size: 1rem;
    color: #000;
}

.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.form-column {
    flex: 1;
    min-width: 200px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #000;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    color: #000;
}

.input-with-unit {
    position: relative;
}

.unit {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    position: relative;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    position: relative;
    color: #000;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
    flex: 1;
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
    flex: 1;
}

.btn-export {
    background-color: var(--teal);
    color: white;
    margin: 5px;
    padding: 8px 15px;
    font-size: 1rem;
}

button:hover:not(:disabled) {
    opacity: 0.9;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.results {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    display: none;
}

.results-visible {
    display: block;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.result-item {
    background-color: var(--light-bg);
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

.result-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--accent);
    margin: 10px 0;
}

.amortization-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 1rem;
}

.amortization-table th, .amortization-table td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: center;
    color: #000;
}

.amortization-table th {
    background-color: var(--light-bg);
    font-weight: bold;
    font-size: 1rem;
}

.amortization-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-size: 1rem;
    color: #000;
}

.tab.active {
    border-bottom: 2px solid var(--accent);
    color: var(--accent);
    font-weight: bold;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.export-options {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin: 20px 0;
}

/* Chart Styles - Smaller Size */
.chart-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 20px 0;
    justify-content: center;
}

.chart-wrapper {
    flex: 1;
    min-width: 250px;
    max-width: 300px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.chart-title {
    text-align: center;
    margin-bottom: 10px;
    font-weight: bold;
    color: #000;
    font-size: 1rem;
}

.chart-canvas-container {
    height: 180px;
    position: relative;
}

/* Pagination Styles */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px 0;
    gap: 10px;
}

.pagination-btn {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    background-color: white;
    cursor: pointer;
    border-radius: 4px;
    font-size: 1rem;
    color: #000;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--light-bg);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 1rem;
    color: var(--text-light);
    margin: 0 10px;
}

.amortization-page {
    display: none;
}

.amortization-page.active {
    display: block;
}

/* Print styles */
@media print {
    body * {
        visibility: hidden;
    }
    .printable-report, .printable-report * {
        visibility: visible;
    }
    .printable-report {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        font-size: 0.75rem;
        line-height: 1.2;
        padding: 10px;
    }
    .export-options, .ad-zone, .calculator-sidebar, .calculator-tabs, .calculator-form {
        display: none !important;
    }
    .printable-report h1 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    .printable-report h2 {
        font-size: 0.875rem;
        margin: 15px 0 8px;
    }
    .printable-report .result-line {
        margin-bottom: 5px;
    }
    .printable-report .amortization-text {
        font-size: 0.625rem;
        line-height: 1.1;
    }
    .amortization-vertical-line {
        margin-bottom: 8px;
        padding-bottom: 8px;
        border-bottom: 1px dashed #ccc;
    }
}

/* Tablet Layout (768px–1024px) */
@media (min-width: 768px) {
    .calculator h1 {
        font-size: 1.5rem;
        text-align: center;
    }

    .calculator h2 {
        font-size: 1.25rem;
    }

    .calculator h3 {
        font-size: 1.125rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    .tab {
        font-size: 1rem;
    }

    #ad-mobile, #ad-left, #ad-right {
        display: none;
    }

    #ad-tablet {
        display: flex;
        margin-top: 10px;
    }

    .mobile-tablet-tools {
        display: block;
    }
}

/* Desktop Layout (≥1025px) */
@media (min-width: 1025px) {
    .calculator-wrapper {
        flex-direction: row;
        gap: 20px;
    }

    .calculator-sidebar {
        display: block;
        width: 300px;
    }

    .calculator-main {
        flex: 1;
    }

    .sticky-sidebar {
        position: sticky;
        top: 20px;
    }

    #ad-mobile, #ad-tablet {
        display: none;
    }

    #ad-left, #ad-right, .desktop-tools {
        display: block;
    }

    .mobile-tablet-tools {
        display: none;
    }

    .related-tools {
        max-width: 300px;
    }

    .calculator h1 {
        text-align: center;
        font-size: 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.375rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .tab {
        font-size: 1rem;
    }
}

/* Add breadcrumb styles */
.breadcrumb {
    padding: 0px 10px;
    color: #000;
    margin-bottom: 5px;
    font-size: 1rem;
}

.breadcrumb a {
    color: #000;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

/* Loading Spinner Styles */
.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: var(--accent);
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    margin: 0 auto 10px;
}

.button-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

.calculating {
    position: relative;
}

.calculating .button-text {
    visibility: hidden;
}

.calculating::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Full page overlay spinner */
.overlay-spinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.overlay-spinner.active {
    display: flex;
}

.overlay-spinner .spinner-text {
    margin-top: 15px;
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: bold;
}

.mobile-table {
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid #eee;
    border-radius: 8px;
}

.mobile-table table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
}

.mobile-table th, .mobile-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    color: #000;
}

.mobile-table th {
    background-color: #4ecdc4;
    font-weight: bold;
    font-size: 1rem;
}

.mobile-table tr:nth-child(even) {
    background-color: #fafafa;
}