* {
    margin: 0;
    padding: 0;
    user-select: none;
    transition: ease-in;
    /* transition-duration: 0.1s; */
    -ms-overflow-style: none;
    /* Internet Explorer 10+ */
    scrollbar-width: none;
    /* Firefox, Safari 18.2+, Chromium 121+ */
    word-spacing: 2px;

    *::-webkit-scrollbar {
        display: none;
        /* Older Safari and Chromium */
    }
}

@keyframes growAndShake {
    0% {
        transform: scale(1);
    }

    20% {
        transform: scale(1.1);
    }

    40% {
        transform: scale(1.2) rotate(-5deg);
    }

    60% {
        transform: scale(1.2) rotate(5deg);
    }

    80% {
        transform: scale(1.1) rotate(-3deg);
    }

    100% {
        transform: scale(1);
    }
}

.animate {
    animation: growAndShake 0.6s ease;
}

:root {
    --transparent-black: #21252980;
    --transparent-white: #ffffff80;
    --black75: #212529e3;
    --black: #212529fa;
    --white: #fffffffa;
    --purple: #6c49ec;
    --blue: #2EC0F9;
    --lime: #8EC622;
    --orange: #FAA307;
    --sky: #4CC9F0;
    --yellow: #F7D002;
    --red: #fe245b;
    --pink: #FF006E;
    --ice: #487EF2;
    --sea: #2ABE9D;
    --green: #53DD6C;
    --darkgreen: #1b4332;
    --lightgray: #F1F3F5;
    --silver: #E0E2E5;
    --invalid: #f22c5e3c;

    --countdown-font-size: 72px;
    --countdown-label-size: 16px;
    --countdown-icon-size: 200px;
    --countdown-timer-gap-size: 48px;
    --countdown-gap: 8px;
    --countdown-text-color: var(--black);
    --icon-size: 24px;

    --horizontal-padding: 24px;
    --vertical-padding: 72px;
    --resources-gap: 48px;
    --content-alignment: center;
    --content-width: 600px;
    --customization-width: 600px;

    --modal-width: 400px;
}

body {
    position: relative;
}

.icon:hover {
    scale: 1.1;
}

h1,
p {
    font-optical-sizing: auto;
    text-align: center;
}

h1 {
    font-size: calc(var(--countdown-font-size) - 12px);
}

.hidden {
    display: none !important;
}

button {
    border: none;
    padding: 8px 24px 8px 20px;
    font-family: "Rubik", sans-serif;
    font-weight: 500;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;

    &:disabled {
        cursor: auto;
        background-color: var(--lightgray);
    }

    &.submit {
        background-color: var(--green);
        padding: 8px 36px 8px 24px;
        color: var(--black);

        &:disabled {
            background-color: var(--silver);
        }
    }
}

.link-with-icon {
    display: flex;
    align-items: flex-start;
}

a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: unset;
    border-bottom: 3px dotted transparent;
    gap: 4px;

}

a:hover {
    border-bottom: 3px dotted unset;
}

.icon {
    color: var(--black);
    width: var(--icon-size);
    cursor: pointer;

    &:hover {
        opacity: 1;
    }
}

.icon-with-helper {
    display: flex;
    position: relative;
    background-color: transparent;
    padding: 0;

    .hint {
        color: var(--black);
        font-family: "Rubik", sans-serif;
        font-weight: 700;
        font-size: 12px;
        position: absolute;
        right: 36px;
        display: none;
        white-space: nowrap;
    }

    .icon:hover+.hint {
        display: block !important;
    }
}

/* General countdown styles */
.countdown-container {
    width: calc(100vw - var(--horizontal-padding) * 2);
    height: calc(100vh - var(--horizontal-padding) * 2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--countdown-gap);
    padding: var(--horizontal-padding);

    word-spacing: 4px;
}

.countdown-title {
    color: var(--countdown-text-color);
    font-family: "Rubik", sans-serif;
    font-weight: 800;
    font-size: var(--countdown-font-size);
    text-align: center;
}

.countdown-icon {
    cursor: pointer;
    margin-bottom: 8px;
    width: var(--countdown-icon-size);
    filter: drop-shadow(0px 0px 0.4px var(--transparent-black));
    z-index: 100;

}

.countdown-timer {
    display: flex;
    gap: var(--countdown-timer-gap-size);
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    font-family: "Rubik", sans-serif;
    font-weight: 800;
    color: var(--countdown-text-color);

    .unit {
        display: flex;
        flex-direction: column;
        width: calc(var(--countdown-font-size) / 100 * 72 * 2);
        align-items: center;

        .digit {
            font-size: var(--countdown-font-size);
            width: 100%;
            display: flex;
            justify-content: center;

            span {
                width: 50%;
                display: flex;
                justify-content: start;

                &.to-left {
                    margin-left: calc(var(--countdown-font-size) / -8);
                    margin-right: calc(var(--countdown-font-size) / 8);
                }

                &.to-right {
                    margin-right: calc(var(--countdown-font-size) / -8);
                    margin-left: calc(var(--countdown-font-size) / 8);
                }
            }

            span:first-child {
                width: 50%;
                display: flex;
                justify-content: end;
            }
        }


        p.label {
            font-size: var(--countdown-label-size);
        }

        &.short {
            width: calc(var(--countdown-font-size) / 100 * 72);

            .digit span {
                width: 100%;
                justify-content: center;
            }
        }
    }
}

