*,
*:before,
*:after {
    box-sizing: border-box;
}

:root,
body,
html {
    /* Base font responsive typography, easy for calculations*/
    font-size: 10px;
    font-family: "Roboto", "open sans", sans-serif, Helvetica, Arial;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    background: #eee;
    font-weight: 300;
}

:root {
    --dark-blue: #331673;
    --light-purple: #805fb2;
    --dark-purple: #462187;
    --theme: #532b99;
    --percentAmount: 60%; /** 5000/10000    */
    --percentTime: 33.33%; /** 10/30         */
    --percentRate: 42.86%; /** (12-6)/(20-6) */
    --thumb-size: 25px;
    --digit-line-height: 1em;
    --odometer-translate-y: 1em;
    --transition-timing: cubic-bezier(0, 0, 0.2, 1);
}

.flex {
    display: flex;
}

.center {
    align-items: center;
    justify-content: center;
}

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

.row {
    flex-direction: row;
}

.hidden {
    display: none;
}

.sip-calculator-app {
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: auto;
    min-height: 100vh;
    max-width: 600px;
    margin: auto;
}

.header {
    text-align: center;
    width: 80%;
    max-width: 360px;
    font-size: 3.2em;
    font-weight: 500;
    color: var(--dark-blue);
}

.calculator {
    display: flex;
    flex-direction: column;
    width: 90%;
    max-width: 500px;
    box-shadow: 0px 0px 15px 4px rgb(0 0 0 / 19%);
    border-radius: 3.2em;
    margin: 2.25em auto;
    padding: 3em 0;
}

.form_field {
    width: 100%;
    margin: 0.5em auto;
}

.form_field_label {
    display: flex;
    font-size: 18px;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    color: #fff;
    height: 2.22em;
    font-weight: 500;
    padding-left: 1.11em;
    margin-bottom: 25px;
    background: var(--theme);
    border-top-right-radius: 1.11em;
    border-bottom-right-radius: 1.11em;
    position: relative;
    z-index: 2;
    transform: translateX(-10px);
    width: fit-content;
    white-space: nowrap;
    min-width: 14.44em;
    max-width: 100%;
    padding-right: 1em;
}

.form_field_label::before,
.form_field_label::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    height: 2.22em;
    background: inherit;
    transform-origin: top left;
}

.form_field_label::before {
    content: "";
    width: 10px;
    z-index: 1;
    background-color: var(--theme);
}

.form_field_label::after {
    z-index: 0;
    width: 20px;
    filter: brightness(0.7);
    transform: skewY(-40deg) rotateY(60deg);
}

.form_field_input {
    margin: auto 2em;
}

.result {
    font-size: 1.2em;
    width: max-content;
    height: var(--digit-line-height);
    background-color: var(--light-purple);
}

.banner {
    background-color: var(--dark-blue);
    width: 100%;
    font-size: 2em;
    font-weight: 500;
    margin-top: 0.8em;
    padding: 1em 0;
}

.banner .cta {
    border-radius: 2em;
    background: #ffce2c;
    color: var(--dark-blue);
    white-space: nowrap;
    padding: 0.5em 1.5em;
    cursor: pointer;
}

.footer {
    width: 100%;
    font-size: 10px;
    padding: 1.5em;
    color: var(--light-purple);
}

.slider {
    margin: 15px 0;
    width: 100%;
}

input[type="range"] {
    -webkit-appearance: none;
    color: var(--theme);
    background-image: none;
    background: #eaeaea;
    outline: none;
    height: 10px;
    border-radius: 5px;
    border: none;
}

input[type="range"]#slider_amount {
    background-image: linear-gradient(
        90deg,
        currentColor var(--percentAmount),
        #eaeaea var(--percentAmount)
    );
}

input[type="range"]#slider_time {
    background-image: linear-gradient(
        90deg,
        currentColor var(--percentTime),
        #eaeaea var(--percentTime)
    );
}

input[type="range"]#slider_rate {
    background-image: linear-gradient(
        90deg,
        currentColor var(--percentRate),
        #eaeaea var(--percentRate)
    );
}

