/* @import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap'); */

:root {
    --font-family: 'Lato', sans-serif;
    --main-color: #2f2246;
    --secondary-color: #423062;
    --third-color: #9388A5;
    --accent-color: #89A4FF;
}

*,
:after,
:before {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
}

.button {
    font-family: var(--font-family);
    background-color: var(--main-color);
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    padding: 10px 20px;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    line-height: 1.1;

    &:hover {
        background-color: var(--secondary-color);
    }
}

.button-white {
    background-color: white;
    border: 2px solid var(--main-color);
    border-radius: 5px;
    color: var(--main-color);
    cursor: pointer;
    padding: 5px 10px;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;

    &:hover {
        color: var(--secondary-color);
        border-color: var(--secondary-color);
    }
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    color: black;
    border: none;
    border-radius: 50%;
    font-size: 1.9rem;
    width: 60px;
    height: 60px;
    padding-left: 6px;
    padding-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;

    &:hover {
        opacity: 1;
    }

    &:focus {
        outline: none;
    }
}

.copy-button {
    font-family: var(--font-family);
    background-color: var(--main-color);
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    padding: 8px 20px;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    line-height: 1.1;
    width: 100%;

    &:hover {
        background-color: var(--secondary-color);
    }

    &.active {
        background-color: var(--accent-color);
    }

    &.active-white {
        background-color: white;
        color: black;
    }
}

.remove-button {
    display: inline-block;
    margin-top: 5px;
    width: 100%;
    border: 1px solid wheat;
    color: red;
    border-radius: 5px;
    padding: 2px;
    background-color: wheat;

    &:hover {
        background-color: darkred;
        color: white;
    }
}

.title {
    font-weight: 700;
}

.main {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.top-banner {
    background: var(--main-color);
    color: white;
    padding: 10px;
    text-align: center;
    width: 100%;
}

a {
    text-decoration: none;
}

.top-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    position: sticky;
    background: white;
    box-shadow: 0 1px 2px 0 rgba(50, 50, 50, .4);
    width: 100%;
    z-index: 101;
    height: 60px;
    top: 0;

    .top-nav-content {
        position: relative;
        padding: 10px;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        max-width: 550px;
        margin: 0 auto;
        width: 100%;

        >*:not(.logo) {
            margin: 0 8px;
        }

        a {
            color: var(--main-color);
            white-space: nowrap;
            flex-shrink: 0;

            &:hover {
                background-color: var(--main-color);
                color: white;
            }
        }

        .logo {
            max-height: 40px;

            img {
                max-height: 40px;
            }
        }

        .logo+a {
            margin-left: 25px;
        }

        .dropdown {
            display: flex;
            flex: 1 1;
            justify-content: flex-end;

            .dropdown-toggle {
                display: none;
                cursor: pointer;
                color: var(--main-color);
                height: 40px;
                align-items: center;

                &:hover {
                    color: var(--secondary-color);
                }
            }

            .dropdown-content {
                display: none;
                position: absolute;
                top: 60px;
                right: 0;
                background-color: #fff;
                border: 1px solid #ccc;
                min-width: 200px;

                &.active {
                    display: block;
                }

                a {
                    display: none;
                    padding: 10px 20px;
                }
            }
        }
    }
}

/* logged in ellipsis handling */
@media (max-width: 500px) {
  .top-nav.logged-in .top-nav-content > a:nth-last-of-type(1) {
    display: none;
  }
  .top-nav.logged-in .top-nav-content .dropdown-content > a:nth-last-of-type(1) {
    display: block;
  }
  .top-nav.logged-in .top-nav-content .dropdown .dropdown-toggle {
    display: flex;
  }
}
@media (max-width: 460px) {
  .top-nav.logged-in .top-nav-content > a:nth-last-of-type(2) {
    display: none;
  }
  .top-nav.logged-in .top-nav-content .dropdown-content > a:nth-last-of-type(2) {
    display: block;
  }
}
@media (max-width: 390px) {
  .top-nav.logged-in .top-nav-content > a:nth-last-of-type(3) {
    display: none;
  }
  .top-nav.logged-in .top-nav-content .dropdown-content > a:nth-last-of-type(3) {
    display: block;
  }
}
@media (max-width: 330px) {
  .top-nav.logged-in .top-nav-content > a:nth-last-of-type(4) {
    display: none;
  }
  .top-nav.logged-in .top-nav-content .dropdown-content > a:nth-last-of-type(4) {
    display: block;
  }
}