p.countdown-date {
    color: var(--countdown-text-color);
    font-family: "Rubik", sans-serif;
    font-weight: 800;
    font-size: calc(var(--countdown-label-size) * 1.2);
    padding: calc(var(--countdown-label-size) * 1.2) 0;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    font-family: "Rubik", sans-serif;
    font-weight: 700;
    position: fixed;
    top: 0;
    width: calc(100vw - var(--horizontal-padding) * 2);
    padding: var(--horizontal-padding);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;

    nav {
        color: var(--countdown-text-color);

        svg {
            fill: var(--countdown-text-color);
        }

        a:hover {
            border-color: var(--countdown-text-color);
        }
    }

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

        svg {
            fill: var(--countdown-text-color);
        }
    }

    .panel {
        display: flex;
        gap: 24px;
        color: var(--countdown-text-color);

    }
}

body.fullscreen {

    header,
    footer,
    .info,
    .icon.fullscreen {
        display: none;
    }

}

/* Footer */
footer {
    width: calc(100vw - var(--horizontal-padding) * 2);
    padding: 96px var(--horizontal-padding) 24px var(--horizontal-padding);
    background-color: var(--black);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 84px;

    .rights {
        font-family: "Rubik", sans-serif;
        font-weight: 200;
        font-size: 14px;
        color: var(--transparent-white);
    }
}

footer .resources,
main .resources {
    max-width: 800px;
    display: flex;
    flex-wrap: wrap;
    justify-content: var(--content-alignment);
    gap: 16px var(--resources-gap);

    .link-with-icon:hover {
        svg {
            fill: var(--blue);
        }
    }

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

    a {
        font-family: "Rubik", sans-serif;
        font-weight: 400;

        color: var(--white);
    }

    a:hover {
        color: var(--blue);
        border-color: var(--blue);
    }
}

/* Artcile */
.info {
    width: calc(100vw - var(--horizontal-padding) * 2);
    padding: var(--vertical-padding) var(--horizontal-padding);
    background-color: var(--white);
    font-family: "Rubik", sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 48px;


    article {
        * {
            user-select: text;
        }

        max-width: var(--content-width);

        h2 {
            margin-bottom: 24px;
            color: var(--black);
            font-weight: 600;

            img {
                margin-top: 2px;
                margin-right: 8px;
                height: 24px;
                float: left;
            }
        }

        p {
            font-weight: 400;
            margin-bottom: 8px;
            text-align: justify;
            color: var(--black75);
            font-size: 16px;
            line-height: 28px;
        }
    }
}

/* Customization */
.customization {
    width: calc(100vw - var(--horizontal-padding) * 2);
    padding: var(--horizontal-padding);
    background-color: var(--white);
    font-family: "Rubik", sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;

    .fields {
        width: 100%;
        max-width: var(--customization-width);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 12px;
    }

    h2.title {
        font-size: 18px;
        font-weight: 600;
        color: var(--black75);
    }

    .title-selection,
    .date-selection,
    .theme-selection,
    .icon-selection {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 4px 0;
    }

    .input-wrapper {
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
    }

    input {
        background-color: var(--lightgray);
        border: 2px solid transparent;
        border-radius: 4px;
        padding: 8px 16px;
        font-size: 16px;
        font-family: "Rubik", sans-serif;
        font-weight: 500;
        outline: none;
    }

    input.invalid {
        border: 2px solid var(--red);
    }

    input[type="radio"] {
        display: none;
    }

    input[type="radio"]:checked+label {
        scale: 1.1;
        cursor: auto;

        .check {
            display: block;
        }
    }

    .theme-selection {
        .theme-options {
            display: flex;
            justify-content: unset;
            gap: 8px;

            label {
                cursor: pointer;
                display: flex;
                align-items: center;
                justify-content: center;
                width: 24px;
                height: 24px;
                border-radius: 50%;
                border: 2px solid transparent;

                .check {
                    fill: var(--white);
                    display: none;
                    scale: 1;

                }
            }

            label[for="purple"] {
                background-color: var(--purple);
            }

            label[for="pink"] {
                background-color: var(--pink);
            }

            label[for="red"] {
                background-color: var(--red);
            }

            label[for="orange"] {
                background-color: var(--orange);
            }

            label[for="yellow"] {
                background-color: var(--yellow);
            }

            label[for="lime"] {
                background-color: var(--lime);
            }

            label[for="green"] {
                background-color: var(--green);
            }

            label[for="sea"] {
                background-color: var(--sea);
            }

            label[for="blue"] {
                background-color: var(--blue);
            }

            label[for="ice"] {
                background-color: var(--ice);
            }

            label[for="black"] {
                background-color: var(--black);
            }

            label[for="silver"] {
                background-color: var(--silver);
            }

        }
    }

    .icon-options {
        display: flex;
        align-items: center;
        align-items: flex-start;
        gap: 8px;
        width: 100%;
        /* fixed width */
        overflow-y: hidden;
        /* enables vertical scrolling */
        overflow-x: scroll;
        scroll-snap-type: x mandatory;
        /* hides horizontal scroll */

        img {
            padding: 8px;
            border-radius: 4px;
            background-color: transparent;
        }

        .event-icon {
            width: 40px;
        }

        label {
            cursor: pointer;
        }

        input[type="radio"]:checked+img {
            background-color: var(--lightgray);
        }
    }

    .buttons {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
        gap: 16px;
        padding-top: 24px;

    }
}


