body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #6b48ff, #ff6b6b, #48dbfb);
    overflow: hidden;
    position: relative;
}

/* Animated Background */
.background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 8s infinite ease-in-out;
}

.bubble-1 {
    width: 100px;
    height: 100px;
    top: 10%;
    left: 20%;
    animation-delay: 0s;
}

.bubble-2 {
    width: 150px;
    height: 150px;
    top: 50%;
    left: 70%;
    animation-delay: 2s;
}

.bubble-3 {
    width: 80px;
    height: 80px;
    top: 80%;
    left: 40%;
    animation-delay: 4s;
}

@keyframes float {
    0% {
        transform: translateY(0);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-50px);
        opacity: 0.4;
    }
    100% {
        transform: translateY(0);
        opacity: 0.8;
    }
}

.messenger-container {
    width: 900px;
    height: 600px;
    display: flex;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #ffffff, #f0f2f5);
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    width: 35%;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #ffffff, #f0f2f5);
}

.sidebar-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #6b48ff, #ff6b6b);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.sidebar-header h2 {
    margin: 0;
    font-size: 20px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.sidebar-actions i {
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.3s ease, color 0.3s ease;
}

.sidebar-actions i:hover {
    transform: scale(1.2);
    color: #ffeb3b;
}

.sidebar-search {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

.sidebar-search input {
    width: 100%;
    padding: 8px 12px 8px 40px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #f0f2f5, #e9ecef);
    font-size: 14px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.sidebar-search input:focus {
    outline: none;
    background: linear-gradient(135deg, #e9ecef, #f0f2f5);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.sidebar-search .search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b48ff;
    font-size: 14px;
}

.sidebar-friends {
    flex-grow: 1;
    overflow-y: auto;
}

#friends-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#friends-list li {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

#friends-list li:hover {
    background: linear-gradient(135deg, #f0f2f5, #e9ecef);
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#friends-list li .avatar-container {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    position: relative;
    overflow: hidden;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#friends-list li .avatar-container img.avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

#friends-list li:hover .avatar-container {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#friends-list li .friend-name {
    font-size: 16px;
    color: #050505;
    font-weight: 500;
}

/* Chat Container */
.chat-container {
    width: 65%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #ffffff, #f0f2f5);
    position: relative;
}

.chat-header {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #ffffff, #f0f2f5);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.chat-header-info {
    display: flex;
    align-items: center;
}

.chat-header-info .avatar-container {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    position: relative;
    overflow: hidden;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chat-header-info .avatar-container img.avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.chat-header-info .avatar-container:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.chat-header-details {
    display: flex;
    align-items: center;
}

.chat-header-info h3 {
    margin: 0;
    font-size: 18px;
    color: #050505;
    font-weight: 500;
}

.chat-header-info .status-dot {
    width: 10px;
    height: 10px;
    background: #31a24c;
    border-radius: 50%;
    margin-left: 10px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2), 0 0 10px #31a24c;
    animation: glow 1.5s ease-in-out infinite;
}

.chat-header-info .status-text {
    margin-left: 5px;
    font-size: 12px;
    color: #6b48ff;
    font-weight: 500;
}

.chat-actions .action-icon {
    font-size: 18px;
    color: #6b48ff;
    margin-left: 15px;
    cursor: pointer;
    transition: transform 0.3s ease, color 0.3s ease;
}

.chat-actions .action-icon:hover {
    transform: scale(1.2);
    color: #ff6b6b;
}

/* Status Bar */
.status-bar {
    padding: 5px 15px;
    background: linear-gradient(135deg, #f0f2f5, #e9ecef);
    border-bottom: 1px solid #e0e0e0;
    font-size: 12px;
    color: #6b48ff;
    text-align: center;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

.chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background: linear-gradient(135deg, #ffffff, #f0f2f5);
}

.message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    animation: slideIn 0.3s ease forwards;
}

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message .message-content {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.message.sent .message-content {
    background: linear-gradient(135deg, #6b48ff, #ff6b6b);
    color: #fff;
}

.message.received .message-content {
    background: linear-gradient(135deg, #e9ecef, #f0f2f5);
    color: #050505;
}

.message .message-content:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.message .avatar-container {
    width: 30px;
    height: 30px;
    margin-right: 10px;
    margin-left: 10px;
    position: relative;
    overflow: hidden;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.message .avatar-container img.avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.message .avatar-container:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Chat Input Wrapper */
.chat-input-wrapper {
    position: relative;
    padding: 15px;
    background: linear-gradient(135deg, #ffffff, #f0f2f5);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.chat-input {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #f0f2f5, #e9ecef);
    padding: 10px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.chat-input .input-icon {
    font-size: 20px;
    color: #6b48ff;
    margin: 0 10px;
    cursor: pointer;
    transition: transform 0.3s ease, color 0.3s ease;
}

.chat-input .input-icon:hover {
    transform: scale(1.2);
    color: #ff6b6b;
}

.chat-input input {
    flex-grow: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    background: transparent;
    font-size: 14px;
    box-shadow: none;
    transition: background 0.3s ease;
}

.chat-input input:focus {
    outline: none;
    background: transparent;
}

.chat-input .input-actions {
    display: flex;
    align-items: center;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 15px;
}

.typing-indicator .avatar-container {
    width: 30px;
    height: 30px;
    margin-right: 10px;
    position: relative;
    overflow: hidden;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.typing-indicator .avatar-container img.avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.typing-indicator .avatar-container:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.typing-indicator .dots {
    display: flex;
    align-items: center;
}

.typing-indicator .dots span {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #6b48ff, #ff6b6b);
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 0.6s infinite alternate;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2), 0 0 10px #6b48ff;
}

.typing-indicator .dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator .dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* New Message Notification */
.new-message-notification {
    position: absolute;
    bottom: 80px;
    right: 20px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #6b48ff, #ff6b6b);
    color: #fff;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 20px #6b48ff;
    display: flex;
    align-items: center;
    cursor: pointer;
    animation: bounceIn 0.5s ease;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.new-message-notification i {
    margin-right: 10px;
    font-size: 16px;
}

.new-message-notification span {
    font-size: 14px;
    font-weight: 500;
}

.new-message-notification:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4), 0 0 30px #6b48ff;
}

/* Back to Top Button */
.back-to-top {
    position: absolute;
    bottom: 80px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6b48ff, #ff6b6b);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 20px #6b48ff;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.back-to-top i {
    font-size: 18px;
}

.back-to-top:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4), 0 0 30px #6b48ff;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-5px);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes glow {
    0% {
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.2), 0 0 10px #31a24c;
    }
    50% {
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.3), 0 0 20px #31a24c;
    }
    100% {
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.2), 0 0 10px #31a24c;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .messenger-container {
        width: 100%;
        height: 100vh;
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 30%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .chat-container {
        width: 100%;
        height: 70%;
    }

    #friends-list li .avatar-container {
        width: 30px;
        height: 30px;
    }

    .chat-header-info .avatar-container {
        width: 30px;
        height: 30px;
    }

    .message .avatar-container {
        width: 25px;
        height: 25px;
    }

    .typing-indicator .avatar-container {
        width: 25px;
        height: 25px;
    }

    .new-message-notification {
        bottom: 70px;
        right: 10px;
    }

    .back-to-top {
        bottom: 70px;
        left: 10px;
    }
}