import {blackColor, darkGreenColor, gradient, inactiveBorderColor, inactiveTextColor, lightGreenColor, modalColor, whiteColor} from "@/styles/colors";
import styled from "styled-components";
import {IMaskInput} from "react-imask";

export const Overlay = styled.div`
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
`;
export const ModalWrapper = styled.div<{ $animateIn: boolean }>`
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background: ${blackColor};
    color: white;
    padding: 32px;
    border-radius: 20px;
    width: 70vw;
    height: 94vh;
    position: relative;
    opacity: ${({ $animateIn }) => ($animateIn ? 1 : 0)};
    transform: ${({ $animateIn }) =>
    $animateIn ? 'translateY(0)' : 'translateY(-20px)'};
    transition: opacity 0.3s ease, transform 0.3s ease;
    @media (max-height: 950px) {
        height: 100vh;
        width: 80vw;
       .marginTitle{
           margin-top: 0 !important;
       }
    }
    @media (max-width: 800px) {
        height: 100vh;
        width:100vw;
        border-radius: 0;
        .marginTitle{
            margin-top: 16px !important;
        }
    }
    @media(max-width: 450px) {
        .marginTitle{
            margin-top: 0 !important;
        }
        .contacts{
            gap: 4px;
            margin: 10px 0 20px;
            img{
                width: 40px;
                height: 40px;
            }
        }
        .readyText{
            font-size: 20px !important;
            margin-bottom: 30px !important;
        }
    }
`;

export const CloseButton = styled.button`
    position: absolute;
    top: 3.5%;
    right: 3.5%;
    font-size: 42px;
    background: transparent;
    border: none;
    color: ${modalColor};
    cursor: pointer;
    @media (max-width: 800px) {
        top: 0;
        right: 2%;
    }
    @media (max-height: 685px) {
        top: 24px;
    }
    @media (max-width: 450px) {
        top: 18px;
        right: 4%;
    }
`;

export const SectionTitle = styled.h2`
    font-size: 26px;
    margin-bottom: 20px;
    @media (max-width: 900px) {
        font-size: 24px;
        text-align: center;
    }
    @media (max-width: 500px) {
        width: 80%;
    }
    @media (max-width: 450px) {
        font-size: 20px;
        margin-bottom: 8px;
    }
`;

export const Input = styled.input`
    border-radius: 15px;
    margin-bottom: 20px;
    border: 2px solid ${modalColor};
    color: ${modalColor};
    padding: 0 25px;
    max-width: 400px;
    width: 40%;
    height: 60px;
    font-size: 24px;
    text-transform: uppercase;
    line-height: 60px;
    @media (max-width: 580px) {
        width: 90%;
    }
    @media (max-width: 450px) {
        height: 50px;
        font-size: 18px;
    }
`;
export const MaskedInput = styled(IMaskInput)`
  border-radius: 15px;
  margin-bottom: 20px;
  border: 2px solid ${modalColor};
  color: ${modalColor};
  padding: 0 25px;
  max-width: 400px;
  width: 40%;
  height: 60px;
  font-size: 24px;
  text-transform: uppercase;
  background: transparent;
    @media (max-width: 580px) {
        width: 90%;
    }
    @media (max-width: 450px) {
        font-size: 18px;
        height: 50px;
    }
`;
export const InputLabel = styled.p`
    text-transform: none;
    color: ${whiteColor};
    max-width: 590px;
    font-size: 20px;
    margin:10px 0 14px;
    text-align: center;
    line-height: 1;
    @media (max-width: 560px) {
        max-width: 90%;
    }
    @media (max-width: 450px) {
        font-size: 18px;
        margin:14px 0 8px;
    }
`