/* Edit mode */
body.edit-mode {
    main {
        height: min-content;
    }

    .countdown-container {
        height: unset;
        padding: 16px 0;

        .countdown-timer {
            gap: 16px;

            .unit {
                width: calc(36px / 100 * 72 * 2);
            }

            p.label {
                font-size: 12px;
            }
        }

        .countdown-icon {
            width: 160px;
        }

        .countdown-title,
        .countdown-timer .digit {
            font-size: 36px;
        }
    }

    header,
    footer,
    .info {
        display: none;
    }

    .icon.fullscreen {
        display: none;
    }
}


/* Smaller screens */
@media (max-width: 1200px) {
    :root {
        --countdown-font-size: 56px;
        --countdown-icon-size: 160px;
        --countdown-timer-gap-size: 36px;
        --countdown-label-size: 14px;

    }
}

@media (max-width: 750px) {
    :root {
        --countdown-font-size: 36px;
        --countdown-icon-size: 120px;
        --countdown-timer-gap-size: 24px;
        --countdown-label-size: 12px;
        --vertical-padding: 48px;
        --resources-gap: 24px;
        --content-alignment: center;
        --horizontal-padding: 24px;
        --modal-width: 320px;
    }

    .theme-selection {
        .theme-options {
            justify-content: space-between !important;
            gap: unset !important;

            label {
                width: 20px !important;
                height: 20px !important;
            }
        }
    }
}

/* Color decorations */

main {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;

    .icon-with-helper {
        position: absolute;
        right: var(--horizontal-padding);
        bottom: var(--horizontal-padding);
    }
}

main.purple,
main.pink,
main.red,
main.black {

    .countdown-title,
    .countdown-timer,
    .countdown-date,
    .hint {
        color: var(--white) !important;
    }

    svg {
        fill: var(--white) !important;
    }

}

header.purple,
header.pink,
header.red,
header.black {

    nav {
        color: var(--white) !important;

        svg {
            fill: var(--white) !important;
        }

        a:hover {
            border-color: var(--white) !important;
        }
    }

    .controls {

        svg {
            fill: var(--white) !important;
        }
    }

    .panel {
        color: var(--white) !important;

    }

    .hint {
        color: var(--white) !important;
    }
}

main.purple,
header.purple,
body.purple {
    background-color: var(--purple);
}

main.pink,
header.pink,
body.pink {
    background-color: var(--pink);
}

main.red,
header.red,
body.red {
    background-color: var(--red);
}

main.orange,
header.orange,
body.orange {
    background-color: var(--orange);
}

main.yellow,
header.yellow,
body.yellow {
    background-color: var(--yellow);
}

main.lime,
header.lime,
body.lime {
    background-color: var(--lime);
}

main.green,
header.green,
body.green {
    background-color: var(--green);
}

main.sea,
header.sea,
body.sea {
    background-color: var(--sea);
}

main.blue,
header.blue,
body.blue {
    background-color: var(--blue);
}

main.ice,
header.ice,
body.ice {
    background-color: var(--ice);
}

header.black {
    background-color: rgb(47, 50, 53);
}

main.black,
body.black {
    background-color: var(--black);
}

main.silver,
header.silver,
body.silver {
    background-color: var(--silver);
}

main.home {
    width: calc(100vw - var(--horizontal-padding) * 2);
    height: calc(100vh - var(--horizontal-padding) * 2);
    padding: var(--horizontal-padding);
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: "Rubik", sans-serif;
    color: var(--black);

    .resources {
        margin-top: 16px;
    }
    .resources a {
        color: var(--black);

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

        &:hover {
            border-color: var(--black);
            svg {
                fill: var(--black);
            }
        }
    }
}