.chat-room {
    display: flex;
    position: fixed;
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
}

.chat-room-nav {
    position: fixed;
    padding: 10px;
    width: 15%;
    height: 100%;
    background-color: #f5f5f5;
    border-bottom: 1px solid #ddd;
    z-index: 10;
}

.open {
    display: flex;
    position: fixed;
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.75);
    z-index: 0;
}

.open .roomName-input {
    background-color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 40%;
    left: 30%;
    z-index: 0;
    width: 40%;
    height: 25%;
    border-radius: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);

    h3 {
        align-items: center;
        text-align: center;
    }

    input {
        width: 80%;
        height: 20px;
        margin: 20px auto;
        padding: 10px;
        border-radius: 20px;
        border: 1px solid #ccc;
        font-size: 16px;
    }

    .button-container {
        display: flex;
        justify-content: center;
        margin-top: -5px;

        button {
            width: 100px;
            height: 40px;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 20px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;

            margin-left: 10px;
            margin-right: 10px;

            &:hover {
                background-color: #0056b3;
            }
        }
    }
}

.chat-room-nav .chat-list {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 10px;
    box-sizing: border-box;
    z-index: 1;

    .chat-item {
        display: flex;
        position: relative;
        align-items: center;
        padding: 10px;
        margin-bottom: 10px;
        border-radius: 8px;
        cursor: pointer;

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

        .avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin-right: 10px;
        }

        .chat-info {
            height: 40px;
            flex-grow: 1;
            right: 0;
            width: 80%;

            h3 {
                margin: 0;
                margin-left: 5px;
                font-size: 1.2em;
                color: #333;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .chat-message {
                position: relative;
                margin-bottom: 10px;
                margin-left: 5px;
                max-width:100px;
                font-weight: bold;
                color: #333;
                max-height: 20px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                display: inline-block;
            }

            .chat-time {
                position: absolute;
                color: #666;
                font-size: 0.9em;
                right: 5px;
                bottom: 10px;
            }
        }
    }
}

.message-item {
    position: relative;
    left: 15%;
    width: 85%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background-image: url('../../public/backGround.jpg');
    background-size: cover;
    z-index: 2;

    .message-header {
        z-index: 5; 
        width: 100%;
        position: sticky;
        top: 0;
        background-color: #fff;
        height: 70px;
        display: flex;
        align-items: center;

        .avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin-left: 40px;
        }
        
        h2 {
            width: 10%;
            color: #333;
            text-align: center;
            margin: 0;
            padding: 0;
        }

        border-bottom: 1px solid #000000;
    }

    .message-list {
        flex: 1; 
        overflow-y: auto;
        padding: 10px;
        box-sizing: border-box;
        z-index: 3;
        
        .message {
            display: flex;
            max-width: 80%;
            padding: 10px;
            margin-bottom: 15px;
            margin-left: 15px;;
            border-radius: 15px;
            overflow-wrap: break-word;
            
            .avatar {
                width: 40px;
                height: 40px;
                border-radius: 50%;
                margin-right: 10px;
                flex-shrink: 0;
            }
            
            .message-content {
                min-width: 0;
                
                .message-info {
                    height: auto;

                    .message-sender {
                    font-weight: bold;
                    color: #333;
                    margin-right: 8px;
                    }

                    .message-time {
                    font-size: 0.8em;
                    color: #999;
                    }

                }
                
                .message-text {
                    padding: 8px 12px;
                    margin: 5px 0;
                    border-radius: 10px;
                    color: #555;
                    background-color: #f5f5f5;
                    display: block;
                    word-break: break-word;
                }
            }
        }
    }

    .message-input {
        position: sticky;
        bottom: 0;
        width: 90%;
        padding: 15px;
        box-sizing: border-box;
        z-index: 4;
        display: flex;
        margin-left: 5%;

        input {
            flex: 1;
            padding: 12px 15px;
            border-radius: 25px;
            font-size: 16px;
            margin-right: 10px;
            background-color: transparent;
        }

        input:hover {
            border: #000000 1px solid;
        }
    }
}

/* From Uiverse.io by njesenberger */ 
.button {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    border-width: 0;
    padding: 0 8px 12px;
    min-width: 10em;
    box-sizing: border-box;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.button-top {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 0;
    padding: 8px 16px;
    transform: translateY(0);
    text-align: center;
    color: #fff;
    text-shadow: 0 -1px rgba(0, 0, 0, .25);
    transition-property: transform;
    transition-duration: .2s;
    -webkit-user-select: none;
    user-select: none;
}

.button:active .button-top {
    transform: translateY(6px);
}

.button-top::after {
    content: '';
    position: absolute;
    z-index: -1;
    border-radius: 4px;
    width: 100%;
    height: 100%;
    box-sizing: content-box;
    background-image: radial-gradient(#cd3f64, #9d3656);
    text-align: center;
    color: #fff;
    box-shadow: inset 0 0 0px 1px rgba(255, 255, 255, .2), 0 1px 2px 1px rgba(255, 255, 255, .2);
    transition-property: border-radius, padding, width, transform;
    transition-duration: .2s;
}

.button:active .button-top::after {
    border-radius: 6px;
    padding: 0 2px;
}

.button-bottom {
    position: absolute;
    z-index: -1;
    bottom: 4px;
    left: 4px;
    border-radius: 8px / 16px 16px 8px 8px;
    padding-top: 6px;
    width: calc(100% - 8px);
    height: calc(100% - 10px);
    box-sizing: content-box;
    background-color: #803;
    background-image: radial-gradient(4px 8px at 4px calc(100% - 8px), rgba(255, 255, 255, .25), transparent), radial-gradient(4px 8px at calc(100% - 4px) calc(100% - 8px), rgba(255, 255, 255, .25), transparent), radial-gradient(16px at -4px 0, white, transparent), radial-gradient(16px at calc(100% + 4px) 0, white, transparent);
    box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.5), inset 0 -1px 3px 3px rgba(0, 0, 0, .4);
    transition-property: border-radius, padding-top;
    transition-duration: .2s;
}

.button:active .button-bottom {
    border-radius: 10px 10px 8px 8px / 8px;
    padding-top: 0;
}

.button-base {
    position: absolute;
    z-index: -2;
    top: 4px;
    left: 0;
    border-radius: 12px;
    width: 100%;
    height: calc(100% - 4px);
    background-color: rgba(0, 0, 0, .15);
    box-shadow: 0 1px 1px 0 rgba(255, 255, 255, .75), inset 0 2px 2px rgba(0, 0, 0, .25);
}

.message-item {
    /* From Uiverse.io by adamgiebl */ 
    button {
        font-family: inherit;
        font-size: 20px;
        background: transparent;
        color: white;
        padding: 0.7em 1em;
        padding-left: 0.9em;
        display: flex;
        align-items: center;
        border: none;
        border-radius: 16px;
        overflow: hidden;
        transition: all 0.2s;
        cursor: pointer;
    }

    button span {
        display: block;
        margin-left: 0.3em;
        transition: all 0.3s ease-in-out;
    }

    button svg {
        display: block;
        transform-origin: center center;
        transition: transform 0.3s ease-in-out;
    }

    button:hover .svg-wrapper {
        animation: fly-1 0.6s ease-in-out infinite alternate;
    }

    button:hover svg {
        transform: translateX(1.2em) rotate(45deg) scale(1.1);
    }

    button:hover span {
        transform: translateX(5em);
    }

    button:active {
        transform: scale(0.95);
    }

    @keyframes fly-1 {
        from {
            transform: translateY(0.1em);
        }

        to {
            transform: translateY(-0.1em);
        }
    }
}