/* logged out ellipsis handling */
@media (max-width: 450px) {
  .top-nav.logged-out .top-nav-content > a:nth-last-of-type(1) {
    display: none;
  }
  .top-nav.logged-out .top-nav-content .dropdown-content > a:nth-last-of-type(1) {
    display: block;
  }
  .top-nav.logged-out .top-nav-content .dropdown .dropdown-toggle {
    display: flex;
  }
}
@media (max-width: 410px) {
  .top-nav.logged-out .top-nav-content > a:nth-last-of-type(2) {
    display: none;
  }
  .top-nav.logged-out .top-nav-content .dropdown-content > a:nth-last-of-type(2) {
    display: block;
  }
}
@media (max-width: 350px) {
  .top-nav.logged-out .top-nav-content > a:nth-last-of-type(3) {
    display: none;
  }
  .top-nav.logged-out .top-nav-content .dropdown-content > a:nth-last-of-type(3) {
    display: block;
  }
}
@media (max-width: 305px) {
  .top-nav.logged-out .top-nav-content > a:nth-last-of-type(4) {
    display: none;
  }
  .top-nav.logged-out .top-nav-content .dropdown-content > a:nth-last-of-type(4) {
    display: block;
  }
}

.content {
    padding: 40px 20px 40px;
    margin: 0 auto;
    text-align: center;
    flex: 1 1;
    /* max-width: 1024px; */
    width: 100%;
    position: relative;

    &.wide {
        max-width: 800px;
    }

    &::before {
        content: "";
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        background: url('/static/images/italy_cj.jpg');
        background-size: cover;
        background-color: #DFAF8C;
        opacity: 0.6;
        z-index: -1;
    }
}

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

    &>* {
        font-family: var(--font-family);
    }

    &>*:not([type="hidden"]):not(.hidden) + *:not([type="hidden"]):not(.hidden) {
        margin-top: 10px;
    }

    input {
        border: 1px solid #ccc;
        border-radius: 5px;
        font-size: 16px;
        padding: 10px;
        outline: none;

        &:focus {
            border-color: #999;
        }
    }

    textarea {
        border: 1px solid #ccc;
        border-radius: 5px;
        font-size: 16px;
        padding: 10px;
        max-width: 100%;
        min-width: 100%;
        outline: none;

        &:focus {
            border-color: #999;
        }
    }
}

.indicator-spinner.htmx-request {
    position: relative;
    /* opacity: 0.5; */
    background-color: var(--third-color);
}

.indicator-spinner.htmx-request .button-text {
    visibility: hidden;
    opacity: 0;
}

.indicator-spinner.htmx-request::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    border: 4px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spinner 1s ease infinite;
}

@keyframes spinner {
    from {
        transform: rotate(0turn);
    }

    to {
        transform: rotate(1turn);
    }
}

.error {
    color: red;
}

.progress {
    position: relative;
    overflow: hidden;

    .bar {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 0;
        background: var(--accent-color);
        border-radius: 5px;
        transition: height 0.3s ease-in;
        z-index: 0;

        .wave {
            position: absolute;
            left: 0;
            width: 200%;
            height: 16px;
            bottom: calc(100% - 8px);
            fill: var(--accent-color);
            opacity: 0.95;
            animation: drift 3s linear infinite;
            will-change: transform;
            pointer-events: none;
        }

        .wave2 {
            opacity: 0.7;
            animation-duration: 4.6s;
            animation-direction: reverse;
            bottom: calc(100% - 10px);
        }
    }

    .text {
        position: relative;
        z-index: 1;
    }
}

