/* Slider editor responsive styles */

body {
    color: var(--white);
}

main {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    box-sizing: border-box;
}

main h2 {
    margin: 32px 0;
    line-height: 1.3;
}

/* Main preview */
.slider-cnt {
    width: 100%;
    height: clamp(260px, 32vw, 464px);
    min-height: 260px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    background: var(--background-secondary);
    border: 1px solid var(--border-cl);
    touch-action: pan-y;
}

.slider-btn {
    width: 56px;
    height: 100%;
    padding: 0;
    position: absolute;
    top: 50%;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, .22);
    stroke: #fff;
    transition: .2s ease-in-out;
    cursor: pointer;
}

.slider-btn:hover {
    background-color: rgba(0, 0, 0, .45);
    stroke: var(--main-cl);
}

.slider-btn:focus-visible {
    outline: 2px solid var(--main-cl);
    outline-offset: -2px;
}

#forward-btn {
    left: 0;
}

#backward-btn {
    right: 0;
}

.slider-cnt .slider {
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform .3s ease-in-out;
    will-change: transform;
}

.slider-cnt .poster {
    width: 100%;
    height: 100%;
    flex: 0 0 100%;
    position: relative;
}

.slider-cnt img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    object-fit: cover;
}

/* Upload slide */
#drop-area {
    width: 100%;
    height: 100%;
    display: block;
    box-sizing: border-box;
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border-cl);
    background-color: var(--background-secondary);
    flex: 0 0 100%;
    cursor: pointer;
}

#input-file {
    display: none;
}

.image-view {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border-radius: 12px;
    border: 2px dashed var(--main-cl);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    overflow: hidden;
}

.image-view p {
    margin: 12px 0 0;
    line-height: 1.7;
}

.image-view .icon {
    display: flex;
}

/* Editor thumbnails */
.editor {
    width: 100%;
    min-height: 128px;
    box-sizing: border-box;
    background-color: var(--background-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-cl);
    margin-top: 16px;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.editor .poster {
    min-width: 0;
    height: 128px;
    border-radius: 8px;
    overflow: hidden;
    cursor: grab;
    position: relative;
    user-select: none;
    touch-action: none;
    border: 1px solid transparent;
}

.editor .poster:active {
    cursor: grabbing;
}

.editor .delete-btn {
    width: 34px;
    height: 34px;
    background-color: var(--red);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px;
    border: 0;
    border-radius: 6px;
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 5;
    cursor: pointer;
}

.editor .delete-btn:hover {
    filter: brightness(1.1);
}

.editor .poster.selected {
    opacity: .45;
    cursor: grabbing;
    border-color: var(--main-cl);
}

.editor .poster.drag-over {
    border-color: var(--main-cl);
    transform: scale(.98);
}

.editor .poster img {
    display: block;
    height: 100%;
    width: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Save */
button[type="submit"] {
    min-height: 48px;
    width: 100%;
    text-align: center;
    border: 0;
    border-radius: 12px;
    background-color: var(--main-cl);
    color: var(--white);
    padding: 10px 32px;
    font-weight: 600;
    font-size: 18px;
    display: block;
    margin: 32px 0 0 auto;
    cursor: pointer;
    transition: .2s ease;
}

/* Indicators */
.slider-indicators {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 5px;
    max-width: calc(100% - 100px);
    overflow: hidden;
}

.slider-indicators .indicator {
    width: 32px;
    height: 4px;
    flex: 0 0 32px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, .3);
    transition: background-color .2s ease-in-out, transform .2s ease-in-out;
}

.slider-indicators .indicator.active {
    background-color: #fff;
    transform: scaleY(1.25);
}

/* Tablets */
@media (max-width: 900px) {
    main h2 {
        margin: 24px 0;
        font-size: 28px;
    }

    .slider-cnt {
        height: min(56vw, 420px);
        min-height: 240px;
    }

    .editor {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .editor .poster {
        height: 120px;
    }
}

/* Phones */
@media (max-width: 600px) {
    main {
        width: 100%;
    }

    main h2 {
        margin: 18px 0;
        font-size: 22px;
        border-right-width: 4px;
        padding-right: 8px;
    }

    .slider-cnt {
        height: 56vw;
        min-height: 190px;
        max-height: 320px;
        border-radius: 12px;
    }

    .slider-cnt img,
    .slider-cnt .poster,
    #drop-area {
        border-radius: 12px;
    }

    .slider-btn {
        width: 42px;
        background-color: rgba(0, 0, 0, .3);
    }

    .slider-btn svg {
        width: 20px;
        height: 20px;
    }

    #drop-area {
        padding: 10px;
    }

    .image-view {
        border-radius: 9px;
        padding: 12px;
    }

    .image-view .icon svg {
        width: 44px;
        height: 44px;
    }

    .image-view p {
        font-size: 13px;
        margin-top: 8px;
    }

    .slider-indicators {
        bottom: 14px;
        gap: 3px;
        max-width: calc(100% - 76px);
    }

    .slider-indicators .indicator {
        width: 20px;
        flex-basis: 20px;
        height: 3px;
    }

    .editor {
        padding: 10px;
        gap: 10px;
        margin-top: 12px;
        border-radius: 12px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .editor .poster {
        height: 100px;
        border-radius: 7px;
    }

    .editor .delete-btn {
        width: 30px;
        height: 30px;
        top: 4px;
        right: 4px;
        padding: 3px;
    }

    .editor .delete-btn svg {
        width: 19px;
        height: 19px;
    }

    button[type="submit"] {
        width: 100%;
        margin: 20px 0 0;
        min-height: 48px;
        font-size: 16px;
    }
}

/* Very small phones */
@media (max-width: 380px) {
    .slider-cnt {
        height: 58vw;
        min-height: 175px;
    }

    .editor {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 8px;
    }

    .editor .poster {
        height: 86px;
    }

    .image-view p {
        font-size: 12px;
    }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    .slider-cnt .slider,
    .slider-indicators .indicator,
    .slider-btn,
    button[type="submit"] {
        transition: none;
    }
}