@use '../../../styles/variables' as *;
@use '../../../styles/mixins' as *;

.awt-gallery {
    position: relative;
    width: 100%;
    padding-top: 6rem;
    padding-bottom: 6rem;
    background-color: var(--awt-gallery-bg, transparent);
    box-sizing: border-box;

    *,
    *::before,
    *::after {
        box-sizing: inherit;
    }

    &__container {
        @include awt-container;
    }

    &__title {
        font-family: $awt-font-sans;
        font-size: clamp(2rem, 5vw, 3rem);
        font-weight: 900;
        text-align: center;
        color: var(--awt-gallery-heading, $awt-color-navy);
        line-height: 1.2;
        margin: 0 0 3rem 0;
    }

    &__grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;

        @include md {
            grid-template-columns: repeat(var(--awt-gallery-cols, 4), minmax(0, 1fr));
            gap: 1.5rem;
        }
    }

    &__item {
        position: relative;
        overflow: hidden;
        border-radius: $awt-radius-lg;
        box-shadow: $awt-shadow-lg;
        aspect-ratio: 1 / 1;
        transition: transform $awt-transition-normal, box-shadow $awt-transition-normal;

        &:nth-child(even):hover {
            transform: rotate(2deg) scale(1.05);
            box-shadow: $awt-shadow-2xl;
        }

        &:nth-child(odd):hover {
            transform: rotate(-2deg) scale(1.05);
            box-shadow: $awt-shadow-2xl;
        }

        &:hover {
            .awt-gallery__delete-btn {
                opacity: 1;
            }
        }
    }

    &__image {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    &__delete-btn {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        background-color: #ef4444;
        color: #ffffff;
        border: none;
        border-radius: $awt-radius-full;
        width: 2rem;
        height: 2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.125rem;
        line-height: 1;
        cursor: pointer;
        opacity: 0;
        transition: opacity $awt-transition-fast, background-color $awt-transition-fast;
        z-index: 10;

        &:hover {
            background-color: #dc2626;
        }
    }

    &__empty {
        text-align: center;
        padding: 5rem 2rem;
        background-color: #f1f5f9;
        border-radius: $awt-radius-lg;
    }

    &__empty-text {
        color: #64748b;
        margin-bottom: 1rem;
    }
}
