::-webkit-scrollbar {
    width: 20px;
}

::-webkit-scrollbar-track {
    background: linear-gradient(25deg, #6c4ce0,#3603ee,#000);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(905deg, #6c4ce0,#3603ee,#db3737);
}

body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;    
    background: url("../images/bg.jpg") no-repeat center / cover;
    overflow-y: scroll;
}

.square {
    position: absolute;
    background: rgba(40, 40, 110, 0.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur( 12px );
    border-radius: 16px;
    border: 1px solid rgba( 255, 255, 255, 0.18 );
    animation: move 10s linear infinite;
    animation-delay: calc(-1s * var(--i));
}

.square:nth-child(1) {
    top: -50px;
    right: -60px;
    width: 100px;
    height: 100px;
}

.square:nth-child(2) {
    top: 150px;
    left: -100px;
    width: 120px;
    height: 120px;
    z-index: 2;
}

.square:nth-child(3) {
    bottom: 50px;
    right: -60px;
    width: 80px;
    height: 80px;
    z-index: 2;
}

.square:nth-child(4) {
    bottom: -50px;
    left: 100px;
    width: 50px;
    height: 50px;
}

.square:nth-child(5) {
    top: -80px;
    left: 140px;
    width: 60px;
    height: 60px;
}

@keyframes move {
    0%, 100% {
        transform: translateY(-40px);
    }
    50% {
        transform: translateY(40px);
    }
}

.flip-card {
    position: relative;
    perspective: 1000px;
}

.flip-form-left,
.flip-form-right {
    position: relative;
    transition: transform 2s;
    transform-style: preserve-3d;
}

.flip-card .flip-form-left {
    transform: rotateY(180deg) !important;
}

.flip-card .flip-form-right {
    transform: rotateY(360deg) !important;
}

.flip-card #age-calc.flip-form-right{
    transform: rotateY(0deg) !important;
}

.container {
    text-align: center;
    color: #fff;
    background: rgba(40, 40, 110, 0.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur( 6px );
    border-radius: 16px;
    border: 1px solid rgba( 255, 255, 255, 0.18 );
}

.header {
    font-family: cursive;
    font-size: 34px;
    margin-bottom: 20px;
}

/* Form */
#age-calc{
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transform: rotateY(0deg);
}

.calculator{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    max-width: 500px;
    height: 100%;
    margin: 0 auto;
    padding: 20px;
}

.calculator form{
    width: 100%;
}

.input-group {
    margin-bottom: 20px;
}

.input-group input[type="date"] {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    color: white;
    background: linear-gradient(90deg, #03a9f4, #f441a5, #ffeb3b, #03a9f4);
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* Response */
#response {
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transform: rotateY(180deg);
}

.info-box{
    padding: 30px;
}

.age {
    display: flex;
    justify-content: space-evenly;
    margin-bottom: 20px;
}

.input-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.input-field input {
    text-align: center;
    color: white;
    width: 100%;
    padding: 20px 0px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.dob {
    margin-bottom: 20px;
}

.dob p {
    display: inline-block;
    margin-right: 10px;
}

.results {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 20px;
}

.total-years,
.total-months,
.total-weeks,
.total-days,
.total-hours,
.total-minutes,
.total-seconds {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-bottom: 10px;
    text-align: center;
}

.next-birthday {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-bottom: 30px;
    text-align: center;
}

button {
    text-decoration: none;
    position: relative;
    border: none;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    color: #fff;
    width: 9em;
    height: 3em;
    line-height: 2em;
    text-align: center;
    background: linear-gradient(90deg, #03a9f4, #f441a5, #ffeb3b, #03a9f4);
    background-size: 300%;
    border-radius: 30px;
    z-index: 1;
}

button:hover {
    animation: btn_hover 8s linear infinite;
    border: none;
}

@keyframes btn_hover {
    0% {
        background-position: 0%;
    }

    100% {
        background-position: 400%;
    }
}

button:before {
    content: "";
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    z-index: -1;
    background: linear-gradient(90deg, #03a9f4, #f441a5, #ffeb3b, #03a9f4);
    background-size: 400%;
    border-radius: 35px;
    transition: 1s;
}

button:hover::before {
    filter: blur(20px);
}

button:active {
    background: linear-gradient(32deg, #03a9f4, #f441a5, #ffeb3b, #03a9f4);
}

.sign{
    color: #fefefe;
    font-size: 15px;
    font-style: italic;
    margin-top:20px;
}
  
/* Media query */
@media screen and (max-width: 768px) {
    .flip-card{
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 75%;
        height: 75%;
        margin: auto;
    }

    #age-calc{
        height: inherit;
    }

    #form{
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .header{
        font-size: unset;
    }

    .input-group {
        width: 75%;
    }
}

@media screen and (max-width: 425px) {
    .square{
        display: none;
    }

    .flip-card{
        width: 100%;
        height: 100%;
        margin: 0;
    }

    .calculator{
        padding:0;
    }

    #form{
        justify-content: flex-end;
        height: 50%;
    }

    .input-group input[type="date"] {
        padding-left: 2px !important;
        padding-right: 2px !important;
    }

    .total-seconds{
        width: 100%;
    }
}


@media screen and (max-width: 375px) {
    #form{
        height: unset;
    }

    .results *{
        width: 100%;
    }

    button{
        margin-bottom: 20px ;
    }
}

@media screen and (max-width: 320px) {
    button{
        margin-left: 0 !important;
    }
}