.adi-calc {
    padding-bottom: 4rem;
    display: grid;
    gap: 2rem;
}

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

/* ==== STEPPER ==== */

.adi-calc-stepper {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    padding-bottom: 4rem;
    border-bottom: 1px solid var(--border-gray);
}

.adi-calc-step__header {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.adi-calc-step__number {
    background-color: var(--green);
    color: var(--light);
    width: 2.875rem;
    height: 2.875rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    flex-shrink: 0;
}

.adi-calc-step__title {
    font-size: 1.25rem;
}


/* BIG VISUAL RADIO */

.adi-calc-visual-radio {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--light);
}

.adi-calc-visual-radio__radio input[type="radio"] {
    opacity: 0;
    position: absolute;
    z-index: -1;
}

.adi-calc-visual-radio__radio label {
    padding: 0.5rem;
    background: var(--white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px solid transparent;
    cursor: pointer;
    position: relative;
    text-align: center;
    aspect-ratio: 1;
}


.adi-calc-visual-radio__radio label img {
    margin: 0 -0.5rem;
}

.adi-calc-visual-radio__radio svg {
    width: 100%;
}

.adi-calc-visual-radio__radio label:hover,
.adi-calc-visual-radio__radio input[type="radio"]:checked+label {
    border-color: var(--green);
    transition: 0.3s;
}

.adi-calc-visual-radio__radio input[type="radio"]:checked+label:after {
    content: "";
    background: url('data:image/svg+xml,<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3.8 8.01667L0 4.21667L0.95 3.26667L3.8 6.11667L9.91667 0L10.8667 0.95L3.8 8.01667Z" fill="white"/></svg>') no-repeat center, var(--green);
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    position: absolute;
    bottom: -0.75rem;
    left: 0;
    right: 0;
    margin: auto;
    z-index: 1;
}

/* === INPUTS */

.adi-calc-width-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
}

.adi-calc-width-control input {
    border: 1px solid var(--black);
    width: 4.5rem;
    outline: none;
    padding: 0.5rem;
    font-weight: bold;
    font-size: 1.25rem;
}

.adi-calc-width-control input:disabled {
    border-color: #d5d5d5;
    cursor: not-allowed;
}

.adi-calc-size-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.adi-calc-size-picker__shape {
    width: 100%;
    margin-bottom: 0.5rem;
}

/* SIMPLE RADIO AND CHECKBOX */

.adi-calc-radio {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.adi-calc-radio label {
    position: relative;
    padding-left: 2rem;
    line-height: 1.5rem;
    cursor: pointer;
}

.adi-calc-radio input[type="radio"]:checked+label:before,
.adi-calc-radio input[type="checkbox"]:checked+label:before {
    border-color: var(--green);
}

.adi-calc-radio label:before {
    content: "";
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 1px solid #D4A373;
    background: var(--light);
    position: absolute;
    left: 0;
}

.adi-calc-radio input[type="radio"]+label:before {
    border-radius: 50%;
}

/* Dot inside when checked */
.adi-calc-radio input[type="radio"]:checked+label:after {
    content: "";
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    background: var(--green);
    border-radius: 50%;
    position: absolute;
    left: 0.375rem;
    top: 0.375rem;
}

.adi-calc-radio input[type="checkbox"]:checked+label:after {
    content: "";
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background: url('data:image/svg+xml,<svg width="14" height="11" viewBox="0 0 14 11" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.9585 11L0.208496 6.24996L1.396 5.06246L4.9585 8.62496L12.6043 0.979126L13.7918 2.16663L4.9585 11Z" fill="%23027772"/></svg>') no-repeat center;
    border-radius: 50%;
    position: absolute;
    left: 0.25rem;
    top: 0.25rem;
}


.adi-calc-radio-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.25rem;
}

.adi-calc-radio-grid>label {
    font-weight: bold;
    text-align: right;
}

.adi-calc-radio-control-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.adi-calc-col-preview {
    display: flex;
    flex-direction: column;
}

.adi-calc-col-preview__preview-sticky {
    flex-grow: 1;
}

/* ======= PREVIEW ======== */

.adi-calc-preview-wrapper {
    padding: 1rem;
    border: 1px solid #d5d5d5;
    position: sticky;
    top: 2.5rem;
    bottom: 2rem;
}

