       /* Base styles */
        *, *::before, *::after {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: Arial, sans-serif;
        }

        :root {
            --app-height: 100%;
            --message-bg-color:#005c4b
        }

        html, body {
            height: 100%;
            width: 100%;
            margin: 0;
            padding: 0;
            background-color: #121212;
            color: #fff;
            overflow: hidden;
            position: fixed;
            inset: 0;
        }

        .chat-app {
            display: flex;
            height: var(--app-height);
            width: 100%;
            position: fixed;
            inset: 0;
        }

        .sidebar {
            width: 30%;
            min-width: 300px;
            max-width: 420px;
            height: 100%;
            background-color: #202c33;
            border-right: 1px solid #30383d;
            display: flex;
            flex-direction: column;
            position: relative;
            z-index: 2;
        }

        .chat-area {
            flex: 1;
            height: 100%;
            background-color: #0b141a;
            display: flex;
            flex-direction: column;
            position: relative;
            overflow: hidden;
        }

        .profile {
            padding: 20px;
            text-align: center;
            background-color: #202c33;
            border-bottom: 1px solid #30383d;
        }

        .profile img {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            margin-bottom: 10px;
            object-fit: cover;
        }

        .profile h3 {
            color: #fff;
            font-size: 1.2em;
            margin: 0;
        }

        .users-list {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            background-color: #111b21;
        }

        .users-list h4 {
            color: #fff;
            padding: 15px;
            margin: 0;
            font-size: 1.1em;
            background-color: #202c33;
        }

        .search-box {
            padding: 8px 16px;
            background-color: #202c33;
            border-bottom: 1px solid rgba(134, 150, 160, 0.15);
        }

        .search-box input {
            width: 100%;
            padding: 8px 32px 8px 12px;
            border: none;
            border-radius: 8px;
            background-color: #2a3942;
            color: #d1d7db;
            font-size: 0.95em;
            outline: none;
        }

        .search-box input::placeholder {
            color: #8696a0;
        }

        .users-list ul {
            list-style: none;
            padding: 0;
            margin: 0;
            overflow-y: auto;
            flex: 1;
        }

        .users-list .user {
            display: flex;
            align-items: center;
            padding: 12px 16px;
            cursor: pointer;
            transition: all 0.3s ease;
            border-bottom: 1px solid rgba(134, 150, 160, 0.15);
            position: relative;
        }

        .users-list .user:hover,
        .users-list .user.active {
            background-color: #2a3942;
        }

        .users-list .user img {
            width: 49px;
            height: 49px;
            border-radius: 50%;
            margin-right: 15px;
            object-fit: cover;
        }

        .users-list .user .user-info {
            flex: 1;
            padding-right: 15px;
        }

        .users-list .user .user-name {
            color: #e9edef;
            font-size: 1.1em;
            margin-bottom: 3px;
            display: block;
        }

        .users-list .user .user-status {
            color: #8696a0;
            font-size: 0.9em;
            display: block;
        }

        .users-list .user .user-status.online {
            color: #00a884;
        }

        .users-list .user .online-indicator {

    width: 10px;
    height: 10px;
    background-color: #00a884;
    border-radius: 50%;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    border: 1.5px solid #111b21; /* Add this line to fix the edge */

        }


        /* Date Separator Styles */
        .date-separator {
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 20px 0;
            position: relative;
        }

        .date-separator span {
            background-color: #202c33;
            color: #8696a0;
            padding: 6px 12px;
            border-radius: 6px;
            font-size: 0.85em;
            position: relative;
            z-index: 1;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }

  .message {
    max-width: 65%;
    padding: 8px 12px;
    position: relative;
    word-wrap: break-word;
    font-size: 0.95em;
    line-height: 1.4;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    margin-bottom: 8px; /* Adds space between messages */
}

.message.sent {
    align-self: flex-end;
    background-color: var(--message-bg-color);
    color: #e9edef;
    border-radius: 12px 12px 0 12px; /* Creates tail on the bottom-right */
}

.message.received {
    align-self: flex-start;
    background-color: #202c33;
    color: #e9edef;
    border-radius: 12px 12px 12px 0; /* Creates tail on the bottom-left */
}

