:root {
    --primary: #2c3e50;
    --secondary: #ff6b6b;
    --accent: #3d5a80;
    --light-bg: #f8f9fa;
    --teal: #4ecdc4;
    --border-color: #e0e0e0;
    --text-color: #000000;
    --text-light: #666;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --warning-bg: #fff3cd;
    --warning-border: #ffeaa7;
    --warning-text: #856404;
    --error-bg: #f8d7da;
    --error-border: #f5c6cb;
    --error-text: #721c24;
}

* {
    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);
    padding: 0;
    margin: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 10px;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #000;
    text-align: center;
}

h2 {
    font-size: 1.375rem;
    color: #ff6b6b;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    color: #000;
    margin-bottom: 0.75rem;
}

h4 {
    font-size: 1.125rem;
    color: #000;
    margin-bottom: 0.5rem;
}

.main-content {
    display: flex;
    gap: 0 20px;
    margin-bottom: 20px;
}

.calculator-container {
    flex: 1;
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 0 20px;
}

.ad-container {
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #000;
    text-align: center;
    padding: 15px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    min-height: inherit;
    height: 100%;
    box-sizing: border-box;
    background: white;
}

.ad-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: #000;
    margin-bottom: 10px;
}

.ad-dimensions {
    font-size: 1rem;
    color: #000;
    margin-bottom: 15px;
}

.ad-placeholder {
    width: 100%;
    flex-grow: 1;
    background: white;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000;
    font-style: italic;
    margin-bottom: 15px;
    min-height: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.ad-cta {
    font-size: 1rem;
    color: #000;
    font-weight: 500;
}

#ad-left {
    width: 300px;
    height: 250px;
}

#ad-right {
    width: 300px;
    height: 600px;
    min-height: 600px;
    display: flex;
}

#ad-tablet {
    display: none;
    width: 300px;
    height: 250px;
    margin: 10px auto 0;
}

#ad-mobile {
    display: none;
    width: 320px;
    height: 100px;
    margin: 0 auto;
}

#related-tools {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    text-align: left;
    margin-bottom: 15px;
}

.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);
}

.sticky {
    position: sticky;
    top: 20px; 
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #000;
    font-size: 1rem;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    color: #000;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(61, 90, 128, 0.2);
}

input.warning {
    border-color: #ffc107;
    background-color: var(--warning-bg);
}

input.error {
    border-color: var(--error-border);
    background-color: var(--error-bg);
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.calculator-options {
    background: var(--light-bg);
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    color: #000;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--primary);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #e55c5c;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 1rem;
    justify-content: center;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.summary-card {
    background: var(--light-bg);
    padding: 15px;
    border-radius: var(--radius);
    text-align: center;
    border-top: 4px solid var(--teal);
}

.summary-card h3 {
    color: #000;
    margin-bottom: 10px;
}

.summary-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: #000;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin: 20px 0;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    color: #000;
}

.tab.active {
    border-bottom: 3px solid var(--accent);
    color: var(--accent);
    font-weight: bold;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.chart-container {
    height: 300px;
    background: var(--light-bg);
    margin: 20px 0;
    border-radius: var(--radius);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000;
    position: relative;
}

.export-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
    justify-content: center;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s;
    color: #000;
}

.export-btn:hover {
    background: var(--accent);
    color: white;
}

.results-section {
    display: none;
}

.results-visible {
    display: block;
}

.amortization-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 1rem;
    color: #000;
}

.amortization-table th, 
.amortization-table td {
    padding: 8px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.amortization-table th {
    background-color: var(--light-bg);
    font-weight: bold;
    font-size: 1rem;
    color: #000;
}

.amortization-table tr:hover {
    background-color: rgba(78, 205, 196, 0.1);
}

.table-container {
    overflow-x: auto;
    margin: 20px 0;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

.charts-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

.chart-wrapper {
    flex: 1;
    min-width: 300px;
    background: white;
    padding: 15px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    height: 350px;
    display: flex;
    flex-direction: column;
}

.chart-title {
    text-align: center;
    margin-bottom: 15px;
    color: #000;
    font-weight: bold;
    font-size: 1.25rem;
}

.chart-canvas-container {
    flex: 1;
    position: relative;
}

.pagination {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    gap: 5px;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    border-radius: 4px;
    color: #000;
}

.pagination button.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.pagination button:hover:not(.active) {
    background: var(--light-bg);
}

.breadcrumb {
    padding: 0px 10px;
    color: #000;
    margin-bottom: 5px;
    font-size: 1rem;
    width: 100%;
}

.breadcrumb a {
    color: #000;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

.warning-container {
    background-color: var(--warning-bg);
    border: 1px solid var(--warning-border);
    color: var(--warning-text);
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 20px;
    display: none;
}

.warning-header {
    font-weight: bold;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.warning-list {
    margin: 0;
    padding-left: 20px;
}

.warning-item {
    margin-bottom: 5px;
}

@media (max-width: 1024px) {
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.125rem;
    }
    
    h4 {
        font-size: 1rem;
    }
    
    .tab {
        font-size: 1rem;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    #ad-left, #ad-right {
        display: none;
    }
    
    #ad-tablet {
        display: flex;
    }
    
    .mobile-related-tools {
        width: 100%;
        display: block;
        margin-top: 20px;
    }
    
    .desktop-related-tools {
        display: none;
    }
    
    .sticky {
        position: relative;
        top: 0;
    }
}

@media (max-width: 767px) {
    h1 { 
        font-size: 1.25rem; 
    }
    
    h2 { 
        font-size: 1.125rem; 
        color: #ff6b6b;
    }
    
    h3 { 
        font-size: 1rem; 
    }
    
    h4 {
        font-size: 0.9375rem;
    }
    
    .tab {
        font-size: 0.875rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    #ad-tablet {
        display: none;
    }
    
    #ad-mobile {
        display: flex;
    }
    
    .sidebar {
        flex-direction: column;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .export-options {
        flex-direction: column;
    }
    
    .mobile-related-tools {
        display: block;
        margin-top: 20px;
    }
    
    .desktop-related-tools {
        display: none;
    }
    
    .charts-row {
        flex-direction: column;
    }

    .pagination {
        flex-wrap: wrap;
    }
    
    .chart-wrapper {
        height: 300px;
    }
    
    .breadcrumb {
        padding: 0px 10px;
        font-size: 1rem;
    }
}

@media (min-width: 1025px) {
    .mobile-related-tools {
        display: none;
    }
    
    .desktop-related-tools {
        display: block;
    }
    
    .sidebar {
        align-self: flex-start;
        position: sticky;
        top: 20px;
        height: auto;
        overflow-y: auto;
    }
    
    .sidebar .sticky {
        position: static;
    }
    
    #related-tools {
        margin-top: 20px;
    }
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.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;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.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;
  color: #000;
}

.mobile-table tr:nth-child(even) {
  background-color: #fafafa;
}