@keyframes drift {
  to { transform: translateX(-50%); }
}

.subscription-plans {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;

    .item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin: 0 5px;
        min-width: 150px;
        border: 2px solid grey;
        border-radius: 5px;
        padding: 10px;
        background: rgb(255, 255, 255, 0.75);

        &.active {
            border: 2px solid green;
        }

        .name {
            font-weight: 700;
        }

        .price {
            margin-top: 5px;
        }

        .description {
            margin-top: 10px;
        }

        .expires {
            margin-top: 10px;
        }

        .action-button {
            margin-top: 10px;
        }
    }
}

.urls {
    margin-top: 20px;

    .url {
        border: 1px solid var(--main-color);
        border-radius: 5px;
        padding: 10px;
        display: flex;
        background-color: rgb(255, 255, 255, 0.75);;

        &:nth-child(n+2) {
            margin-top: 20px;
        }

        &.expired {
            filter: grayscale(40%);
            opacity: 0.4;
        }

        .photo {
            flex: 0 0 56%;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(50%, 1fr));
            grid-auto-rows: 1fr;
            gap: 0;
            width: 56%;
            height: auto;
            margin-right: 10px;
            aspect-ratio: 1 / 0.65;

            img {
                width: 100%;
                height: 100%;
                object-fit: cover;
                min-height: 0;
            }
        }

        .content {
            display: flex;
            flex-direction: column;
            width: 100%;
            justify-content: space-between;
            padding: 0;

            .top {
                flex: 1;
                display: flex;
                align-items: center;

                .expires-in {
                    padding: 0 5px;
                    text-align: center;
                    width: 100%;
                    color: black;
                }
            }
        }
    }
}

.paginator {
    margin: 30px auto 0;
    display: flex;
    justify-content: space-between;
    width: 100%;

    .paginator-section {
        flex: 1;
        display: flex;
        justify-content: center;

        .navigator {
            min-width: 95px;
            color: var(--main-color);
            background-color: rgb(255, 255, 255, 0.75);;
            padding: 10px;
            border: 1px solid var(--main-color);
            border-radius: 5px;

            &:hover {
                color: var(--secondary-color);
            }
        }
    }
}

.footer {
    margin: 0 auto;
    padding: 20px;
    border-top: 1px solid #ccc;
    display: flex;
    justify-content: center;
    text-align: center;
    max-width: 100%;
    flex-wrap: wrap;
    width: 100%;

    a {
        padding: 5px 10px;
        white-space: nowrap;
        color: #aaa;

        &:hover {
            color: var(--main-color);
        }
    }
}

.hidden {
    display: none !important;
}

.underline {
    text-decoration: underline;
}

.full {
    width: 100%;
    max-width: 1024px;
    margin-left: auto;
    margin-right: auto;
}

.wide {
    width: 100%;
    max-width: 804px;
    margin-left: auto;
    margin-right: auto;
}

.normal {
    width: 100%;
    max-width: 604px;
    margin-left: auto;
    margin-right: auto;
}

.demo {
    margin: 40px auto 0;

    .rounds {
        .round {
            border: 1px solid var(--main-color);
            background-color: rgb(255, 255, 255, 0.75);
            border-radius: 5px;
            padding: 10px;

            &:nth-child(n+2) {
                margin-top: 10px;
            }

            .number {
                text-align: left;
            }

            .split {
                display: flex;
                justify-content: space-between;

                .kills {
                    margin-top: 10px;

                    .kill {
                        display: flex;

                        .id {
                            margin-right: 8px;
                        }

                        .details {
                            &:nth-child(n+2) {
                                margin-left: 10px;
                            }
                        }

                        .ct {
                            color: #3681c5;
                        }

                        .t {
                            color: #f0b412;
                        }
                    }
                }

                .create-button-block {
                    display: flex;
                    flex-direction: column;
                    justify-content: center;
                    align-items: center;
                    margin-top: -20px;
                    width: 50%;
                }
            }
        }
    }
}