export const ChoiceBtn = styled.button<{$selected?: boolean}>`
    width: 402px;
    max-height: 120px;
    padding: 30px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-transform: uppercase;
    color:${modalColor};
    position: relative;
    border-radius: 15px;
    background: ${blackColor};
    h3{
        font-size: 40px;
        background: linear-gradient(to right, ${lightGreenColor}, ${darkGreenColor});
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        max-width: 300px;
    }
    span{
        font-size: 24px;
        background: ${({$selected})=> ($selected ? gradient : modalColor)};
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }
    &::after{
        content: "";
        position: absolute;
        top: -3%;
        left: -0.5%;
        width: 101%;
        height: 106%;
        background: ${({$selected})=>($selected ? gradient : modalColor)};
        z-index: -1;
        border-radius: 15px;
    }
    @media (max-width: 1220px) {
        width: 300px;
        padding: 20px 0;
    }
    @media (max-width: 700px) {
        width: 96%;
        padding: 16px 0;
        margin-top: 4px;
    }
    @media (max-width: 450px) {
        width: 96%;
        padding: 10px 8px;
        margin-top: 4px;
        h3{
            font-size: 24px;
            margin: 0 0 6px;
        }
        span{
            font-size: 18px;
            line-height: 1;
        }
    }
`
export const TwoColumns = styled.div`
    display: grid;
    grid-template-columns: repeat(2, 400px);
    justify-content: center;
    align-items: start;
    gap: 30px 28px;
    margin: 20px 0 50px;
    @media (max-width: 1220px) {
        grid-template-columns: repeat(2, 300px);
    }
    @media (max-width: 700px) {
        display: flex;
        flex-direction: column;
        width: 90%;
        height: 400px;
        overflow-y: auto;
        padding-right: 8px;
        justify-content: flex-start;
        align-items: center;
        &::-webkit-scrollbar {
            width: 6px;
        }

        &::-webkit-scrollbar-thumb {
            background-color: #999;
            border-radius: 6px;
        }

        &::-webkit-scrollbar-track {
            background: transparent;
        }
    }
    @media (max-width: 450px) {
        margin: 20px 0 20px;
        gap: 16px 28px;
        height: 300px;
        .big_btn{
            span{
                padding: 12px 14px;
                font-size: 24px;
            }
        }
    }
`
export const TitleModal = styled.h2`
    font-size: 48px;
    text-align: center;
    color: ${whiteColor};
    line-height: 1;
    margin-bottom: 24px;
    position: absolute;
    top: 60px;
    span{
        color: ${lightGreenColor};
    }
    @media (max-height: 950px) {
        position: relative;
        top: 0;
    }
    @media (max-width: 900px) {
        font-size: 38px;
        margin-top: 20px;
    }
    @media (max-width: 450px) {
        font-size: 24px;
        margin-top: 42px;
        margin-bottom: 12px;
    }
`
export const StepsModal = styled.div`
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 80px;
    margin-bottom: 60px;
    position: absolute;
    top: 130px;
    p{
        color: ${modalColor};
        font-size: 32px;
        position: relative;
        width: 40.5px;
        text-align: center;
        &::after{
            content: "";
            position: absolute;
            bottom: -30%;
            left: 50%;
            transform: translateX(-50%);
            background: ${modalColor};
            height:6px;
            width: 100px;
        }
    }
    span{
        position: relative;
        &::after{
            content: "";
            position: absolute;
            bottom: -56%;
            left: 50%;
            transform: translateX(-50%);
            background: ${lightGreenColor};
            height:6px;
            width: 100px;
        }
    }
    @media (max-height: 950px) {
        position: relative;
        margin-bottom: 40px;
        top: 0;
    }
    @media (max-width: 900px) {
        gap: 50px;
        p{
            font-size: 28px;
            width: 30px;
            &::after{
                width: 60px;
            }
        }
        img{
            width: 30px;
        }
        span{
            &::after{
                width: 60px;
            }
        }
    }
    @media (max-width: 520px) {
        display: none;
    }
`
export const BackBtn = styled.button`
    position: absolute;
    top: 4%;
    left: 4%;
    font-size: 24px;
    color: ${modalColor};
    text-transform: uppercase;
    @media (max-width: 800px) {
        top: 2%;
        left: 2%;
    }
    @media (max-height: 685px) {
        top: 44px;
    }
    @media (max-width: 450px) {
        top: 32px;
        left: 4%;
    }
`
export const BronBtn = styled.button`
    position: absolute;
    bottom: 4%;
    left: 4%;
    font-size: 24px;
    color: ${whiteColor};
    padding: 16px 50px;
    background: linear-gradient(to right, #6C6693, #272535);
    text-transform: uppercase;
    border-radius: 15px;
    &::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 90%;
        height: 50%;
        background: ${whiteColor};
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
        transition: all 0.4s ease;
        border-radius: 50%;
        filter: blur(20px);
        z-index: -1;
    }

    &:hover::before {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    @media (max-width: 900px) {
        display: none;
    }
`

export const TimeSlotGrid = styled.div`
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-width: 600px;
    width: 100%;
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
    
    &::-webkit-scrollbar {
        width: 6px;
    }

    &::-webkit-scrollbar-thumb {
        background-color: #999;
        border-radius: 6px;
    }

    &::-webkit-scrollbar-track {
        background: transparent;
    }
    
    @media (max-width: 700px) {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    @media (max-width: 450px) {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        max-height: 300px;
    }
`

export const TimeSlotBtn = styled.button<{$selected?: boolean; $available?: boolean}>`
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid ${({$available}) => ($available ? modalColor : inactiveBorderColor)};
    background: ${({$selected, $available}) => 
        $selected ? gradient : 
        $available ? 'transparent' : 
        'rgba(60, 60, 60, 0.3)'};
    color: ${({$selected, $available}) => 
        $selected ? whiteColor : 
        $available ? modalColor : 
        inactiveTextColor};
    font-size: 18px;
    font-weight: 600;
    cursor: ${({$available}) => ($available ? 'pointer' : 'not-allowed')};
    transition: all 0.2s ease;
    text-transform: uppercase;
    
    &:hover {
        ${({$available}) => $available && `
            transform: scale(1.05);
            border-color: ${lightGreenColor};
        `}
    }
    
    @media (max-width: 450px) {
        padding: 10px 12px;
        font-size: 16px;
    }
`