:root {
    --bg: #eef4ff;
    --bg-soft: #f6f9ff;
    --surface: #ffffff;
    --surface-strong: #f9fbff;
    --text: #0f1f3d;
    --muted: #4f6287;
    --border: #d7e3fb;

    --primary: #1a7aff;
    --primary-dark: #0a4fd4;
    --accent: #00d4aa;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;

    --shadow-soft: 0 10px 24px rgba(10, 79, 212, 0.08);
    --shadow-card: 0 14px 36px rgba(15, 31, 61, 0.10);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 15% -10%, rgba(26, 122, 255, 0.18) 0%, rgba(26, 122, 255, 0) 42%),
        radial-gradient(circle at 100% 0%, rgba(0, 212, 170, 0.14) 0%, rgba(0, 212, 170, 0) 40%),
        linear-gradient(180deg, #f2f7ff 0%, #ecf3ff 100%);
    line-height: 1.62;
}

a {
    color: var(--primary-dark);
}

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(10, 79, 212, 0.14);
}

.site-header::after {
    content: "";
    display: block;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
}

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

.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.logo img {
    display: block;
    width: clamp(170px, 21vw, 280px);
    height: auto;
}

.nav {
    display: flex;
    align-items: center;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-desktop a,
.nav-mobile a,
.nav-mobile span {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    transition: all 0.2s ease;
}

.nav-desktop a:hover,
.nav-mobile a:hover,
.nav-mobile span:hover {
    background: #eaf2ff;
    color: var(--primary-dark);
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 260px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    display: none;
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    display: block;
    border-radius: 10px;
    padding: 10px 12px;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

main {
    max-width: 1100px;
    margin: 28px auto;
    padding: 30px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

h1,
h2,
h3 {
    color: var(--text);
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.2;
}

h1 {
    margin: 0 0 12px;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    letter-spacing: -0.02em;
}

h2 {
    margin: 0 0 10px;
    font-size: clamp(1.3rem, 2.2vw, 1.8rem);
}

h3 {
    margin: 26px 0 10px;
    font-size: clamp(1.1rem, 1.9vw, 1.4rem);
}

p {
    margin: 0 0 14px;
    color: var(--muted);
    max-width: 75ch;
}

strong {
    color: var(--text);
}

hr {
    margin: 30px 0;
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(10, 79, 212, 0), rgba(10, 79, 212, 0.35), rgba(10, 79, 212, 0));
}

.calc-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1.05fr) minmax(280px, 0.95fr);
    gap: 24px;
    margin: 24px 0;
}

.calc-form,
.calc-results,
#results {
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    border: 1px solid #c9daf8;
    border-radius: var(--radius-sm);
    padding: 11px 12px;
    font-size: 16px;
    color: var(--text);
    background: #fff;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(26, 122, 255, 0.16);
}

.term-row {
    display: flex;
    gap: 10px;
}

.term-row input {
    flex: 2;
}

.term-row select {
    flex: 1;
}

button {
    width: 100%;
    border: 0;
    border-radius: 999px;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(120deg, var(--primary) 0%, var(--primary-dark) 70%, #0950c0 100%);
    cursor: pointer;
    box-shadow: 0 12px 20px rgba(10, 79, 212, 0.24);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

button:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 16px 24px rgba(10, 79, 212, 0.28);
}

button:active {
    transform: translateY(0);
}

.error {
    border-color: #dc2626 !important;
}

.error-text {
    min-height: 18px;
    margin-top: 6px;
    font-size: 13px;
    color: #dc2626;
}

.calc-results,
#results {
    border-color: rgba(0, 212, 170, 0.35);
    background: linear-gradient(180deg, rgba(0, 212, 170, 0.08) 0%, rgba(255, 255, 255, 0.98) 80%);
}

.calc-results p,
#results p {
    margin: 12px 0;
    color: var(--text);
}

.calc-results span,
#results span {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-dark);
}

#monthlyPayment {
    color: #028b72;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    margin-bottom: 0;
}

.check-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.metric-list {
    display: grid;
    gap: 8px;
}

.metric-row {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(10, 79, 212, 0.1);
}

.metric-row strong {
    font-size: 14px;
}

.metric-row span {
    font-family: Georgia, "Times New Roman", serif;
    text-align: right;
}

.mode-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
    border-radius: 999px;
    background: #eaf2ff;
    border: 1px solid rgba(10, 79, 212, 0.18);
}

.mode-btn {
    width: auto;
    padding: 7px 14px;
    border-radius: 999px;
    border: 0;
    font-size: 13px;
    font-weight: 700;
    box-shadow: none;
    color: var(--text);
    background: transparent;
}

.mode-btn:hover {
    transform: none;
    box-shadow: none;
    filter: none;
    background: rgba(26, 122, 255, 0.1);
}

.mode-btn.active {
    color: #fff;
    background: linear-gradient(120deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 6px 16px rgba(10, 79, 212, 0.25);
}

footer {
    max-width: 1100px;
    margin: 0 auto 16px;
    padding: 8px 20px 26px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-bottom: 10px;
}

.footer-links a {
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    color: var(--muted);
}

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

.nav-mobile {
    display: none;
}

@media (max-width: 1024px) {
    main {
        margin: 20px;
        padding: 24px;
    }

    .nav-desktop {
        display: none;
    }

    .nav-mobile {
        display: flex;
        gap: 8px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .calc-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .dropdown-menu {
        position: static;
        margin-top: 8px;
        width: 100%;
    }

    .dropdown:hover .dropdown-menu {
        display: block;
    }

    h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 640px) {
    main {
        margin: 14px;
        padding: 18px;
        border-radius: 16px;
    }

    .nav-mobile {
        width: 100%;
        justify-content: space-between;
    }

    .nav-mobile a,
    .nav-mobile span {
        padding: 8px 10px;
        font-size: 13px;
    }

    .footer-links {
        gap: 6px 12px;
    }
}