.clips {
    margin-top: 20px;

    .clip {
        border: 1px solid var(--main-color);
        border-radius: 5px;
        padding: 10px;
        display: flex;
        background-color: rgb(255, 255, 255, 0.75);;

        &:nth-child(n+2) {
            margin-top: 20px;
        }

        &.expired {
            filter: grayscale(40%);
            opacity: 0.4;
        }

        .photo {
            flex: 0 0 56%;
            width: 56%;
            height: auto;
            margin-right: 10px;
            aspect-ratio: 16 / 9;

            img {
                width: 100%;
                height: 100%;
                object-fit: cover;
                min-height: 0;
            }
        }

        .second-block {
            display: flex;
            flex-direction: column;
            width: 100%;
            justify-content: space-between;
            padding: 0;

            .top {
                flex: 1;
                display: flex;
                flex-direction: column;
                justify-content: center;

                .item {
                    &.clip-title {
                        font-weight: 700;
                        font-size: 16px;
                    }

                    &:nth-child(n+2) {
                        margin-top: 7px;
                    }
                }
            }

            .bottom {
            }
        }
    }
}

.index-clips {
    margin-top: 40px;
    display: flex;
    justify-content: flex-start;
    position: relative;

    .clip {
        border: 1px solid var(--main-color);
        border-radius: 5px;
        padding: 10px;
        display: flex;
        flex-direction: column;
        background-color: rgb(255, 255, 255, 0.75);;
        width: 23%;
        justify-content: space-between;

        &:nth-child(n+2) {
            margin-left: 2.6667%;
        }

        &.expired {
            filter: grayscale(40%);
            opacity: 0.4;
        }

        .top {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;

            .item {
                &.clip-title {
                    font-weight: 700;
                    font-size: 16px;
                    line-height: 1.2;
                }

                &:nth-child(n+2) {
                    margin-top: 5px;
                }
            }
        }

        .bottom {
            margin-top: 10px;
            width: 100%;

            .photo {
                width: 100%;
                aspect-ratio: 16 / 9;
                display: block;

                img {
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                    min-height: 0;
                }
            }
        }
    }

    .index-paginator {
        position: absolute;
        transform: translateY(-50%);
        top: 50%;
        width: 100%;

        .paginator-section {
            position: absolute;
            top: 0;
            transform: translateY(-50%);

            &.next {
                right: -120px;
            }

            &.previous {
                left: -120px;
            }

            .navigator {
                display: block;
                min-width: 95px;
                color: var(--main-color);
                background-color: rgb(255, 255, 255, 0.75);;
                padding: 10px;
                border: 1px solid var(--main-color);
                border-radius: 5px;

                &:hover {
                    color: var(--secondary-color);
                }
            }
        }
    }
}

.demos {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;

    .item {
        border: 1px solid var(--main-color);
        border-radius: 5px;
        padding: 10px;
        display: flex;
        background-color: rgb(255, 255, 255, 0.75);;
        width: 70%;

        &:nth-child(n+2) {
            margin-top: 20px;
        }

        .left {
            flex: 0 0 56%;
            width: 56%;
            height: auto;
            margin-right: 10px;
            aspect-ratio: 16 / 9;

            img {
                width: 100%;
                height: 100%;
                object-fit: cover;
                min-height: 0;
            }
        }

        .right {
            display: flex;
            flex-direction: column;
            width: 100%;
            justify-content: center;
            padding: 0;

            .demo-title {
                font-weight: 700;
                font-size: 16px;

                a {
                    color: darkgreen;
                }
            }
        }
    }
}
