@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap');

:root {
    --primary-color-one: #42BBC5;  /* hsl(136, 55%, 37%) */
    --primary-color-two: #e64536;  /* hsl(4, 69%, 50%) */
    --neutral: #ffffff;            /* hsl(0, 0%, 100%) */
    --slate-one: #eaf6fb;          /* hsl(202, 86%, 94%) */
    --slate-two: #9cbdd0;          /* hsl(203, 41%, 72%) */
    --slate-three: #ffffff;        /* hsl(200, 26%, 54%) */
    --slate-four: #526d78;         /* hsl(200, 24%, 40%) */
    --slate-five: #017C7B;         /* hsl(220, 48%, 22%) */
    --p-font-size: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    max-width: 100vw;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    
    cursor:  default;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    overflow-x: hidden;
}

.container {
    
    display: flex;
    /** OR USE */
    /* ? display:  grid;   */
    /* ? grid-template-columns:  2fr 2fr; */
    width:  84vw;
    border-radius:  16px;
}


/** Mortgage Calculator Section Styling */

/** Parent Container */

.calculator {
  
    width:  50%;    /** Comment out or Delete this to use 'display:grid' */
    padding:  25px;
    border-radius:  16px;
}

/** Form Header and Clear All Button Styling */

.heading {
    display: flex;
    justify-content:  space-between;
    align-items: center;
}

#clear-calculator {
    text-decoration: underline;
    color: var(--slate-four);
    cursor:  pointer;
    align-self: end;
    padding-bottom: 2px;
}

/** Mortgage Form Styling  */

.form {
    height: 100%;
    padding: 24px 0 32px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.input-header, .mortgage-type-header{
    display: inline-block;
    margin-bottom: 8px;
    font-size: 14px;
}

.amount-in-currency {
    display: flex;
    align-items: center;
    border-radius:  5px;
    height:  34px;
    border:  1px solid var(--slate-four);
}

.amount-in-currency:hover{
    border:  1px solid var(--slate-five);
    cursor: pointer;
}

.currency-symbol {
    height: 32px;
    background-color:  var(--slate-one);
    padding: 5px 10px;
    border-top-left-radius:  5px;
    border-bottom-left-radius:  5px;

}

.currency-symbol > i.fa-solid.fa-sterling-sign {
    font-size: 12px;
}

.input-amount {
    width: 100%;
    border: none;
    border-top-right-radius:  5px;
    border-bottom-right-radius:  5px;
    font-family:  inherit;
    font-size: var(--p-font-size);
    font-weight:  700;
    color: var(--slate-five);
    outline:  none;
    height:  32px;
    padding:  0 16px;
}

/** Hide increase/decrease arrows -- Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/** Firefox */
input[type = number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.duration-and-rate {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 20px;
}

.duration {
    width: 45%;
}

.duration-value, .rate-value {
    display: flex;
    align-items: center;
    border-radius: 5px;
    height: 34px;
    border: 1px solid var(--slate-four);
}

.input-duration, .input-rate {
    width: 100%;
    height: 32px;
    border: none;
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
    padding:  0 16px;
    font-family: inherit;
    font-weight: 700;
    font-size: var(--p-font-size);
    outline: none;
}

.duration-value:hover, .rate-value:hover{
    border: 1px solid var(--slate-five);
    cursor:  pointer;
}

.term {
    height: 32px;
    background-color: var(--slate-one);
    padding: 5px 10px;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
}

.rate {
    width: 55%;
}

/** Radio Inputs Styling */

.repayment {
    margin-bottom: 8px;
}

.repayment, .interest-only {
    width: 100%;
    border: 1px solid var(--slate-four);
    padding: 10px 15px;
    border-radius: 5px;
}

.repayment:hover, .interest-only:hover {
    border: 1px solid var(--primary-color-one);
    cursor: pointer;
}

.repayment, 
.interest-only, 
.radio-label, 
#repayment, 
#interest-only {
    cursor: pointer;
}

input[type="radio"] {
    /** remove standard background appearance */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /** create custom radio button appearance */
    display: inline-block;
    width: 18px;
    height: 18px;
    padding: 3px;
    border: 1px solid #000;
    border-radius: 50%;
    /** background-color only for inner content */
    background-clip: content-box;
}

/** appearance for checked radio button */

input[type="radio"]:checked {
    border: 1px solid var(--primary-color-one);
    background-color: var(--primary-color-one);
}

/** optional styles, I'm using this for centering radio buttons and label */

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

.radio-label {
    font-weight: 600;
    font-size: var(--p-font-size);
    padding-left: 10px;
    width: 100%;
}

/** Form Active State  */

.active-state {
    border:  1px solid var(--primary-color-one);
}

.active-state-term {
    background-color: var(--primary-color-one);
}

/** Error States Styling */

.error-currency {
    background-color: var(--primary-color-two);
    color: var(--neutral);
    border-top-left-radius: 2.5px;
    border-bottom-left-radius: 2.5px;
}

.error-terms {
    background-color: var(--primary-color-two);
    color: var(--neutral);
    border-top-right-radius: 2.5px;
    border-bottom-right-radius: 2.5px;
}

.error-input {
    border: 1px solid var(--primary-color-two);
}

.error-message {
    color: var(--primary-color-two);
    font-size: 12px;
    margin-top: 10px;
}

.error-vibrate {
    animation: shake .12s 5;
}

@keyframes shake {
    0% { 
        transform: translateX(0);
    }
    40% {
        transform: translateX(10px);
    }
    100% {
        transform: translateX(-10px);
    }
}


/** Calculate Mortgage Button Styling */

.calculate-mortgage {
    outline: none;
    border: none;
    width: max-content;
    background-color: var(--primary-color-one);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: inherit;
    font-weight: 700;
    color: #fff;
    padding: 10px 30px;  
    border-radius: 25px;
    cursor: pointer;
}

.calculate-mortgage:hover {
    background-color: #08294C;
}

.calculate-mortgage img {
    height: 2.5cap;
}

.calculate-mortgage span {
    font-size: var(--p-font-size);
    padding-left: 10px;
}


/** Mortgage Results Section Styling */

/**  Parent  Container */

.results {
    width: 50%;   /** Comment out or Delete this to use 'display:grid' */
    background-color: var(--slate-five);
    border-top-right-radius:  16px;
    border-bottom-right-radius:  16px;
    border-bottom-left-radius:  64px;
}

/** Default Result Styling */

.default-result {
    display: grid;
    place-items: center;
    text-align: center;
    padding: 80px 20px;
}

.default-result img {
    padding-bottom:  20px;
}

.default-result-header {
    color:  var(--neutral);
    padding-bottom:  20px;
}

.default-result-text {
    color: var(--slate-three);
    font-size:  var(--p-font-size);
}

/** Full Results Styling */

.full-results {
    display: none;
    padding: 25px;
    height: 482px;  /** To match the height of default result */
}

/** Header & Text */

.full-results-header {
    color: var(--neutral);
    margin-bottom: 8px;
}

.full-results-text {
    color: var(--slate-four);
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 24px;
}

/** Computed Results Styling -- Mortgage Results being displayed to the user */

.computed-results {
    background-color: #0E2431;
    border-top: 4px solid var(--primary-color-one);
    border-radius: 10px;
    padding: 25px 25px 40px;
}

.computed-results span:nth-child(3n+1) {
    color: var(--slate-four);
    font-size: 15px;
    display: inline-block;
    margin-bottom: 8px;
}

.monthly-repayment{
    color: var(--primary-color-one);
    font-size: 40px;
    font-weight: 700;
}

.monthly-repayment, .total-repayment{
    display: flex;
    align-items: center;
}

.monthly-repayment svg{
    fill: var(--primary-color-one);
    height: 2cap;
    width: 48px;
    margin-left: -8px;
}

span#monthly-repayment-amount {
    margin-left: -8px;
}