/* Adjusts the position of the timestamp */
.message-content + .message-time {
    margin-top: 4px;
    align-self: flex-end;
}
        .message-status {
            display: inline-flex;
            align-items: center;
            margin-left: 4px;
        }

        .message-status svg {
            width: 18px;
            height: 18px;
            fill: currentColor;
            margin-bottom: -2px;
        }

        .message.sent .message-status {
            color: #8696a0;
        }

        .message.sent .message-status.read {
            color: #53bdeb;
        }

        .message-time {
            font-size: 0.75em;
            color: rgba(233, 237, 239, 0.6);
            margin-top: 7px;
            display: inline-block;
        }

        .message-form {
            background-color: #202c33;
            padding: 10px 16px;
            display: flex;
            gap: 10px;
            align-items: center;
            border-top: 1px solid rgba(134, 150, 160, 0.15);
            position: sticky;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: 1000;
            /* Add padding for devices with home indicator */
            padding-bottom: calc(10px + env(safe-area-inset-bottom));
        }

        @supports (-webkit-touch-callout: none) {
            /* Additional styles for iOS devices */
            .chat-interface {
                padding-bottom: env(safe-area-inset-bottom);
            }

            .message-form {
                position: sticky;
                bottom: 0;
            }
        }

        .message-input-container {
            flex: 1;
            display: flex;
            align-items: center;
            background-color: #2a3942;
            border-radius: 8px;
            padding: 8px 12px;
        }

        .message-input-container input {
            flex: 1;
            background: none;
            border: none;
            color: #d1d7db;
            font-size: 0.95em;
            padding: 0 8px;
            outline: none;
        }

        .message-input-container input::placeholder {
            color: #8696a0;
        }

        .emoji-btn,
        .attachment-btn,
        .send-btn {
            background: none;
            border: none;
            color: #8696a0;
            font-size: 1.4em;
            cursor: pointer;
            padding: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: color 0.2s;
        }

        .emoji-btn svg {
            width: 24px;
            height: 24px;
            fill: currentColor;
        }

        .emoji-btn:hover,
        .attachment-btn:hover,
        .send-btn:hover {
            color: #00a884;
        }

        .send-btn svg {
            width: 24px;
            height: 24px;
            fill: currentColor;
            transform: rotate(-45deg);
        }

        .send-btn {
            color: #00a884;
            font-size: 1.2em;
            padding: 8px;
        }

        .emoji-picker-container {
            position: absolute;
            bottom: 70px;
            left: 16px;
            z-index: 1000;
            display: none;
        }

        .emoji-picker-container.active {
            display: block;
        }

        /* Add styles for emoji-picker-element */
        emoji-picker {
            --num-columns: 8;
            width: 320px;
            height: 400px;
        }

        /* Welcome Screen */
        .welcome-screen {
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: #222e35;
            z-index: 1;
        }

        .welcome-content {
            text-align: center;
            padding: 40px;
            max-width: 560px;
        }

        .welcome-content img {
            width: 250px;
            height: 250px;
            margin-bottom: 32px;
            filter: invert(55%) sepia(59%) saturate(434%) hue-rotate(116deg) brightness(95%) contrast(101%);
        }

        .welcome-content h1 {
            color: #e9edef;
            font-size: 2em;
            margin-bottom: 16px;
        }

        .welcome-content p {
            color: #8696a0;
            font-size: 1.1em;
        }

        /* Chat Header */
        .chat-header {
            display: flex;
            align-items: center;
            padding: 16px;
            background-color: #202c33;
            border-bottom: 1px solid #30383d;
            position: relative;
        }

        .chat-header img {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin-right: 15px;
            object-fit: cover;
        }

        .chat-header .user-info {
            flex: 1;
        }

        .chat-header .online-indicator {
            right: 20px;
        }

        .chat-header .user-status.online {
            color: #00a884;
            display: flex;
            align-items: center;
        }

        .chat-header .user-status.online::before {
            content: '';
            display: inline-block;
            width: 8px;
            height: 8px;
            background-color: #00ff00;
            border-radius: 50%;
            margin-right: 5px;
        }

        .header-emoji-btn {
            background: none;
            border: none;
            padding: 8px;
            cursor: pointer;
            margin-left: auto;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: opacity 0.2s;
        }

        .header-emoji-btn:hover {
            opacity: 0.8;
        }

        .header-emoji-btn svg {
            width: 24px;
            height: 24px;
            fill: #aebac1;
        }

        /* Scrollbar Styles */
        ::-webkit-scrollbar {
            width: 6px;
        }

        ::-webkit-scrollbar-track {
            background: #111b21;
        }

        ::-webkit-scrollbar-thumb {
            background: #374045;
            border-radius: 3px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: #435055;
        }

        /* Chat Interface */
        .chat-interface {
            display: none;  /* Initially hidden */
            flex: 1;
            flex-direction: column;
            height: 100%;
            position: relative;
        }

        .message {
            max-width: 65%;
            padding: 8px 12px;
            border-radius: 8px;
            position: relative;
            word-wrap: break-word;
            font-size: 0.95em;
            line-height: 1.4;
        }

        .message.sent {
            background-color:var(--message-bg-color);
            color: #e9edef;
            margin-left: auto;
            border-radius: 8px 8px 0 8px;
        }

        .message.received {
            background-color: #202c33;
            color: #e9edef;
            margin-right: auto;
            border-radius: 8px 8px 8px 0;
        }


        .message-time {
            font-size: 0.75em;
            color: rgba(233, 237, 239, 0.6);
            position: relative;
            align-self: flex-end;
        }

        .message-form {
            background-color: #202c33;
            padding: 10px 16px;
            display: flex;
            gap: 10px;
            align-items: center;
            border-top: 1px solid rgba(134, 150, 160, 0.15);
        }

        .message-input-container {
            flex: 1;
            display: flex;
            align-items: center;
            background-color: #2a3942;
            border-radius: 8px;
            padding: 8px 12px;
        }

        .message-input-container input {
            flex: 1;
            background: none;
            border: none;
            color: #d1d7db;
            font-size: 0.95em;
            padding: 0 8px;
            outline: none;
        }

        .message-input-container input::placeholder {
            color: #8696a0;
        }

        .emoji-btn,
        .attachment-btn,
        .send-btn {
            background: none;
            border: none;
            color: #8696a0;
            font-size: 1.4em;
            cursor: pointer;
            padding: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: color 0.2s;
        }

        .emoji-btn:hover,
        .attachment-btn:hover,
        .send-btn:hover {
            color: #00a884;
        }

        .send-btn {
            color: #00a884;
            font-size: 1.2em;
        }

        /* Welcome screen styles */
        .welcome-screen {
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: #222e35;
            z-index: 0;
        }

        .welcome-content {
            text-align: center;
            padding: 40px;
            max-width: 560px;
        }

        .welcome-content img {
            width: 250px;
            height: 250px;
            margin-bottom: 32px;
        }

        .welcome-content h1 {
            color: #e9edef;
            font-size: 2em;
            margin-bottom: 16px;
        }

        .welcome-content p {
            color: #8696a0;
            font-size: 1.1em;
        }

        .attachment-btn svg {
            width: 24px;
            height: 24px;
            fill: currentColor;
        }

        .message-content {
            display: inline-flex;
            align-items: flex-end;
            margin-right:10px;
            gap: 4px;
        }

        /* Mobile Responsive Styles */
        @media (max-width: 768px) {
            .chat-area {
                width: 100%;
                height: var(--app-height);
                display: flex;
                flex-direction: column;
            }

            .chat-interface {
                width: 100%;
                height: 100%;
                display: flex;
                flex-direction: column;
            }

            .messages {
                flex: 1 1 0%;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
                position: relative;
                padding: 16px;
            }

            .message-form {
                width: 100%;
                flex: 0 0 auto;
                background-color: #202c33;
                padding: 8px;
                z-index: 1000;
                position: sticky;
                bottom: 0;
                left: 0;
                right: 0;
                display: flex;
                gap: 8px;
                align-items: center;
                border-top: 1px solid rgba(134, 150, 160, 0.15);
            }

            .message-input-container {
                flex: 1;
                background-color: #2a3942;
                border-radius: 8px;
                padding: 8px 12px;
                min-height: 40px;
                display: flex;
                align-items: center;
            }

            .message-input-container input {
                width: 100%;
                background: none;
                border: none;
                color: #d1d7db;
                font-size: 16px;
                padding: 0;
                outline: none;
                line-height: 24px;
            }

            /* Handle keyboard open state */
            body.keyboard-open .chat-interface {
                height: 100%;
            }

            body.keyboard-open .messages {
                padding-bottom: 8px;
            }

            body.keyboard-open .message-form {
                padding-bottom: 8px;
            }

            /* iOS specific adjustments */
            @supports (-webkit-touch-callout: none) {
                .chat-area {
                    height: -webkit-fill-available;
                }

                .message-form {
                    padding-bottom: max(8px, env(safe-area-inset-bottom));
                }
            }
        }

        /* Small Mobile Devices */
        @media (max-width: 480px) {
            .message {
                max-width: 90%;
                font-size: 0.85em;
            }

            .profile h3 {
                font-size: 1.1em;
            }

            .users-list .user .user-name {
                font-size: 1em;
            }

            .users-list .user .user-status {
                font-size: 0.8em;
            }

            .message-form {
                padding: 8px;
            }

            .emoji-btn,
            .attachment-btn,
            .send-btn {
                padding: 3px;
            }
        }

        /* Hide chat area when no user is selected on mobile */
        @media (max-width: 768px) {
            .chat-area:not(.active) {
                display: none;
            }

            .sidebar:not(.active) + .chat-area.active {
                display: flex;
            }
        }

        /* Additional Mobile Styles */
        @media (max-width: 768px) {
            .chat-header {
                padding: 12px;
                position: relative;
                z-index: 2;
            }

            .chat-header .back-button {
                display: flex;
                align-items: center;
                justify-content: center;
                width: 32px;
                height: 32px;
                margin-right: 10px;
                border: none;
                background: none;
                color: white;
                cursor: pointer;
                padding: 0;
            }

            .chat-header img {
                width: 35px;
                height: 35px;
            }

            .message {
                max-width: 85%;
                padding: 8px 12px;
                font-size: 0.95em;
            }

            .profile {
                padding: 12px;
            }

            .profile img {
                width: 40px;
                height: 40px;
            }

            .users-list .user {
                padding: 12px;
            }

            .users-list .user img {
                width: 40px;
                height: 40px;
            }

            .message-input-container {
                padding: 6px 8px;
            }

            .message-input-container input {
                font-size: 0.95em;
                padding: 8px;
            }

            .emoji-btn,
            .attachment-btn,
            .send-btn {
                padding: 6px;
            }

            .emoji-btn svg,
            .attachment-btn svg,
            .send-btn svg {
                width: 24px;
                height: 24px;
            }

            body.mobile-view {
                overflow: hidden;
                position: fixed;
                width: 100%;
                height: 100%;
            }

            .search-box {
                padding: 8px 12px;
            }

            .search-box input {
                padding: 8px 12px;
                font-size: 0.95em;
            }

            /* Ensure content is visible */
            .chat-app,
            .sidebar,
            .chat-area,
            .chat-interface {
                background-color: #202c33;
            }

            .messages {
                background-color: #0b141a;
            }
        }

        /* Smaller screens */
        @media (max-width: 480px) {
            .message {
                max-width: 90%;
                font-size: 0.9em;
            }

            .message-form {
                padding: 8px;
            }

            .emoji-btn,
            .attachment-btn,
            .send-btn {
                padding: 4px;
            }

            .profile h3 {
                font-size: 1em;
            }

            .users-list .user .user-name {
                font-size: 0.95em;
            }

            .users-list .user .user-status {
                font-size: 0.8em;
            }
        }

        /* Mobile-specific styles */
        @media (max-width: 768px) {
            .chat-area {
                height: 100%;
                display: flex;
                flex-direction: column;
                overflow: hidden;
            }

            .chat-interface {
                height: 100%;
                display: flex;
                flex-direction: column;
                overflow: hidden;
            }

            .messages {
                flex: 1;
                height: 0; /* This forces the messages container to take remaining space */
                min-height: 0; /* Allows container to shrink if needed */
                overflow-y: auto;
                padding-bottom: 16px;
                margin-bottom: env(safe-area-inset-bottom);
            }

            .message-form {
                flex-shrink: 0; /* Prevent form from shrinking */
                position: sticky;
                bottom: 0;
                left: 0;
                right: 0;
                background-color: #202c33;
                padding: 8px 12px;
                padding-bottom: max(8px, env(safe-area-inset-bottom));
                margin-top: auto; /* Push form to bottom */
                z-index: 1000;
            }

            .message-input-container {
                flex: 1;
                position: relative;
                z-index: 1001;
            }

            /* Ensure the input is always visible */
            .message-input-container input:focus {
                position: relative;
                z-index: 1001;
            }

            /* Handle keyboard appearance */
            body.keyboard-open {
                height: 100%;
                position: fixed;
                overflow: hidden;
            }

            body.keyboard-open .chat-interface {
                height: 100%;
                padding-bottom: 0;
            }

            body.keyboard-open .messages {
                padding-bottom: 8px;
            }

            body.keyboard-open .message-form {
                position: sticky;
                bottom: 0;
                padding-bottom: 8px;
            }

            /* Ensure proper height on iOS */
            @supports (-webkit-touch-callout: none) {
                .chat-area {
                    height: -webkit-fill-available;
                }

                .chat-interface {
                    height: -webkit-fill-available;
                }

                .messages {
                    height: auto;
                    flex: 1;
                }
            }
        }

        /* Additional mobile adjustments for very small screens */
        @media (max-width: 380px) {
            .message-form {
                padding: 6px 8px;
            }

            .message-input-container {
                padding: 4px 8px;
            }

            .message-input-container input {
                font-size: 16px; /* Prevent iOS zoom */
            }
        }

        .emoji-dropdown {
            position: absolute;
            top: 100%;
            right: 10px;
            background-color: #2a3942;
            border-radius: 8px;
            padding: 8px;
            display: none;
            flex-direction: row;
            gap: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
            z-index: 1000;
        }

        .emoji-dropdown.show {
            display: flex;
        }

        .emoji-option {
            background: none;
            border: none;
            padding: 8px;
            cursor: pointer;
            border-radius: 6px;
            transition: all 0.2s;
        }

        .emoji-option:hover {
            background-color: #384650;
            transform: scale(1.1);
        }

        .emoji-option svg {
            width: 24px;
            height: 24px;
            fill: #aebac1;
        }



