@use 'base.scss';

#map {
    @extend %vertical;
    justify-content: center;
    position: absolute;
    z-index: 10;
    background-color: #000d;
    transition-duration: 0.2s;
    font-size: 23px;
    padding-top: 20px;
    gap: 12px;

    &:not(.edit) .on-edit { @extend .invisible; }
    &.edit #mapSelect {
        @extend .invisible;
        transform: scale(1.1);
    }

    .hidden { display: none !important; }

    > button[type=reset] {
        @extend %responsive;
        left: 16px;
        top: 16px;
    }

    > button {
        position: absolute;
        font-size: inherit;
        align-items: center;
        gap: 8px;
        z-index: 2;
        background-color: #1115 !important;
    }

    #mapTools button {
        @extend %toolbox-item;
        border-radius: 0;
        font-size: 17px;

        &:nth-child(odd) > span {
            left: -8px;
        }

        &[mode=text] {
            font-weight: bold;
            font-family: Georgia, 'Times New Roman', Times, serif;
            font-size: 20px;
        }
    }

    #changeMap {
        @extend %responsive;
        padding: 100px;
    }

    #mapShared {
        bottom: calc(100% + 16px);
    }

    #mapDelete {
        top: 16px;
        right: 16px;
        font-size: 18px;
    }

    .with-tooltip > span {
        bottom: auto;
        top: 100%;
        z-index: 10;
        font-size: 16px;
    }

    #mapDelete > span {
        top: auto;
        right: 100%;
    }

    > span {
        position: relative;
        z-index: 1;

        > input {
            text-align: center;
            opacity: 1 !important;
        }

        > .navigate:not(.add-map) > span {
            display: none;
        }

        &.focus {
            > .navigate {
                opacity: 0;
                pointer-events: none;
            }
        }
        &:not(.focus) {
            > .dm {
                opacity: 0;
                cursor: default;
                pointer-events: none;
            }
        }

        > button.dm {
            position: absolute;
        }
    }

    .single-item {
        position: absolute !important;
        border-radius: base.$radius !important;
        outline: 1px solid #aaa;
        min-width: 38px;
        min-height: 38px;
    }

    &:not(.show) {
        pointer-events: none;
        opacity: 0;
        transition-duration: 0.25s;

        > #maps {
            transform: translateY(150%);
            transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
        }
    }
}

#mapSelect, .on-edit {
    transition-property: opacity;
    transition-duration: 0.2s;
}

.no-bg {
    background-color: transparent !important;

    > i {
        transition: transform 0.05s;
    }

    &:enabled:hover {
        > .fa-chevron-left  { transform: translateX(-4px); }
        > .fa-chevron-right { transform: translateX(4px); }
        > .fa-plus          { transform: scale(1.1); }
    }
}

#mapSelect {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    flex-wrap: wrap;
    overflow-y: auto;
    align-items: center;
    place-content: start center;
    gap: 32px 8px;
    padding: 66px 48px;
    transition-property: opacity, transform;
    z-index: 1;
}

.minimap {
    @extend %responsive;
    @include base.center-background;
    position: relative;
    width: 240px;
    min-height: 180px;
    background-color: var(--color-not-intense);
    border: 2px solid var(--color-note);
    cursor: pointer;
    display: flex;
    justify-content: center;

    > span {
        position: absolute;
        top: 100%;
        padding-top: 4px;
        font-size: initial;
    }
}

#addMap {
    padding: 12px 20px 16px 20px;
    width: 200px;
    margin: 0 20px;
    height: auto;
    gap: 8px;
}

#maps {
    display: flex;
    position: relative;
    width: 100%;
    height: 100%;
    left: 0;
    transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);

    &.animate {
        transition-property: opacity, left;
        transition-duration: 0.4s;
    }
}

#session:not(.is-dm) #mapName {
    user-select: none;
}

#mapTools {
    position: absolute;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;

    > #activeColor {
        width: 36px;
        height: 36px;
        position: absolute;
        left: calc(100% + 16px);
        transition-duration: 0.3s;
        transition-property: opacity, transform;

        &:disabled { opacity: 0; pointer-events: none; transform: translateX(-16px); }
    }

    > div {
        @extend .toolbox;
        grid-template-columns: auto auto;
    }

    &.collapsed > #toolInfo, &:not(.collapsed) > #infoShow {
        @extend .invisible;
        transform: translateX(-8px);
    }
}

.map {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 100%;
    height: 100%;
    max-height: calc(100% - 20px);
    box-sizing: border-box;
    padding: 0 20px;
    transition: scale 0.05s;

    > div {
        height: 100%;

        text {
            cursor: default;
            user-select: none;
            paint-order: stroke;
            stroke-linejoin: round;
            fill: #fff;
            stroke: #222;
            stroke-width: 5px;
        }

        &[mode=text] text {
            outline: 1px dashed #fffd;
            cursor: move;

            &:hover {
                outline: 1px solid #fffa;
            }
        }
    }

    image {
        background-repeat: no-repeat;
    }
}

#toolInfo, #infoShow {
    top: calc(100% + 16px);
    background-color: #111e;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.4s;
    box-sizing: border-box;

    &:hover {
        background-color: #1a1a1a;
    }
}

#toolInfo {
    padding: 8px;
    width: 200px;
    max-width: 260px;
    width: max-content;

    > i {
        font-style: normal;
        color: var(--color-primary);
    }
}

#whiteboardPin {
    fill: #fffa;
    stroke: black;
    stroke-width: 2px;
    animation: pin-pulse 4s ease-in-out infinite;
    opacity: 0;

    &.visible {
        opacity: 1;
    }
}
  
@keyframes pin-pulse {
      0% { r: 10px; }
     50% { r: 15px; }
    100% { r: 10px; }
}

#whiteboardTextControls {
    position: absolute;
    display: flex;
    flex-direction: column;
    padding: 6px;
    gap: 2px;
    transform: translate(-50%, calc(-100% - 24px));
    background-color: var(--color-background);
    box-shadow: 0 0 4px #0005;
    transition-property: opacity, transform;
    transition-duration: 0.2s;
    font-size: 16px;
    z-index: 1;

    &.display-below {
        transform: translate(-50%, 20px);
    }
    &.hidden {
        opacity: 0;
        pointer-events: none;
        transform: translate(-50%, calc(-100% - 8px));
    }

    span {
        display: flex;
        gap: 6px;
        align-items: center;
        margin: 0 4px;
    }
    
    textarea {
        width: 400px;
        height: 60px;
        overflow: auto;
        white-space: nowrap;
    }
    
    input {
        margin-right: auto;
        padding-top: 4px;
    }

    button {
        padding: 6px 4px;
        background-color: transparent;
    }
}

#mapIndex {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    font-size: 14px;
    text-align: center;
    color: var(--color-note);
}