/* Modern Mortgage Calculator Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.18);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 64px rgba(0, 0, 0, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: #0f0f23;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    z-index: -2;
}

.glass-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 25s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    top: -15%;
    right: -15%;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    bottom: -15%;
    left: -15%;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(30px, 30px) scale(1.1);
    }
}

/* Ad Minimal */
.ad-minimal {
    max-width: 1200px;
    margin: 0 auto 20px;
    padding: 0 20px;
}

.ad-minimal > span,
.ad-minimal.vertical > span {
    display: block;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.ad-minimal.vertical > span {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-minimal.bottom {
    margin-top: 40px;
}

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

/* Back Button */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.938rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.back-btn:hover {
    transform: translateX(-4px);
    background: rgba(255, 255, 255, 0.12);
}

.back-btn svg {
    width: 20px;
    height: 20px;
}

/* Hero */
.hero {
    text-align: center;
    padding: 40px 20px 30px;
}

.hero h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 50%, #667eea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 8s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.hero p {
    color: var(--text-secondary);
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 300;
}

/* Calculator Container */
.calc-container {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    margin-top: 30px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.sidebar-ad {
    order: 2;
}

.calculator {
    order: 1;
    max-width: 800px;
    margin: 0 auto;
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow);
    position: relative;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

/* Form */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.small {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.813rem;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.icon {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    font-weight: 600;
    pointer-events: none;
}

.icon-right {
    position: absolute;
    right: 16px;
    color: var(--text-secondary);
    font-weight: 600;
    pointer-events: none;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-with-icon input {
    padding-left: 36px;
}

.input-with-icon input:has(+ .icon-right) {
    padding-right: 40px;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: rgba(240, 147, 251, 0.6);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(240, 147, 251, 0.1);
}

/* Toggle Button */
.toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.938rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.toggle-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.toggle-btn.active svg {
    transform: rotate(180deg);
}

/* Optional Fields */
.optional-fields {
    margin-bottom: 24px;
    animation: slideDown 0.3s ease;
}

.optional-fields.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Submit Button */
.submit-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: var(--gradient-accent);
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 1.063rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(240, 147, 251, 0.3);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(240, 147, 251, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn svg {
    width: 20px;
    height: 20px;
}

/* Result */
.result {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.6s ease;
}

.result.hidden {
    display: none;
}

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

/* Payment Hero */
.payment-hero {
    text-align: center;
    padding: 40px 30px;
    background: var(--gradient-accent);
    border-radius: 20px;
    margin-bottom: 32px;
    box-shadow: 0 8px 32px rgba(240, 147, 251, 0.3);
}

.payment-label {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 12px;
}

.payment-amount {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}

/* Breakdown Grid */
.breakdown-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 32px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 0.938rem;
}

.breakdown-item.hidden {
    display: none;
}

.breakdown-label {
    color: var(--text-secondary);
}

.breakdown-value {
    font-weight: 700;
    color: var(--text-primary);
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.summary-card {
    text-align: center;
    padding: 24px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.summary-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-label {
    font-size: 0.813rem;
    color: var(--text-secondary);
}

/* Amortization */
.amortization {
    margin-top: 24px;
    animation: slideDown 0.3s ease;
}

.amortization.hidden {
    display: none;
}

.view-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: fit-content;
}

.view-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn.active {
    background: var(--gradient-accent);
    color: white;
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.3);
}

.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(255, 255, 255, 0.08);
}

th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

td {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 20px 20px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 968px) {
    .calc-container {
        grid-template-columns: 1fr;
    }

    .sidebar-ad {
        display: none;
    }
}

@media (max-width: 640px) {
    .glass-card {
        padding: 24px;
    }

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

    .payment-hero {
        padding: 30px 20px;
    }

    .payment-amount {
        font-size: 2.5rem;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .view-toggle {
        width: 100%;
    }

    .view-btn {
        flex: 1;
    }

    th,
    td {
        padding: 10px 12px;
        font-size: 0.813rem;
    }
}

/* Selection */
::selection {
    background: rgba(240, 147, 251, 0.3);
    color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