span#monthly-repayment-amount, span#total-repayment-amount {
    width: 100%;
    overflow-wrap: anywhere;
}

hr {
    margin: 24px 0;
    border: 1px solid var(--slate-five);
}

.total-repayment{
    color: var(--neutral);
    font-size: 24px;
    font-weight: 700;
}

.total-repayment svg{
    fill: var(--neutral);
    height: 1.5cap;
    width: 48px;
    margin-left: -12px;
}

span#total-repayment-amount{
    margin-left: -12px;
}

/** Classes for toggling between default result & full results */
.hide {
    display: none;
}

.show {
    display: block;
}


/** Media Queries */

@media screen and (max-width: 839.99px) {
    .container{
        width:  92vw;
    }
}

@media screen and (max-width: 768.99px) {
    .container{
        width:  96vw;
    }
}

@media screen and (max-width: 733.99px) {
    .container{
        width:  98.8vw;
    }
}

@media screen and (max-width: 712.99px) {
    .header {
        font-size:  1.25em;
    }
}

@media screen and (max-width: 660.99px) {
    .input-duration {
        padding: 0 12px;
    }
}

@media screen and (max-width: 630.99px) {
    .calculator {
        padding:  20px;
    }
}

@media screen and (max-width: 600.99px) {
    .calculator {
        padding:  15px;
    }
}

@media screen and (max-width: 590.99px) {
    body {
        width: 100%;
    }
    .container {
        flex-direction: column;
        width: 100vw;
        align-self:  normal;
        border-radius: 0;
    }
    .calculator {
        padding: 40px 40px 20px;
        width: 100%;
        border-radius: 0;
    }
    .results {
        width: 100%;
        border-radius: 0;
    }
    .duration-and-rate {
        flex-direction: column;
        gap: 0;
    }
    .duration, 
    .rate,
    .calculate-mortgage {
        width: 100%;
    }
    .user-amount,
    .duration,
    .rate {
        margin-bottom: 20px;
    }
    .calculate-mortgage {
        margin-top: 20px;
    }
    .default-result {
        padding: 80px;
    }
    .full-results{
        padding: 50px;
    }
}

@media screen and (max-width: 390.99px) {
    .default-result {
        padding:  40px;
    }
    .full-results {
        padding: 40px;
    }

}

@media screen and (max-width: 350.99px) {
    .calculator, 
    .default-result,
    .full-results {
        padding: 20px;
    }
}

