@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap');
// VARIABLES

$purple: #6638F0;
$purple-dark: #4611e4;
$purple-gradient: linear-gradient(135deg, #6638F0 0%, #5CC9F5 100%);
$modal-gradient: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
$white: #FFF;
$heading-color: #282828;
$body-color: #555;
$shadow: rgba(0, 0, 0, 0.1) 0px 4px 4px;
$modal-shadow: rgba(0, 0, 0, 0.2) 0px 10px 30px;

$font-family: 'Poppins', sans-serif;
$border-radius: 0.5rem;
$transition: all 0.3s ease;

// MIXINS

@mixin flex-center($direction: row) {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: $direction;
}

@mixin flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@mixin text-overflow {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: visible;
}

@mixin button-base {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: $border-radius;
    background: $purple;
    color: $white;
    border: none;
    cursor: pointer;
    font-family: $font-family;
    font-size: 1rem;
    font-weight: 600;
    transition: $transition;
    text-decoration: none;
    min-width: 140px;

    &:hover {
        background-color: $purple-dark;
        transform: translateY(-2px);
        box-shadow: $modal-shadow;
    }

    &:active {
        transform: translateY(0);
    }
}

@mixin heading {
    color: $heading-color;
    font-family: $font-family;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 1rem 0;
    @include text-overflow;
}

@mixin body-text {
    color: $body-color;
    font-family: $font-family;
    font-weight: 400;
    line-height: 1.6;
    margin: 0 0 1.5rem 0;
    @include text-overflow;
}


// EXTENDS

%btn {
    @include button-base;
}

%h1 {
    @include heading;
    font-size: 1.5rem;
}

%p {
    @include body-text;
    font-size: 1rem;
}

%img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}


// CONTAINER STYLES

.container {
    width: 37.75rem;
    height: 13.1875rem;
    background: $white;
    border-radius: 0.25rem;
    padding: 0.7rem 2rem;
    box-shadow: $shadow;
    margin: 2rem auto;
    @include flex-between;
    position: relative;
    overflow: visible;

    .content {
        flex: 1;
        @include flex-center(column);
        width: 23rem;
        gap: 0.75rem;
        align-items: flex-start;

        h1 {
            @extend %h1;
        }

        p {
            @extend %p;
            white-space: nowrap;
            overflow: hidden;
        }

        .btn {
            @extend %btn;
            width: 8.3125rem;
            margin: 0;
        }
    }

    .graphic {
        flex: 1;
        position: relative;
        height: 100%;
        @include flex-center;

        img {
            @extend %img-responsive;
            position: relative;
            right: -6rem;
            top: 0.5rem;
        }
    }
}


// MODAL STYLES

.modal.custom-modal {
    padding: 0;
    border-radius: 1rem;
    overflow: hidden;
    max-width: 900px;
    width: 90vw;
    max-height: 90vh;
    box-shadow: $modal-shadow;

    .modal-box {
        display: flex;
        min-height: 500px;

        .modal-left {
            flex: 1;
            background: $modal-gradient;
            position: relative;
            min-height: 500px;

            &::before {
                content: '';
                position: absolute;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                width: 120px;
                height: 120px;
                background: rgba(255, 255, 255, 0.1);
                border-radius: 50%;
                backdrop-filter: blur(10px);
            }
        }

        .modal-right {
            flex: 1.2;
            padding: 2.5rem;
            position: relative;
            @include flex-center(column);
            justify-content: center;
            background: $white;

            .modal-close {
                position: absolute;
                top: 1.5rem;
                right: 1.5rem;
                width: 24px;
                height: 24px;
                cursor: pointer;
                opacity: 0.6;
                transition: $transition;

                &:hover {
                    opacity: 1;
                    transform: scale(1.1);
                }
            }

            h1 {
                @extend %h1;
                font-size: 1.75rem;
                margin-bottom: 1.5rem;
                padding-right: 2rem;
            }

            p {
                @extend %p;
                margin-bottom: 2rem;
                line-height: 1.7;
            }

            .modal-buttons {
                display: flex;
                gap: 1rem;
                flex-wrap: wrap;

                .btn {
                    @extend %btn;

                    &.primary {
                        background: $purple;

                        &:hover {
                            background: $purple-dark;
                        }
                    }

                    &.secondary {
                        background: transparent;
                        color: $purple;
                        border: 2px solid $purple;

                        &:hover {
                            background: $purple;
                            color: $white;
                        }
                    }
                }
            }
        }
    }
}


// RESPONSIVE DESIGN

// Mobile Mix-in
@mixin container-mobile {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
    height: auto;

    .graphic {
        width: 100%;
        @include flex-center;

        img {
            position: static;
            max-width: 80%;
            margin: 0 auto;
        }
    }

    .content {
        width: 100%;
        align-items: center;

        h1,
        p {
            text-align: center;
        }

        .btn {
            align-self: center;
        }
    }
}

// Tablet
@media (max-width: 1024px) {
    body {
        padding: 1.5rem;
    }

    .container {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 2rem 1.5rem;
        gap: 1rem;
        height: auto;

        .content {
            flex: 1 1 60%;
            width: auto;

            h1,
            p {
                text-align: center;
            }

            .btn {
                align-self: center;
            }
        }

        .graphic {
            flex: 1 1 40%;
            min-height: 300px;

            img {
                position: static;
            }
        }
    }

    .modal.custom-modal {
        width: 90vw;

        .modal-box .modal-right {
            padding: 2rem;

            h1 {
                font-size: 1.5rem;
            }
        }
    }
}

// Mobile Large
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .container {
        @include container-mobile;
        padding: 1.5rem 1rem;
        width: 25rem;
        max-width: 80vw;

        .graphic {
            min-height: 200px;
        }

        .content {
            padding: 1.5rem;
        }
    }

    .modal.custom-modal {
        width: 95vw;

        .modal-box {
            flex-direction: column;

            .modal-left {
                min-height: 200px;
                order: 2;
            }

            .modal-right {
                order: 1;
                padding: 1.5rem;

                h1 {
                    font-size: 1.4rem;
                    padding-right: 1rem;
                }

                .modal-buttons {
                    flex-direction: column;
                    gap: 0.75rem;

                    .btn {
                        width: 100%;
                    }
                }
            }
        }
    }
}

// Mobile Small
@media (max-width: 480px) {
    body {
        padding: 0.5rem;
    }

    .container {
        @include container-mobile;
        padding: 1.5rem 1rem;
        width: 20rem;
        max-width: 95vw;

        .graphic {
            margin-bottom: 1rem;
            min-height: 180px;
        }

        .content {
            padding: 1rem;

            h1 {
                font-size: 1.25rem;
                margin: 0;
            }

            p {
                font-size: 0.9rem;
                margin: 0;
            }

            .btn {
                width: auto;
                padding: 0.625rem 1.25rem;
                font-size: 0.9rem;
            }
        }
    }

    .modal.custom-modal {
        width: 98vw;

        .modal-box .modal-right {
            padding: 1rem;

            .modal-close {
                top: 1rem;
                right: 1rem;
            }

            h1 {
                font-size: 1.2rem;
            }

            p {
                font-size: 0.9rem;
            }

            .modal-buttons .btn {
                padding: 0.625rem 1rem;
                font-size: 0.9rem;
            }
        }
    }
}