.adi-calc-preview {
    --total-w-planks: var(--side-a) / var(--plank-w);
    --total-h-planks: max(var(--side-b), var(--side-c)) / var(--plank-h);
    --slat-l1: 0;
    --slat-l2: 0;
    --slat-l3: 0;
    --slat-l4: 0;
    --slat-width: 2px;

    padding: 2rem;
    padding-top: 8rem;
    background-color: var(--light-gray);
    background-image: linear-gradient(#d5d5d5 0.5px, transparent 0.5px, transparent calc(100% - 0.5px), #d5d5d5 calc(100% - 0.5px)), linear-gradient(90deg, #d5d5d5 0.5px, transparent 0.5px, transparent calc(100% - 0.5px), #d5d5d5 calc(100% - 0.5px));
    background-size: 1rem 1rem;
}

/*.adi-calc-preview:before {
    padding-top: 100%;
    content: "";
    display: block;
}*/

.adi-calc-preview__shape-container {
    --width: var(--side-a);
    --height: max(var(--side-b), var(--side-c));
    --cutout-left-y-end: calc(var(--side-b) / var(--height) * 100%);
    --cutout-left-x-start: 0%;
    --cutout-left-x-end: calc(var(--side-d) / var(--width) * 100%);
    --cutout-center-y: calc(var(--side-f) / var(--height) * 100%);
    --cutout-center-x-start: var(--cutout-left-x-end);

    --cutout-right-x-start: calc(100% - (var(--side-e) / var(--width) * 100%));
    --cutout-right-x-end: 100%;
    --cutout-right-y-end: calc(var(--side-c) / var(--height) * 100%);

    --slat-color: var(--green);
    position: relative;
    transition: 0.2s;
    max-height: 60vh;
    margin: auto;
    aspect-ratio: var(--aspect-ratio);
}

.adi-calc-preview__shape {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--brown);
    background-image: linear-gradient(var(--black) 0.5px, transparent 0.5px, transparent calc(100% - 0.5px), var(--black) calc(100% - 0.5px)), linear-gradient(90deg, var(--black) 0.5px, transparent 0.5px, transparent calc(100% - 0.5px), var(--black) calc(100% - 0.5px));
    background-size: calc(100% / (var(--total-w-planks))) calc(100% / (var(--total-h-planks)));
    box-shadow: 0 calc(-1 * var(--slat-width) * var(--slat-l1)) 0 red, 0 calc(var(--slat-width) * var(--slat-l3)) 0 red, calc(-1 * var(--slat-width) * var(--slat-l2)) 0 0 red, calc(var(--slat-width) * var(--slat-l4)) 0 0 red;

    clip-path: polygon(0 0,
            0 var(--cutout-left-y-end),
            var(--cutout-left-x-end) var(--cutout-left-y-end),
            var(--cutout-left-x-end) var(--cutout-center-y),
            var(--cutout-right-x-start) var(--cutout-center-y),
            var(--cutout-right-x-start) var(--cutout-right-y-end),
            var(--cutout-right-x-end) var(--cutout-right-y-end),
            100% 0);
}

.adi-calc-preview__slat {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.875rem;
    opacity: calc(var(--is-valid) * 1);
    overflow: hidden;
}

.adi-calc-preview__slat--l1 {
    bottom: 100%;
    left: 0;
    width: 100%;
    border-bottom: calc(var(--slat-l1) * 2px) solid var(--slat-color);
}

.adi-calc-preview__slat--l2 {
    top: 0;
    left: 100%;
    height: var(--cutout-right-y-end);
    width: 1.25rem;
    border-left: calc(var(--slat-l2) * 2px) solid var(--slat-color);
}

.adi-calc-preview__slat--l3 {
    top: var(--cutout-center-y);
    left: var(--cutout-left-x-end);
    width: calc(var(--cutout-right-x-start) - var(--cutout-left-x-end));
    border-top: calc(var(--slat-l3) * 2px) solid var(--slat-color);
}

.adi-calc-preview__slat--l4 {
    top: 0;
    right: 100%;
    height: var(--cutout-left-y-end);
    width: 1.25rem;
    border-right: calc(var(--slat-l4) * 2px) solid var(--slat-color);
}

