﻿@import "/UI/Core/Styles/Theme.scss";

@keyframes chat-accent-bloom {
    0%   { opacity: 0; transform: scaleY( 0.4 ); }
    100% { opacity: 0.85; transform: scaleY( 1 ); }
}

@keyframes chat-row-fade-in {
    0%   { background-size: 0% 100%; }
    100% { background-size: 100% 100%; }
}

Chat {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 90;

    .ChatContextMenuBackdrop {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        pointer-events: all;
        z-index: 200;
    }

    .ChatScrollDragOverlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        pointer-events: all;
        z-index: 195;
    }

    .ChatContextMenu {
        position: absolute;
        flex-direction: column;
        gap: 1px;
        padding: 2px;
        min-width: 140px;
        border: 1px solid rgba( 255, 255, 255, 0.18 );
        border-radius: 4px;
        background-color: rgba( 12, 18, 30, 0.96 );
        box-shadow: 0 8px 24px rgba( 0, 0, 0, 0.55 );
        pointer-events: all;
        z-index: 210;

        .chat-context-divider {
            height: 1px;
            background-color: rgba( 255, 255, 255, 0.08 );
            margin: 2px 2px;
            flex-shrink: 0;
        }

        UIButton .ui-button.chat-context-item {
            width: 100%;
            justify-content: flex-start;
            padding: 3px 8px;
            font-size: 12px;
            border-radius: 3px;
            background-color: transparent;
            border: 0;
            box-shadow: none;
            margin: 0;

            &:hover:not( .disabled ) {
                background-color: rgba( 255, 255, 255, 0.08 );
            }
        }

        UIButton .ui-button.chat-context-item-ban {
            color: rgba( 255, 120, 120, 0.92 );
        }

        UIButton .ui-button.chat-context-item-delete {
            color: rgba( 255, 120, 120, 0.92 );
        }
    }

    &.open {
        pointer-events: all;


        .textentry {
            background-color: $widget-color-dark;
            opacity: 1;
        }

        .ChatBox {
            background-color: $widget-color;
            backdrop-filter: $widget-backdrop-filter;
            box-shadow: $widget-shadow;
        }
    }

    &.team-chat {
        // Border and textentry background applied via inline styles for dynamic team color.
    }

    &.hidden {
        .MessageList {
            opacity: 0;
            pointer-events: none;
        }
    }

    .textentry {
        border: none;
        border-radius: 0px;
        overflow: hidden;
        opacity: 0.001;
    }

    .ChatBox {
        position: absolute;
        left: $safe-zone-y;
        bottom: 350px;
        transform-origin: 0% 100%;
        border-radius: 6px;
        border: 1px solid transparent;
        box-shadow: none;
        overflow: visible;

        .Content {
            position: relative;
            flex-direction: column;
            justify-content: space-between;
            width: 500px;
            font-size: 14px;
            max-height: 330px;
            height: 290px;

            .MessageList {
                flex-direction: column;
                justify-content: flex-end;
                flex-grow: 1;
                overflow-y: scroll;
                overflow-x: hidden;
                width: 100%;
                padding-right: 6px;
                //border-right: 1px solid rgba( 255, 255, 255, 0.08 );
                opacity: 1;
                transition: opacity 0.25s ease;

                .ChatEntry {
                    padding: 8px;
                    align-items: center;
                    flex-shrink: 0;
                    position: relative;
                    background-repeat: no-repeat;
                    animation: chat-row-fade-in 0.4s ease-out;
                    text-stroke-width: 4px;
			        text-stroke-color: rgba( 0, 0, 0, 0.2 );
			        text-shadow: 2 2px 3px rgba( 0, 0, 0, 0.6 );

                    .ServerName {
                        color: rgba( 110, 190, 255, 0.95 );
                        text-transform: uppercase;
                        letter-spacing: 1.4px;
                        font-size: 12px !important;
                        font-weight: 800;
                    }

                    .ServerAvatar {
                        height: 44px;
                        width: 44px;
                        align-items: center;
                        justify-content: center;
                        background-color: rgba( 110, 190, 255, 0.10 );
                        border: 1px solid rgba( 110, 190, 255, 0.32 );
                        border-radius: 4px;

                        .server-avatar-icon {
                            .icon {
                                font-size: 24px;
                                color: rgba( 110, 190, 255, 0.95 );
                            }
                        }
                    }

                    .ChannelAccentStripe {
                        position: absolute;
                        left: 0;
                        top: 0;
                        bottom: 0;
                        width: 3px;
                        border-radius: 2px;
                        opacity: 0.85;
                        animation: chat-accent-bloom 0.5s ease-out;
                    }

                    &.ChannelEntry {
                        margin-bottom: 4px;
                    }

                    &.ServerEntry {
                        background-color: rgba( 110, 190, 255, 0.04 );
                        border-radius: 4px;
                        margin-bottom: 4px;

                        .ServerAccentStripe {
                            position: absolute;
                            left: 0;
                            top: 0;
                            bottom: 0;
                            width: 3px;
                            background-color: rgba( 110, 190, 255, 0.85 );
                            border-radius: 2px;
                        }

                        .ServerAvatar {
                            height: 22px;
                            width: 22px;

                            .server-avatar-icon {
                                .icon {
                                    font-size: 13px;
                                }
                            }
                        }

                        .ChatEntryContent {
                            .EntryTop label {
                                font-size: 10px !important;
                            }

                            .EntryBottom label {
                                font-size: 12px !important;
                            }
                        }

                        &.BanWarning {
                            background-color: rgba( 255, 80, 80, 0.08 );

                            .ServerAccentStripe {
                                background-color: rgba( 255, 80, 80, 0.95 );
                            }

                            .ServerName {
                                color: rgba( 255, 120, 120, 1 );
                            }

                            .ServerAvatar {
                                background-color: rgba( 255, 80, 80, 0.12 );
                                border: 1px solid;
                                border-color: rgba( 255, 80, 80, 0.4 );

                                .server-avatar-icon .icon {
                                    color: rgba( 255, 120, 120, 1 );
                                }
                            }
                        }
                    }

                    .ChatEntryContent {
                        flex-direction: column;

                        .EntryTop {
                            align-items: center;

                            label {
                                font-size: 16px;
                                margin-left: 8px;
                            }

                            .chat-timestamp {
                                font-size: 10px;
                                opacity: 0.4;
                                margin-left: 6px;
                            }
                        }

                        .EntryBottom {
                            padding-left: 8px;
                            flex-direction: row;
                            flex-wrap: wrap;

                            label {
                                font-size: 16px;
                            }

                            label.keep-spaces {
                                white-space: pre;
                            }

                            label.deleted {
                                color: rgba( 255, 255, 255, 0.4 );
                                font-style: italic;
                            }
                        }
                    }

                    img {
                        //border-radius: 50%;
                        height: 44px;
                        width: 44px;
                        border: 1px solid rgba( 255, 255, 255, 0.12 );
                    }
                }
            }

            .InputField {
                flex-shrink: 0;
                min-height: 48px;
                flex-direction: row;
                align-items: center;
                gap: 8px;
                position: relative;
                z-index: 3;

                .ChannelIndicatorWrap {
                    flex-shrink: 0;
                    flex-direction: column;
                    position: relative;
                    pointer-events: all;
                }

                .ChatChannelIndicator {
                    flex-shrink: 0;
                    flex-grow: 0;
                    margin-left: 3px;
                    padding: 6px 0;
                    width: 88px;
                    min-width: 88px;
                    max-width: 88px;
                    text-align: center;
                    justify-content: center;
                    border-radius: 4px;
                    border: 1.5px solid rgba(255, 255, 255, 0.3);
                    background-color: rgba(255, 255, 255, 0.04);
                    font-size: 12px;
                    font-weight: 800;
                    letter-spacing: 1.2px;
                    text-stroke-width: 3px;
                    text-stroke-color: rgba(0, 0, 0, 0.6);
                    pointer-events: all;
                    cursor: pointer;
                    transition: background-color 0.15s ease;

                    &:hover {
                        background-color: rgba(255, 255, 255, 0.1);
                    }
                }

                .ChannelDropdown {
                    position: absolute;
                    top: 100%;
                    left: 3px;
                    margin-top: 4px;
                    width: 88px;
                    min-width: 88px;
                    flex-direction: column;
                    gap: 1px;
                    padding: 2px;
                    border: 1px solid rgba( 255, 255, 255, 0.18 );
                    border-radius: 4px;
                    background-color: rgba( 12, 18, 30, 0.95 );
                    box-shadow: 0 8px 24px rgba( 0, 0, 0, 0.45 );
                    z-index: 5;
                    pointer-events: all;

                    .ChannelDropdownItem {
                        padding: 3px 0;
                        text-align: center;
                        justify-content: center;
                        font-size: 11px;
                        font-weight: 800;
                        letter-spacing: 1.2px;
                        border-radius: 3px;
                        cursor: pointer;
                        transition: background-color 0.1s ease;

                        &:hover {
                            background-color: rgba( 255, 255, 255, 0.08 );
                        }
                    }
                }

                .textentry {
                    min-height: 40px;
                    height: 40px;
                    width: 380px;

                    .label {
                        font-size: 16px;
                    }
                }
            }

            .ChatModeHint {
                font-size: 12px;
                color: rgba(255, 255, 255, 0.45);
                padding: 2px 6px;
                flex-shrink: 0;
            }

            .CommandSuggestions {
                position: absolute;
                left: 0;
                right: 0;
                bottom: 40px;
                flex-direction: column;
                max-height: 140px;
                overflow-y: scroll;
                overflow-x: hidden;
                border: 1px solid rgba( 255, 255, 255, 0.14 );
                border-bottom: none;
                background-color: rgba( 12, 18, 30, 0.95 );
                box-shadow: 0 -8px 24px rgba( 0, 0, 0, 0.35 );
                pointer-events: all;
                z-index: 2;

                .Suggestion {
                    min-height: 30px;
                    padding: 6px 10px;
                    align-items: center;
                    gap: 3px;
                    transition: background-color 0.1s ease;

                    .Prefix {
                        font-size: 13px;
                        color: rgba( 255, 255, 255, 0.55 );
                        text-shadow: none;
                    }

                    .Command {
                        font-size: 13px;
                        color: rgba( 255, 255, 255, 0.9 );
                        text-shadow: none;
                    }
                }
            }
        }
    }
}