/*saqlain*/

/* Reset & Base Styles */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

html, body {
    height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    background-color: #0b141a;
    color: #e9edef;
    overflow: hidden;
}

/* Chat App Container */
.chat-app {
    display: flex;
    height: 100vh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
}

/* Sidebar Styles */
.sidebar {
    width: 30%;
    min-width: 300px;
    max-width: 420px;
    height: 100%;
    background-color: #202c33;
    border-right: 1px solid #30383d;
    display: flex;
    flex-direction: column;
}

.profile {
    padding: 20px;
    text-align: center;
    background-color: #202c33;
    border-bottom: 1px solid #30383d;
}

.profile img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 10px;
    object-fit: cover;
}

.profile h3 {
    color: #fff;
    font-size: 1.2em;
    margin: 0;
}

.users-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.users-list h4 {
    color: #fff;
    padding: 15px;
    margin: 0;
    font-size: 1.1em;
}

.search-box {
    padding: 10px 15px;
    background-color: #202c33;
}

.search-box input {
    width: 100%;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    background-color: #323739;
    color: #fff;
    font-size: 0.95em;
}

.search-box input::placeholder {
    color: #8696a0;
}

.users-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}

.users-list li {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #30383d;
}

.users-list li:hover,
.users-list li.active {
    background-color: #2a3942;
}

