@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);
}

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

.instructions-wrapper {
    position: relative;
    display: inline-block;
}

.instructions {
    font-weight: bold;
    cursor: help;
}

.tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    margin-top: 6px;
    background: #222;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    width: max-content;
    max-width: 400px;
    transform: translate(-50%);
    z-index: 999;
}

.tooltip ul {
    margin: 0;
    padding-left: 18px; /* aligns bullets nicely */
    list-style: none;
}

.instructions-wrapper:hover .tooltip {
    display: block;
}

.box-with-white-bg {
    background-color: rgb(255,255,255,0.8);
    border-radius: 5px;
    padding: 15px;
    border: 1px solid var(--main-color);

    &.grey-border {
        border: 1px solid grey;
    }
}

.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/carxscreens-bg.jpeg');
        background-size: cover;
        background-color: #948f8e;
        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: 20px auto 0;
    display: flex;
    justify-content: space-between;
    width: 100%;

    .paginator-section {
        margin: 0 5px;

        .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);
            }
        }
    }
}

.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 {
        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;
}

.bigger-than-small { /* lol */
    width: 100%;
    max-width: 475px;
    margin-left: auto;
    margin-right: auto;
}

.small {
    width: 100%;
    max-width: 422.8px;
    margin-left: auto;
    margin-right: auto;
}

.index-images {
    margin-top: 25px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 15px;

    .image {
        position: relative;
        border-radius: 5px;
        display: flex;
        flex-direction: column;
        background-color: #898483;
        width: 100%;

        .photo {
            width: 100%;
            aspect-ratio: 16 / 9;
            display: block;
            height: auto;
            object-fit: cover;
            border-radius: 5px;
            background-color: #898483;
        }

        .text {
            color: white;
            display: flex;
            align-items: center;
            padding: 0 10px;
            justify-content: space-between;

            .upvotes {
                cursor: pointer;
                display: flex;
                align-items: center;

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

                    svg {
                        fill: var(--main-color);
                    }
                }

                &.upvoted {
                    color: var(--main-color);

                    svg {
                        fill: var(--main-color);
                    }
                }
            }

            .report {
                cursor: pointer;
                display: flex;
                align-items: center;

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

                    svg {
                        fill: var(--main-color);
                    }
                }
            }

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

            .map-name {
                font-size: 14px;
                font-style: italic;
            }
        }
    }
}

.back, .next, .previous {
    cursor: pointer;
    display: block;
    color: var(--main-color);
    background-color: rgb(255, 255, 255, 0.75);;
    padding: 10px 20px;
    border: 1px solid var(--main-color);
    border-radius: 5px;

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

    &.previous {
        position: absolute;
        font-size: 14px;
        top: 78px;

        @media (max-width: 525px) {
            position: initial;
        }
    }

    &.next {
        display: inline-block;
        font-size: 14px;
    }
}

@media (max-width: 770px) {
    .index-images {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 570px) {
    .index-images {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 451px) {
    .index-images {
        grid-template-columns: repeat(1, 1fr);
    }
}

.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: 100%;

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

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

        .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;
                color: darkgreen;

                a {
                    color: darkgreen;
                }
            }
        }
    }
}

#upload-status {
    background-color: green;
    height: 10px;
    width: 20px;
    position: absolute;
    display: none;
}

.image {
    margin: 0 auto;
    border-radius: 5px;

    img {
        max-width: 100%;
        max-height: calc(67vh);
        width: auto;
        height: auto;
        border-radius: 5px;
        object-fit: contain;
        display: block;
        margin: 0 auto;
    }
}

.zoom-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.80);
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 20px; /* this creates the 10px edge padding */
    cursor: zoom-out;
}

.zoom-overlay img {
    width: calc(100vw - 40px);
    height: calc(100vh - 40px);
    object-fit: contain;
    display: block;
}

/* .image img { */
/*     cursor: zoom-in; */
/* } */
