:root {
    --bg-gradient-start: #0F1219;
    --bg-gradient-mid: #161922;
    --bg-gradient-end: #212735;
    
    --text-white: #FFFFFF;
    --text-gray: #8A99A8;
    
    --chat-bg: #0F1219;          
    --sidebar-bg: #14171F;       
    --header-border: #292E3D;    
    --text-muted: #8A99A8;       
    --hover-bg: #1c202b;         
    --input-bg: #222732;         
    --accent-blue: #0285ffc8;    
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; 
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--chat-bg);
    margin: 0;
    padding: 0;
    overflow: hidden; 
    width: 100vw;
    height: 100vh;
    font-family: 'Inter', sans-serif;
    display: block; 
}
.app-layout {
    display: flex;
    flex-direction: column; 
    height: 100%;
    width: 100%;

    .channel-header {
        min-height: 62px; 
        display: flex;
        align-items: center; 
        padding: 0 16px;
        border-bottom: 1px solid var(--header-border);
        background-color: var(--sidebar-bg); 
        width: 100%; 

        .channel-info {
            display: flex;
            align-items: center;
            gap: 12px; 

            .app-logo { 
                width: 52px; 
                height: 52px; 
            }

            .hash {
                font-size: 24px;
                color: var(--text-muted);
                font-weight: 300;
            }

            .channel-name {
                font-size: 15px;
                font-weight: 700;
                color: white;
                text-transform: uppercase;
                letter-spacing: 0.2px;
            }
        }
    }

    .content-wrapper {
        display: flex;
        flex: 1; 
        overflow: hidden; 

        .chat-main {
            flex: 1; 
            display: flex;
            flex-direction: column; 
            min-width: 0; 
            height: 100%;
            position: relative;
            background-color: var(--chat-bg);

            .messages-container {
                flex: 1; 
                overflow-y: auto; 
                overflow-x: hidden;
                padding: 16px 0;
                display: flex;
                flex-direction: column;
                
                scrollbar-width: thin;
                scrollbar-color: #202225 transparent;

                .message {
                    display: flex;
                    gap: 16px;
                    padding: 8px 16px; 
                    margin: 0;
                    background-color: transparent;
                    transition: background-color 0.1s;

                    &:hover {
                        background-color: rgba(255,255,255,0.02); 
                    }

                    .avatar-wrapper {
                        width: 44px;
                        height: 44px;
                        border-radius: 50%; 
                        overflow: hidden;
                        flex-shrink: 0;
                        background-color: var(--input-bg);
                        cursor: pointer;

                        img { 
                            width: 100%; 
                            height: 100%; 
                            object-fit: cover; 
                        }
                    }

                    .message-content {
                        display: flex;
                        flex-direction: column;
                        min-width: 0;

                        .message-header {
                            display: flex;
                            align-items: center;
                            gap: 8px;

                            .username {
                                color: white;
                                font-size: 15px;
                                cursor: pointer;

                                &:hover{
                                    text-decoration: underline; 
                                }
                            }
                            .timestamp {
                                color: var(--text-muted);
                                font-size: 11px;
                            }
                            img{
                                width:16px;
                                height:16px;
                                cursor: pointer;
                                transition: 0.3s all;
                                &:hover{
                                    filter: brightness(0) invert(1);
                                }
                            }
                        }

                        .text {
                            color: #dcddde; 
                            font-size: 15px;
                            line-height: 1.4;
                            word-break: break-all;
                            margin-top: 2px;
                        }
                    }
                }
            }

            .input-area-wrapper {
                padding: 18px 30px 18px 30px;
                width: 100%;

                .chat-input-area {
                    display: flex;
                    align-items: center;
                    gap: 18px;
                    width: 100%;

                    .current-user-profile {
                        border: 1px solid #292E3D;
                        display: flex;
                        align-items: center;
                        gap: 8px;
                        padding: 4px 8px;
                        background-color: transparent;
                        border-radius: 8px;
                        min-width: 160px;
                        height: 44px;

                        .avatar-small {
                            width: 32px;
                            height: 32px;
                            
                            img {
                                border-radius: 50%;
                                width: inherit; 
                                height: inherit; 
                                object-fit: cover;
                            }
                        }

                        .user-details {
                            display: flex;
                            flex-direction: column;
                            flex: 1;

                            .my-username {
                                font-size: 13px;
                                color: white;
                            }

                            .status-text { font-size: 11px; color: #43b581; }
                        }
                    }

                    .message-form {
                        flex: 1;
                        display: flex;
                        gap: 18px;
                        align-items: center;
                        position: relative;

                        .input-wrapper {
                            flex: 1;
                            display: flex;
                            align-items: center;
                            border: 1px solid #292E3D;
                            background-color: #1E232E;
                            border-radius: 8px;
                            padding: 10px 12px;
                            height: 44px;

                            #messageInput {
                                flex: 1;
                                background: transparent;
                                border: none;
                                color: white;
                                font-size: 14.5px;
                                outline: none;
                            }
                        }
                    }
                    .message-form::before{
                        content: attr(data-label);
                        position: absolute;
                        left: 14px;
                        bottom: 2.8rem;
                        font-size: 12.5px;
                        color: #757575;
                        pointer-events: none;
                    }
                }
            }
        }

        .user-sidebar {
            display: flex;
            flex-direction: column;
            width: 240px; 
            background-color: var(--sidebar-bg);
            padding: 16px 16px 24px 16px;
            gap: 24px;
            overflow-y: auto;
            border-left: 1px solid var(--header-border); 

            .group-title {
                font-size: 12px;
                color: var(--text-muted);
                margin: 8px 0px;
                padding-left: 8px;
            }

            .user-item {
                display: flex;
                align-items: center;
                gap: 12px;
                padding: 6px 8px;
                border-radius: 8px;
                cursor: pointer;
                opacity: 0.9;
                transition: 0.2s all;

                &:hover { 
                    background-color: var(--hover-bg); 
                    opacity: 1; 
                }

                .avatar-wrapper {
                    width: 40px;
                    height: 40px;
                    border-radius: 50%;
                    overflow: hidden;
                    flex-shrink: 0;
                    background-color: var(--input-bg);
                    
                    img { 
                        width: 100%; 
                        height: 100%; 
                        object-fit: cover; 
                    }
                }

                .username { 
                    color: #96989D; 
                    font-size: 15px; 
                }

                &:hover .username { color: white; }
            }

            .opacity-low { opacity: 0.5; }
        }
    }
}

