@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-red: #0d0ded;
    --dark-red: #0d0ded;
    --light-red: #f28482;
    --black: #1a1a1a;
    --dark-gray: #2b2d42;
    --medium-gray: #8d99ae;
    --light-gray: #edf2f4;
    --white: #ffffff;
    --gradient: linear-gradient(135deg, var(--primary-red), var(--dark-red));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--black);
    color: var(--light-gray);
    line-height: 1.6;
}

header {
    background: var(--gradient);
    color: var(--white);
    padding: 1.5rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.back-btn {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(0, 0, 0, 0.3);
}

.back-btn:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

.calculator-container {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.input-section, .result-section {
    background: var(--dark-gray);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.input-section h2, .result-section h2 {
    color: var(--white);
    margin-bottom: 1.5rem;
    font-weight: 600;
    position: relative;
    padding-bottom: 0.5rem;
}

.input-section h2::after, .result-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--gradient);
    border-radius: 3px;
}

.input-group {
    margin-bottom: 1.8rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 500;
    color: var(--light-gray);
}

.input-group input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--medium-gray);
    outline: none;
    border-radius: 3px;
    margin-bottom: 1rem;
}

.input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-red);
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 5px rgba(230, 57, 70, 0.5);
}

.input-group input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--dark-red);
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(230, 57, 70, 0.8);
}

.slider-value {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.slider-value input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem;
    font-size: 1rem;
    color: var(--white);
}

.slider-value input:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.2);
}

.slider-value span {
    padding: 0 0.5rem;
    color: var(--light-gray);
    font-weight: 500;
}

button {
    background: var(--gradient);
    color: var(--white);
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, var(--dark-red), var(--primary-red));
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-card {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    border-left: 4px solid var(--primary-red);
    transition: transform 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.result-icon {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--primary-red);
}

.result-card p {
    margin: 0;
    color: var(--light-gray);
    font-size: 0.9rem;
}

.result-card h3 {
    margin: 0.5rem 0 0;
    color: var(--white);
    font-size: 1.4rem;
    font-weight: 600;
}

.chart-container {
    height: 250px;
    margin-bottom: 2rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 1rem;
}

.amortization-section {
    margin-top: 2rem;
}

.amortization-section h3 {
    margin-bottom: 1rem;
    color: var(--white);
    font-weight: 600;
}

.amortization-table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.amortization-table {
    width: 100%;
    border-collapse: collapse;
}

.amortization-table th {
    background-color: rgba(230, 57, 70, 0.2);
    padding: 0.8rem;
    text-align: left;
    font-weight: 600;
    color: var(--light-gray);
    border-bottom: 2px solid var(--primary-red);
}

.amortization-table td {
    padding: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--light-gray);
}

.amortization-table tr:hover {
    background-color: rgba(230, 57, 70, 0.1);
}

/* How to Use Section */
.how-to-use {
    background: var(--dark-gray);
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.how-to-use h2 {
    text-align: center;
    color: var(--white);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 600;
}

.steps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.step {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: 10px;
    position: relative;
    transition: transform 0.3s;
    border-left: 3px solid var(--primary-red);
}

.step:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.step-number {
    display: inline-block;
    width: 30px;
    height: 30px;
    background: var(--gradient);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-weight: bold;
    margin-right: 10px;
}

.toggle-details {
    background: transparent;
    color: var(--primary-red);
    border: 2px solid var(--primary-red);
    margin: 0 auto;
    display: block;
    width: auto;
    padding: 0.8rem 1.5rem;
    transition: all 0.3s;
}

.toggle-details:hover {
    background: rgba(230, 57, 70, 0.1);
    transform: none;
    box-shadow: none;
}

.detailed-instructions {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
    margin-top: 1rem;
}

.detailed-instructions.show {
    max-height: 500px;
}

.detailed-instructions h3 {
    color: var(--white);
    margin-bottom: 0.8rem;
}

.detailed-instructions ul {
    padding-left: 1.2rem;
}

.detailed-instructions li {
    margin-bottom: 0.5rem;
    color: var(--light-gray);
}

@media (max-width: 968px) {
    .calculator-container {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .back-btn {
        position: static;
        transform: none;
    }
}

@media (max-width: 576px) {
    .input-section, .result-section, .how-to-use {
        padding: 1.5rem;
    }
    
    .steps-container {
        grid-template-columns: 1fr;
    }
}