.users-list li img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
}

.users-list li .user-info {
    flex: 1;
    min-width: 0;
}

.users-list li .user-name {
    color: #fff;
    font-size: 1em;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.users-list li .user-status {
    color: #8696a0;
    font-size: 0.85em;
    margin-left: 15px;
}

.users-list li .online {
    background-color: #25D366;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 10px;
    flex-shrink: 0;
}

/* Chat Area */
.chat-area {
    flex: 1;
    height: 100%;
    background-color: #0b141a;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Welcome Screen */
.welcome-screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #202c33;
    z-index: 1;
}

.welcome-content {
    text-align: center;
    padding: 30px;
}

.welcome-content img {
    width: 250px;
    height: 250px;
    margin-bottom: 30px;
}

.welcome-content h1 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 2em;
}

.welcome-content p {
    color: #8696a0;
    font-size: 1.1em;
}

/* Chat Interface */
.chat-interface {
    display: none;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #202c33;
    border-bottom: 1px solid #30383d;
}

.chat-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
}

.chat-header div {
    flex: 1;
}

.chat-header h4 {
    color: #fff;
    margin: 0 0 3px 0;
    font-size: 1.1em;
}

.chat-header small {
    color: #8696a0;
    font-size: 0.85em;
}

/* Messages Area */
.messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    flex-direction: column;
    
    gap: 4px;