input[type="range"]::-webkit-slider-thumb {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 2px solid var(--theme);
    background: #ffffff;
    appearance: none;
    -webkit-appearance: none;
    cursor: grab;
    cursor: -webkit-grab;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb:active {
    cursor: grabbing;
    cursor: -webkit-grabbing;
}

input[type="range"]::-moz-range-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 2px solid var(--theme);
    background: #ffffff;
    cursor: -moz-grab;
    outline: none;
}

input[type="range"]::-moz-range-thumb:active {
    cursor: grabbing;
    cursor: -moz-grabbing;
}

/** FF*/
input[type="range"]::-moz-range-progress {
    background-color: var(--theme);
}
input[type="range"]::-moz-range-track {
    background-color: #eaeaea;
}

/* IE*/
input[type="range"]::-ms-fill-lower {
    background-color: #eaeaea;
}
input[type="range"]::-ms-fill-upper {
    background-color: var(--theme);
}

.label__container {
    width: calc(100% - var(--thumb-size));
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.range_label {
    position: absolute;
    font-size: 12px;
    font-weight: 300;
    padding-bottom: 2px;
    transform: translateX(calc(-50% + var(--thumb-size) / 2));
    color: var(--light-purple);
}

.range_label.active {
    position: absolute;
    color: var(--theme);
    font-size: 14px;
    font-weight: 500;
    align-self: flex-end;
    bottom: 2px;
}

.active_range_label_indicator {
    position: absolute;
    color: var(--theme);
    left: calc(50% - 3.5px);
    top: 10px;
}

svg {
    fill: var(--theme);
}

.digit {
    white-space: nowrap;
    line-height: var(--digit-line-height);
}

.currency {
    margin-right: 0.2em;
}

.animate {
    transition: transform 1s var(--transition-timing);
}

.digit-up {
    transform: translateY(calc(-100% + var(--odometer-translate-y)));
}

.digit-down {
    transform: translateY(calc(100% - var(--odometer-translate-y)));
}

.result-container {
    overflow: hidden;
}

.result-outer-container {
    display: flex;
    font-weight: 500;
    font-size: 1.75em;
    max-width: 500px;
    border-radius: 2em;
    background-color: var(--light-purple);
    color: white;
    padding: 0.5em 1em;
    white-space: nowrap;
    align-items: center;
    margin: 1em auto;
}

.result-header {
    font-size: 2em;
    font-weight: 500;
    color: var(--dark-blue);
}

/* single bar chart start*/

#result-bar-container {
    max-width: 500px;
    width: 98%;
    --primary-color: #331673;
    --secondary-color-darker: rgb(129, 95, 178);
}

.secondary_bar {
    height: 3em;
    border-radius: 3em;
    background-color: var(--secondary-color-darker);
    color: white;
    margin: 1em 0;
    border: 0.5em solid rgba(255, 255, 255, 0.8);
    box-sizing: content-box;
}

.primary_bar {
    height: inherit;
    border-radius: inherit;
    background-color: var(--primary-color);
    transition: width 1s var(--transition-timing);
    min-width: 3em;
}

.bar_labels {
    display: flex;
    font-size: max(12px, 1.5em);
    font-weight: 500;
    justify-content: space-between;
    margin: 0 1em;
}

.secondary_label {
    color: var(--secondary-color-darker);
}

.secondary_label::after {
    content: attr(data-value);
}

.primary_label {
    color: var(--primary-color);
}

.primary_label::after {
    content: attr(data-value);
}

/* single bar chart end */

@media (max-width: 501px) {
    body {
        font-size: 9.5px;
    }
}
@media (max-width: 476px) {
    body {
        font-size: 9px;
    }
}
@media (max-width: 451px) {
    body {
        font-size: 8.5px;
    }
}
@media (max-width: 426px) {
    body {
        font-size: 8px;
    }
}
@media (max-width: 402px) {
    body {
        font-size: 7.5px;
    }
}
@media (max-width: 376px) {
    body {
        font-size: 7px;
    }
}
@media (max-width: 351px) {
    body {
        font-size: 6.5px;
    }
}
@media (max-width: 326px) {
    body {
        font-size: 6px;
    }
}
