       @import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');

        :root {
            --primary: #25D366; 
            --secondary: #ECE5DD;
            --background: #F0F0F0;
            --surface: #FFFFFF;
            --text: #000000;
            --online: #25D366;
            --message-sent: #DCF8C6; 
            --message-received: #FFFFFF;
        }

        [data-theme="dark"] {
            --primary: #6366f1;
            --secondary: #ec4899;
            --background: #0f172a;
            --surface: rgba(30, 41, 59, 0.7);
            --text: #f8fafc;
            --online: #22c55e;
            --message-sent: #4f46e5;
            --message-received: #1e293b;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Tajawal', sans-serif;
        }

        body {
            background: var(--background);
            color: var(--text);
            height: 100vh;
            display: flex;
            flex-direction: column;
            transition: background 0.5s, color 0.5s;
        }

        .chat-container {
            display: flex;
            height: 100vh;
            overflow: hidden;
        }

        .sidebar {
            width: 300px;
            background: var(--surface);
            border-left: 1px solid rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
        }

        .users-header {
            padding: 20px;
            background: var(--surface);
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        }

        .user-search {
            background: rgba(0, 0, 0, 0.05);
            border: none;
            border-radius: 8px;
            padding: 12px;
            width: 100%;
            color: var(--text);
            margin-top: 10px;
        }

        .online-users {
            padding: 20px;
            overflow-y: auto;
            flex: 1;
        }

        .user-card {
            display: flex;
            align-items: center;
            padding: 12px;
            border-radius: 12px;
            margin-bottom: 10px;
            transition: all 0.3s ease;
            cursor: pointer;
            background: rgba(0, 0, 0, 0.05);
        }

        .user-card:hover {
            transform: translateX(-5px);
            background: rgba(0, 0, 0, 0.1);
        }

        .user-avatar {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            margin-left: 15px;
            position: relative;
            background-size: cover;
            background-position: center;
        }

        .user-status {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--online);
            position: absolute;
            bottom: 0;
            right: 0;
            border: 2px solid var(--surface);
        }

        .chat-main {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: var(--background);
        }

        .chat-header {
            padding: 20px;
            background: var(--surface);
            display: flex;
            align-items: center;
            justify-content: space-between;
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        }

        .messages-container {
            flex: 1;
            padding: 30px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .message-group {
            display: flex;
            gap: 15px;
            max-width: 80%;
        }

        .message-group.sent {
            margin-left: auto;
            flex-direction: row-reverse;
        }

        .message-group.received {
            margin-right: auto;
            flex-direction: row-reverse;
        }

        .message-avatar {
            width: 45px;
            height: 45px;
            border-radius: 50%;
            background-size: cover;
            background-position: center;
            flex-shrink: 0;
        }

        .message-group.sent .message-avatar {
            display: none;
        }

        .message-content {
            display: flex;
            flex-direction: column;
        }

        .message-bubble {
            padding: 15px;
            border-radius: 18px;
            position: relative;
            max-width: 500px;
            animation: messageAppear 0.3s ease;
        }

        .message-group.sent .message-bubble {
            background: var(--message-sent);
            border-bottom-right-radius: 5px;
        }

        .message-group.received .message-bubble {
            background: var(--message-received);
            border-bottom-left-radius: 5px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }

        .message-info {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 5px;
        }

        .message-sender {
            font-weight: 500;
            font-size: 0.9rem;
        }

        .message-time {
            font-size: 0.8rem;
            opacity: 0.7;
        }

        .chat-input-container {
            padding: 20px;
            background: var(--surface);
        }

        .chat-input-wrapper {
            display: flex;
            gap: 15px;
            background: rgba(0, 0, 0, 0.05);
            padding: 15px;
            border-radius: 15px;
            align-items: flex-end;
        }

        .chat-input {
            flex: 1;
            background: none;
            border: none;
            color: var(--text);
            font-size: 1rem;
            padding: 10px;
            resize: none;
            max-height: 150px;
            outline: none;
        }

        .input-actions {
            display: flex;
            gap: 10px;
        }

        .action-btn {
            background: rgba(0, 0, 0, 0.1);
            border: none;
            color: var(--text);
            width: 40px;
            height: 40px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .action-btn:hover {
            background: rgba(0, 0, 0, 0.2);
            transform: translateY(-2px);
        }

        .send-btn {
            background: var(--primary);
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: 500;
        }

        .send-btn:hover {
            transform: translateY(-2px);
            filter: brightness(1.1);
        }

        @keyframes messageAppear {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        ::-webkit-scrollbar {
            width: 6px;
        }

        ::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.1);
        }

        ::-webkit-scrollbar-thumb {
            background: var(--primary);
            border-radius: 3px;
        }

        @media (max-width: 768px) {
            .sidebar {
                position: fixed;
                right: 0;
                top: 0;
                height: 100%;
                transform: translateX(100%);
                transition: transform 0.3s ease;
                z-index: 1000;
            }

            .sidebar.active {
                transform: translateX(0);
            }

            .message-group {
                max-width: 90%;
            }
        }

  
        .chat-header .header-actions {
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .chat-header .header-actions .action-btn {
            background: rgba(0, 0, 0, 0.1);
            border: none;
            color: var(--text);
            width: 40px;
            height: 40px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .chat-header .header-actions .action-btn:hover {
            background: rgba(0, 0, 0, 0.2);
            transform: translateY(-2px);
        }

        .chat-header .header-actions .action-btn i {
            font-size: 1.2rem;
        }

        .chat-header .header-actions .theme-toggle {
            background: rgba(0, 0, 0, 0.1);
            border: none;
            color: var(--text);
            width: 40px;
            height: 40px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .chat-header .header-actions .theme-toggle:hover {
            background: rgba(0, 0, 0, 0.2);
            transform: translateY(-2px);
        }

        .chat-header .header-actions .theme-toggle i {
            font-size: 1.2rem;
        }
        body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

.chat-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
}

.sidebar {
    width: 250px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        left: -100%;
        z-index: 999;
    }

    .sidebar.open {
        transform: translateX(100%);
    }

    .chat-container {
        flex-direction: column;
    }
}

.chat-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    color: inherit;
}

.room-info h2, .room-info span {
    font-size: 1.2rem;
}

.header-actions button {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.5rem;
    cursor: pointer;
}

.messages-container {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
}

.chat-input-container {
    padding: 10px 20px;
}

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

.chat-input {
    width: 100%;
    padding: 10px;
    margin-right: 10px;
    border-radius: 20px;
    border: 1px solid currentColor;
}

.send-btn {
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
}

.input-actions button {
    margin-left: 10px;
}

@media (max-width: 768px) {
    .header-actions button {
        font-size: 1.2rem;
    }

    .chat-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .chat-input {
        margin: 10px 0;
        height: 40px;
    }

    .send-btn {
        width: 100%;
    }
}