background:linear-gradient(rgba(11, 20, 26, 0.8), rgba(11, 20, 26, 0.9)),   url('../images/background.jpg');

      background-position: center center;   /* center the image */
  background-size: cover;               /* make it cover the entire container */
  height: 100vh;                        /* adjust as needed */
}

.message {
    max-width: 65%;
    margin: 2px 15px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.message.sent {
    align-self: flex-end;
    background-color: var(--message-bg-color);
    border-radius: 7.5px 0 7.5px 7.5px;
}

.message.received {
    align-self: flex-start;
    background-color: #202c33;
    border-radius: 0 7.5px 7.5px 7.5px;
}

.message .message-content {
    padding: 0px 7px 5px 9px;
    color: #e9edef;
}

.message .message-content p {
    margin: 0;
    word-wrap: break-word;
}

.message .time {
    font-size: 0.75rem;
    color: #8696a0;
    margin-left: auto;
}



/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: #374045;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #4a545a;
}

/* Auth Pages */
.center-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #111b21;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyBAMAAADsEZWCAAAAG1BMVEUAAAAhISEhISEhISEhISEhISEhISEhISEhISGmEcQKAAAACXBIWXMAAAABAAAAAQBPJcTWAAAAFElEQVQ4jWNgYBBkHAWjYBSMgsEPABH5AqHs/P3VAAAAAElFTkSuQmCC');
    background-repeat: repeat;
    background-size: 100px;
}