.icon-btn { 
    background: none; 
    border: none; 
    color: white; 
    font-size: 24px; 
    cursor: pointer; 
}

.mobile-only {
    display: none;
}

.send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 52px;
    height: 44px;
    border-radius: 8px;
    background: var(--accent-blue);
    border: none;
    cursor: pointer;
    transition: 0.3s;

    &:hover { 
        opacity: 0.8;
        scale: 1.1;
    }
    &:hover img { 
        filter: brightness(0) invert(1);
    }
    &:active{
        scale: 0.95;
    }
    img {
        transition: 0.3s;
        width: 20px;
        height: 20px;
    }
}
.admin{
    color: rgb(169, 31, 31) !important; 
}
.link{
   text-decoration: none;
    
}
.link:hover{
   text-decoration: underline;
}
.logout-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;       
    border-radius: 8px; 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}
.logout-btn img {
    width: 20px;
    height: 20px;
    opacity: 0.6; 
    transition: opacity 0.2s ease;
}

.logout-btn:hover {
    background-color: rgba(239, 68, 68, 0.15);
}
.logout-btn:hover img {
    opacity: 1;
    filter: invert(33%) sepia(95%) saturate(7466%) hue-rotate(-7deg) brightness(97%) contrast(105%);
}
.logout-btn:active {
    background-color: rgba(239, 68, 68, 0.25);
    transform: scale(0.95); 
}
/* Review this styling later on */
.pfp-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    justify-content: center;
    align-items: center;
}

.pfp-popup.closed {
    display: none;
}

.pfp-popup.opened {
    display: flex;
}

.pfp-popup-content {
    background-color: var(--sidebar-bg);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--header-border);
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.pfp-popup-title {
    color: var(--text-white);
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    text-align: center;
}

.pfp-file-input {
    background-color: var(--input-bg);
    border: 1px solid var(--header-border);
    border-radius: 8px;
    padding: 8px;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
}

.pfp-file-input::file-selector-button {
    background-color: var(--hover-bg);
    color: var(--text-white);
    border: 1px solid var(--header-border);
    padding: 6px 12px;
    border-radius: 6px;
    margin-right: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.pfp-file-input::file-selector-button:hover {
    background-color: #2f3442;
}

.pfp-buttons-container {
    display: flex;
    gap: 12px;
}

.pfp-cancel-btn {
    flex: 1;
    padding: 10px;
    background-color: transparent;
    border: 1px solid var(--header-border);
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pfp-cancel-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-white);
}

.pfp-save-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: var(--accent-blue);
    color: var(--text-white);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pfp-save-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.pfp-save-btn:active {
    transform: translateY(0);
}