.adi-calc-preview__slat--l5 {
    top: var(--cutout-left-y-end);
    left: 0;
    height: 1.25rem;
    width: var(--cutout-left-x-end);
    border-top: calc(var(--slat-l5) * 2px) solid var(--slat-color);
}

.adi-calc-preview__slat--l6 {
    top: var(--cutout-right-y-end);
    right: 0;
    height: 1.25rem;
    width: calc(100% - var(--cutout-right-x-start));
    border-top: calc(var(--slat-l6) * 2px) solid var(--slat-color);
}

.adi-calc-preview__slat--l7 {
    top: var(--cutout-center-y);
    left: var(--cutout-left-x-end);
    height: calc(var(--cutout-left-y-end) - var(--cutout-center-y));
    width: 1.25rem;
    border-left: calc(var(--slat-l7) * 2px) solid var(--slat-color);
}

.adi-calc-preview__slat--l8 {
    top: var(--cutout-center-y);
    left: calc(var(--cutout-right-x-start) - 1.25rem);
    height: calc(var(--cutout-right-y-end) - var(--cutout-center-y));
    width: 1.25rem;
    border-right: calc(var(--slat-l8) * 2px) solid var(--slat-color);
}



/*
    For L shape 
*/
.adi-calc-preview__shape-cutout {
    --cutout-h: var(--side-c) - var(--side-b);
    --cutout-w: var(--side-a) - var(--side-d);
    position: absolute;
    bottom: 0;
    right: 0;
    height: calc((var(--cutout-h)) / var(--side-b) * 100%);
    width: calc((var(--cutout-w)) / var(--side-a) * 100%);
}

.adi-calc-preview__title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--white);
    background: var(--green);
    padding: 1.25rem;
    margin: auto;
    display: inline-block;
    position: absolute;
    z-index: 10;
    left: 50%;
    top: -1.5rem;
    transform: translateX(-50%);
    white-space: nowrap;
}

.adi-calc-preview__params {
    display: flex;
    justify-content: center;
    position: absolute;
    left: 0;
    right: 0;
    z-index: 10;
    top: 3rem;
    width: 100%;
}

.adi-calc-preview-params-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;

    padding: 1rem;
    font-size: 0.75rem;
    background: var(--white);
}

.adi-calc-preview-params-list>div {
    display: flex;
}

.adi-calc-preview-params-list dt {
    font-weight: bold;
    margin-right: 0.25rem;
    white-space: nowrap;
}

.adi-calc-preview-params-list dd+dt {
    margin-left: 0.75rem;
}

.adi-calc-preview-params-list dd {
    margin: 0;
    white-space: nowrap;
}

.adi-calc-details {
    background: var(--light-gray);
    border: 1px solid var(--border-gray);
    padding: 1rem;
    padding-top: 0;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
}

.adi-calc-details--hidden {
    display: none;
}

.adi-calc-details__heading {
    font-size: 2rem;
}

.adi-calc-details__table {
    width: 100%;
    margin-bottom: 1rem;
}

.adi-calc-details__table[class] td {
    border: none;
    padding: 0;
    font-size: 0.875rem;
}

.adi-calc-details__table[class] tr td:last-child {
    text-align: right;
}

.adi-calc-details__button {
    margin: 1rem auto 0;
    justify-content: center;
}


.adi-form-control {
    margin-bottom: 1rem;
}

.adi-form-control label {
    font-weight: bold;
}

.adi-form-control input[type="number"],
.adi-form-control input[type="text"],
.adi-form-control input[type="email"] {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-gray);
    font-size: 1rem;
    margin-top: 0.5rem;
}

.adi-calc-details__contact {
    padding-top: 1rem;
    border-top: 1px solid var(--border-gray);
}

.adi-calc-details__contact .adi-form-control input {
    background: var(--white);
}

.adi-calc-details__contact-2-col {
    display: grid;
    grid-template-columns: 1fr;
}


@media (min-width: 768px) {
    .adi-calc {
        grid-template-columns: 5fr 7fr;
    }

    .adi-calc-visual-radio {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
        padding: 1rem;
    }

    .adi-calc-details__contact-2-col {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}

@media (min-width: 1024px) {
    .adi-calc {
        gap: 2rem;
    }

    .adi-calc-details {
        padding: 3rem;
    }
}

@media (min-width: 1200px) {
    .adi-calc {
        gap: 4rem;
    }
}