.auth-box {
    background-color: #202c33;
    padding: 2rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin: 1rem;
}

.auth-box h2 {
    color: #e9edef;
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.auth-box form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-box input[type="text"],
.auth-box input[type="password"] {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background-color: #2a3942;
    color: #d1d7db;
    font-size: 1rem;
    outline: none;
    transition: background-color 0.2s;
}

.auth-box input[type="text"]:focus,
.auth-box input[type="password"]:focus {
    background-color: #323f47;
}

.auth-box input[type="file"] {
    color: #8696a0;
    font-size: 0.9rem;
    padding: 8px;
}

.auth-box input::placeholder {
    color: #8696a0;
}

.auth-box button {
    background-color: #00a884;
    color: #fff;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 0.5rem;
}

.auth-box button:hover {
    background-color: #008f72;
}

.auth-box p {
    text-align: center;
    margin-top: 1rem;
    color: #8696a0;
}

.auth-box a {
    color: #00a884;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-box a:hover {
    color: #008f72;
    text-decoration: underline;
}

#error-message {
    color: #ff6b6b !important;
    background-color: rgba(255, 107, 107, 0.1);
    padding: 8px;
    border-radius: 4px;
    text-align: center;
    margin-top: 1rem;
}

/* Custom file input styling */
.auth-box input[type="file"] {
    background-color: #2a3942;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
}

.auth-box input[type="file"]::-webkit-file-upload-button {
    background-color: #00a884;
    color: #fff;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 12px;
    transition: background-color 0.2s;
}

.auth-box input[type="file"]::-webkit-file-upload-button:hover {
    background-color: #008f72;
}

.user-status.online {
    color: #00a884;
    font-weight: 500;
}

.online-indicator {
    width: 10px;
    height: 10px;
    background-color: #00a884;
    border-radius: 50%;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.message .message-info {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: #8696a0;
    margin-top: 2px;
}

.message .status {
    display: flex;
    align-items: center;
}

.message .status i {
    font-size: 0.9rem;
    color: #8696a0;
}

.message .status i.text-blue {
    color: #53bdeb;
}

/* Mobile viewport fixes */
@media screen and (max-width: 768px) {
    body {
        height: 100%;
        /* Prevent bounce scroll on iOS */
        position: fixed;
        width: 100%;
        overflow: hidden;
    }

    .container {
        /* Use dynamic viewport height to account for mobile browser chrome */
        height: -webkit-fill-available;
        height: 100dvh; /* Modern viewport units */
        padding-bottom: env(safe-area-inset-bottom); /* Account for iPhone notch */
    }

    .chat-area {
        /* Ensure chat area uses available space */
        height: -webkit-fill-available;
        height: 100dvh;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .messages {
        /* Adjust messages area to leave space for input */
        padding-bottom: 80px; /* Increased padding to ensure messages don't hide behind input */
    }

    .message-form {
        /* Fix input position */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: #202c33;
        padding: 10px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom)); /* Add padding for iPhone notch */
        z-index: 1000;
    }

    /* Ensure chat interface uses full height */
    .chat-interface {
        height: -webkit-fill-available;
        height: 100dvh;
    }
}

