/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Color Variables */
:root {
    --primary-color: #355C7D;
    --secondary-color: #6C5B7B;
    --accent-color: #C06C84;
    --highlight-color: #F67280;
    --light-color: #F8B195;
    --white: #ffffff;
    --gray-light: #f8f9fa;
    --gray-medium: #e9ecef;
    --gray-dark: #6c757d;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 2rem 0;
    text-align: center;
}

.header__title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header__subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Navigation */
.navigation {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navigation__list {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem 0;
}

.navigation__link {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.navigation__link:hover,
.navigation__link--active {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Main */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* Section Title */
.section-title {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Simulator */
.simulator__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.simulator__form-section,
.simulator__results-section {
    background-color: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

/* Form Styles */
.form__group {
    margin-bottom: 1.5rem;
}

.form__label {
    display: block;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.form__required {
    color: var(--error-color);
}

.form__input,
.form__select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--gray-medium);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form__input:focus,
.form__select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(53, 92, 125, 0.1);
}

.form__input.error {
    border-color: var(--error-color);
}

.form__help {
    display: block;
    color: var(--gray-dark);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Button */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn--primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn--full {
    width: 100%;
}

/* Results */
.results {
    animation: fadeIn 0.5s ease-in;
}

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

.results__summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-card {
    background-color: var(--gray-light);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    text-align: center;
    transition: var(--transition);
}

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

.result-card--highlight {
    background: linear-gradient(135deg, var(--highlight-color), var(--accent-color));
    color: var(--white);
}

.result-card__icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.result-card__title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.result-card--highlight .result-card__title {
    opacity: 0.9;
}

.result-card__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.result-card--highlight .result-card__value {
    color: var(--white);
}

.result-card__note {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

/* Chart */
.chart-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: var(--gray-light);
    border-radius: var(--border-radius);
}

.chart-title {
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
}

.chart {
    width: 100%;
    height: 300px;
    border-radius: var(--border-radius);
}

/* Table */
.amortization-table {
    margin-top: 2rem;
}

.table-title {
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--white);
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: right;
    border-bottom: 1px solid var(--gray-medium);
}

.table th {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: 600;
}

.table tbody tr:hover {
    background-color: var(--gray-light);
}

.table td:first-child,
.table th:first-child {
    text-align: center;
}

/* Error Message */
.error-message {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background-color: #ffeaea;
    border: 1px solid var(--error-color);
    border-radius: var(--border-radius);
    color: var(--error-color);
}

.error-message__icon {
    font-size: 2rem;
}

.error-message__content h3 {
    margin-bottom: 0.5rem;
}

/* FAQ Styles */
.faq__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.faq__category {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.faq__category-title {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    border-bottom: 2px solid var(--light-color);
    padding-bottom: 0.5rem;
}

.faq__item {
    margin-bottom: 1rem;
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.faq__question {
    width: 100%;
    padding: 1rem;
    background-color: var(--gray-light);
    border: none;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq__question:hover {
    background-color: var(--light-color);
}

.faq__question[aria-expanded="true"] {
    background-color: var(--primary-color);
    color: var(--white);
}

.faq__icon {
    font-size: 1.2rem;
    font-weight: bold;
}

.faq__answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq__answer p {
    padding: 1rem;
    background-color: var(--white);
    margin: 0;
    line-height: 1.6;
}

.faq__contact {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
}

.faq__contact h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: var(--white);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
}

.footer__text {
    font-size: 0.9rem;
}

.footer__link {
    color: var(--light-color);
    text-decoration: none;
    transition: var(--transition);
}

.footer__link:hover {
    color: var(--white);
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header__title {
        font-size: 2rem;
    }
    
    .header__subtitle {
        font-size: 1rem;
    }
    
    .navigation__list {
        gap: 1rem;
    }
    
    .simulator__grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .simulator__form-section,
    .simulator__results-section {
        padding: 1.5rem;
    }
    
    .results__summary {
        grid-template-columns: 1fr;
    }
    
    .result-card {
        padding: 1rem;
    }
    
    .result-card__value {
        font-size: 1.25rem;
    }
    
    .chart {
        height: 250px;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .faq__grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .faq__category {
        padding: 1rem;
    }
    
    .faq__question {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .error-message {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .header {
        padding: 1.5rem 0;
    }
    
    .header__title {
        font-size: 1.75rem;
    }
    
    .main {
        padding: 1rem 0;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .simulator__form-section,
    .simulator__results-section {
        padding: 1rem;
    }
    
    .form__input,
    .form__select {
        padding: 0.625rem;
    }
    
    .btn {
        padding: 0.625rem 1rem;
    }
    
    .chart {
        height: 200px;
    }
    
    .table-wrapper {
        font-size: 0.8rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
    
    .form__input,
    .form__select {
        border-width: 3px;
    }
}

/* Print styles */
@media print {
    .navigation,
    .footer {
        display: none;
    }
    
    .simulator__grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        display: none;
    }
    
    body {
        background-color: white;
    }
    
    .simulator__form-section,
    .simulator__results-section {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