/* High-priority Message Background Styles */
body .chat-app .chat-area .messages[data-bg="background.jpg"] .message.sent .message-content {
    background-color: var(--message-bg-color) !important;
}

body .chat-app .chat-area .messages[data-bg="happy-background.jpg"] .message.sent .message-content {
    background-color: var(--message-bg-color) !important;
}

body .chat-app .chat-area .messages[data-bg="sad-background.jpg"] .message.sent .message-content {
    background-color: var(--message-bg-color) !important;
}


/* Parent message styles (for replies) - WhatsApp mobile style */
.parent-message {
    background-color: rgba(0, 0, 0, 0.15);
    border-left: 4px solid #00a884;
    padding: 8px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    position: relative;
}

.message.sent .parent-message {
    background-color: rgba(0, 0, 0, 0.2);
    border-left-color: #ffffff;
}

.message.received .parent-message {
    background-color: rgba(255, 255, 255, 0.08);
    border-left-color: #00a884;
}




.parent-message .reply-text {
    color: #8696a0;
    font-size: 1.2em;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 2.4em;
}

/* Reactions styles */
.message-reactions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.message-reactions span {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.75em;
    color: #d1d7db;
}

/* Reaction options overlay */
.reaction-options {
    position: absolute;
    top: -40px;
    right: 0;
    background-color: #2a3942;
    border-radius: 20px;
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.reaction-options span {
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: transform 0.2s;
    font-size: 1.2em;
}

.reaction-options span:hover {
    transform: scale(1.2);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Reply indicator */
.message.reply {
    margin-left: 20px;
}



/* Context menu for message actions */
.message-context-menu {
    position: absolute;
    background-color: #2a3942;
    border-radius: 8px;
    padding: 8px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 120px;
}

.message-context-menu .menu-item {
    padding: 8px 16px;
    cursor: pointer;
    color: #d1d7db;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.message-context-menu .menu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.message-context-menu .menu-item i {
    margin-right: 8px;
    width: 16px;
}

/* --- WhatsApp Web Style Reply Indicator --- */
.reply-indicator {
    background: #202c33;
    border-top: 1px solid #222d34;
    border-left: 4px solid #25d366;
    border-radius: 8px 8px 0 0;
    padding: 10px 16px 10px 12px;
    display: none !important;
    position: relative;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.10);
    margin-bottom: 2px;
    min-height: 54px;
    transition: box-shadow 0.2s;
    z-index: 2;
}
.reply-indicator.active {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    animation: slideUpFade 0.2s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 -2px 12px rgba(37,211,102,0.08);
}
.reply-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 12px;
    background: transparent;
    border-left: none;
    border-radius: 0;
    margin-right: 10px;
    min-width: 0;
}
.reply-to {
    color: #25d366;
    font-size: 0.78em;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: 0.2px;
    text-transform: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.reply-to::before {
    content: '';
    display: none;
}
.reply-content {
    color: #d1d7db;
    font-size: 0.97em;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
    font-weight: 400;
    opacity: 0.95;
}
.reply-close {
    background: transparent;
    border: none;
    color: #8696a0;
    cursor: pointer;
    padding: 0;
    font-size: 1.5em;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    margin-left: 8px;
}
.reply-close:hover {
    color: #25d366;
    background: rgba(37,211,102,0.08);
    box-shadow: 0 2px 8px rgba(37,211,102,0.10);
}
.reply-close:active {
    color: #128c7e;
    background: rgba(37,211,102,0.15);
}
.reply-indicator::after {
    display: none;
}
@media screen and (max-width: 768px) {
    .reply-indicator {
        padding: 8px 8px 8px 6px;
        min-height: 44px;
    }
    .reply-info {
        padding: 0 6px;
        margin-right: 6px;
    }
    .reply-content {
        max-width: 160px;
        font-size: 0.92em;
    }
    .reply-close {
        width: 28px;
        height: 28px;
        font-size: 1.1em;
    }
}
/* --- End WhatsApp Web Style Reply Indicator --- */

/* --- WhatsApp Web Style Reactions --- */
.reaction-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    margin-left: 6px;
    border-radius: 50%;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}
.reaction-btn:hover,
.reaction-btn:focus {
    background: rgba(37,211,102,0.10);
}

.message-reactions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
    padding-left: 2px;
}
.message-reactions span {
    background: #222e35;
    border: 1px solid #222e35;
    color: #25d366;
    padding: 2px 8px 2px 6px;
    border-radius: 16px;
    font-size: 0.95em;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    transition: background 0.15s, border 0.15s, color 0.15s;
    user-select: none;
}
.message-reactions span.my-reaction {
    background: #25d366;
    color: #fff;
    border: 1px solid #25d366;
}
.message-reactions span:hover {
    background: #25d36622;
    border: 1px solid #25d366;
    color: #25d366;
}

.reaction-options {
    position: absolute;
    top: -44px;
    left: 0;
    background: #222e35;
    border-radius: 24px;
    padding: 8px 12px;
    display: flex;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    z-index: 1000;
    border: 1px solid #222e35;
}
.reaction-options span {
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    font-size: 1.3em;
    transition: background 0.15s, transform 0.15s;
}
.reaction-options span:hover {
    background: #25d36622;
    transform: scale(1.2);
}
@media (max-width: 768px) {
    .reaction-options {
        top: -38px;
        padding: 6px 8px;
        gap: 6px;
    }
    .reaction-options span {
        font-size: 1.1em;
    }
    .message-reactions span {
        font-size: 0.92em;
        padding: 2px 6px 2px 5px;
    }
}
/* Styles for the new EmojiMart Picker */
.emoji-picker-container {
    display: none;
    position: absolute;
    bottom: 65px; /* Position it above the message form */
    left: 10px;
    right: 10px; /* Let it span the width on mobile */
    z-index: 1001;
    max-height: 40vh; /* Set a max height relative to viewport */
    overflow-y: hidden; /* Container itself should not scroll */
}

.emoji-picker-container.active {
    display: block;
}

/* On desktop, give it a more controlled width */
@media (min-width: 769px) {
    .emoji-picker-container {
        max-width: 350px;
        right: auto;
    }
}
/* --- Profile Edit Button --- */
.profile-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#editProfileBtn {
    background: none;
    border: none;
    color: #8696a0;
    cursor: pointer;
    font-size: 1em;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

#editProfileBtn:hover {
    background-color: #2a3942;
    color: #fff;
}

/* --- Profile Modal Styles --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
}

.modal-content {
    background-color: #202c33;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #30383d;
    width: 80%;
    max-width: 400px;
    border-radius: 10px;
    position: relative;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-btn:hover,
.close-btn:focus {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

#profileForm .form-group {
    margin-bottom: 15px;
}

#profileForm label {
    display: block;
    margin-bottom: 5px;
    color: #8696a0;
}

#profileForm input[type="text"],
#profileForm input[type="file"] {
    width: 100%;
    padding: 10px;
    background-color: #2a3942;
    border: 1px solid #30383d;
    border-radius: 5px;
    color: #fff;
}

#profileForm button {
    background-color: #00a884;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    font-size: 1em;
}

#profileForm button:hover {
    background-color: #008f72;
}

#profilePicPreview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-top: 10px;
    border: 2px solid #30383d;
}
/* --- Theme Switcher Styles --- */
.header-emoji-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    margin-left: auto;
    color: #8696a0;
    transition: color 0.2s;
}
.header-emoji-btn:hover {
    color: #e9edef;
}
.header-emoji-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}
.emoji-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 10px;
    background-color: #2a3942;
    border-radius: 8px;
    padding: 8px;
    flex-direction: row;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}
.emoji-dropdown.show {
    display: flex;
}
.emoji-option {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}
.emoji-option:hover {
    background-color: #384650;
    transform: scale(1.1);
}
.emoji-option svg {
    width: 24px;
    height: 24px;
    fill: #aebac1;
}

/* --- Dynamic Backgrounds for Messages --- */
.messages {
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.messages[data-bg="background.jpg"] {
    background-image: linear-gradient(rgba(11, 20, 26, 0.8), rgba(11, 20, 26, 0.9)), url('../images/background.jpg');
}

.messages[data-bg="happy-background.jpg"] {
    background-image: linear-gradient(rgba(11, 20, 26, 0.8), rgba(11, 20, 26, 0.9)), url('../images/happy-background.jpg');
}

.messages[data-bg="sad-background.jpg"] {
    background-image: linear-gradient(rgba(11, 20, 26, 0.8), rgba(11, 20, 26, 0.9)), url('../images/sad-background.jpg');
}
/* --- End WhatsApp Web Style Reactions --- */
