* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Lucida Console', Monaco, monospace;
}

body {
    background-color: #27181d;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    color: #fff;
}

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(253, 48, 161, 0.3);
    animation: float 10s infinite ease-in-out;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(20px, 20px);
    }
    50% {
        transform: translate(10px, 40px);
    }
    75% {
        transform: translate(-20px, 20px);
    }
}

.chat-container {
    display: flex;
    width: 100%;
    max-width: 1400px;
    height: 90vh;
    margin: 20px auto;
    background-color: rgba(89, 60, 70, 0.8);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(253, 48, 161, 0.5);
}

.sidebar {
    width: 300px;
    background-color: rgba(39, 24, 29, 0.9);
    border-right: 1px solid #4e1132;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #4e1132;
}

.sidebar-title {
    font-size: 1.5rem;
    color: #FD30a1;
    font-weight: bold;
    margin-bottom: 10px;
}

.online-count {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 15px;
}

.bot-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.bot-button {
    padding: 12px;
    border-radius: 8px;
    background-color: #4e1132;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    text-align: left;
}

.bot-button:hover {
    background-color: #e41e8d;
    box-shadow: 0 0 15px rgba(253, 48, 161, 0.5);
}

.bot-button i {
    font-size: 1.2rem;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-bottom: 10px;
}

.contact-item:hover {
    background-color: rgba(253, 48, 161, 0.1);
}

.contact-item.active {
    background-color: rgba(253, 48, 161, 0.2);
    border-left: 3px solid #FD30a1;
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #4e1132;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    position: relative;
}

.online-indicator {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #0f0;
    bottom: 0;
    right: 0;
    border: 2px solid #27181d;
}

.offline-indicator {
    background-color: #aaa;
}

.contact-info {
    flex: 1;
}

.contact-name {
    font-weight: bold;
    margin-bottom: 3px;
}

.contact-status {
    font-size: 0.8rem;
    color: #aaa;
}

.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: rgba(39, 24, 29, 0.7);
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #4e1132;
}

.chat-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #FD30a1;
}

.chat-status {
    font-size: 0.9rem;
    color: #0f0;
    margin-top: 5px;
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.welcome-message {
    text-align: center;
    color: #aaa;
    margin-top: 30px;
    font-style: italic;
}

.message {
    max-width: 70%;
    padding: 12px 15px;
    border-radius: 15px;
    margin-bottom: 15px;
    position: relative;
}

.message.sent {
    background-color: #4e1132;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.message.received {
    background-color: rgba(78, 17, 50, 0.5);
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.message-time {
    font-size: 0.7rem;
    color: #aaa;
    text-align: right;
    margin-top: 5px;
}

.input-container {
    padding: 15px;
    border-top: 1px solid #4e1132;
}

.input-wrapper {
    display: flex;
    background-color: rgba(39, 24, 29, 0.9);
    border-radius: 25px;
    padding: 5px 15px;
    border: 1px solid #4e1132;
}

.message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 10px;
    outline: none;
}

.send-button {
    background: none;
    border: none;
    color: #FD30a1;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 10px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: rgba(89, 60, 70, 0.95);
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 30px rgba(253, 48, 161, 0.5);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #FD30a1;
    background: none;
    border: none;
}

.modal-title {
    color: #FD30a1;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
}

.modal-subtitle {
    color: #aaa;
    text-align: center;
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.platform-selector {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.platform-card {
    background-color: rgba(39, 24, 29, 0.7);
    border: 2px solid #4e1132;
    border-radius: 10px;
    padding: 20px;
    width: 180px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.platform-card:hover {
    transform: translateY(-5px);
    border-color: #FD30a1;
    box-shadow: 0 0 20px rgba(253, 48, 161, 0.3);
}

.platform-card.selected {
    border-color: #FD30a1;
    background-color: rgba(253, 48, 161, 0.1);
}

.platform-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    color: #FD30a1;
}

.platform-name {
    color: #fff;
    font-weight: bold;
    margin-bottom: 5px;
}

.platform-desc {
    color: #aaa;
    font-size: 0.85rem;
    margin-bottom: 10px;
    min-height: 40px;
}

.platform-url {
    color: #FD30a1;
    font-size: 0.8rem;
    word-break: break-all;
    background-color: rgba(39, 24, 29, 0.7);
    padding: 5px;
    border-radius: 5px;
    margin-top: 10px;
}

.bot-config-form {
    display: none;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: #FD30a1;
    font-weight: bold;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #4e1132;
    border-radius: 5px;
    background-color: rgba(39, 24, 29, 0.8);
    color: #fff;
    font-size: 1rem;
}

.form-input:focus {
    outline: none;
    border-color: #FD30a1;
    box-shadow: 0 0 0 2px rgba(253, 48, 161, 0.3);
}

.form-note {
    color: #aaa;
    font-size: 0.85rem;
    margin-top: 5px;
    display: block;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-button {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.modal-button.connect {
    background-color: #FD30a1;
    color: white;
}

.modal-button.cancel {
    background-color: transparent;
    color: #FD30a1;
    border: 1px solid #FD30a1;
}

.modal-button.connect:hover {
    background-color: #e41e8d;
    box-shadow: 0 0 15px rgba(253, 48, 161, 0.5);
}

.modal-button.cancel:hover {
    background-color: rgba(253, 48, 161, 0.1);
}

.user-controls {
    margin-top: 20px;
    padding: 20px;
    background-color: rgba(39, 24, 29, 0.7);
    border-radius: 8px;
    border: 1px solid #4e1132;
}

.user-controls .title {
    color: #FD30a1;
    margin-bottom: 15px;
    font-size: 1.2rem;
    text-align: center;
}

.no-bots {
    text-align: center;
    color: #aaa;
    padding: 20px;
    font-style: italic;
}

.logout-button {
    background-color: #4e1132;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    width: 100%;
}

.logout-button:hover {
    background-color: #e41e8d;
}
 @media (max-width: 768px) {
                .sidebar {
                    position: fixed;
                    top: 0;
                    left: 0;
                    height: 100%;
                    z-index: 1000;
                    transform: translateX(-100%);
                    width: 280px;
                    min-width: 280px;
                    transition: transform 0.3s ease-out; 
                }

                .sidebar.active {
                    transform: translateX(0);
                }

                .mobile-header {
                    display: flex;
                }

                .chat-header {
                    display: none;
                }

                .main-chat {
                    width: 100%;
                }

                .messages-container {
                    padding: 15px;
                }

                .input-container {
                    padding: 15px;
                }

                .bridge-modal-content {
                    padding: 20px;
                    max-width: 95%;
                }

                .bridge-options {
                    gap: 15px;
                }

                .bridge-option-card {
                    flex-direction: column;
                    text-align: center;
                    gap: 15px;
                    padding: 15px;
                }

                .bridge-option-icon {
                    width: 50px;
                    height: 50px;
                    font-size: 20px;
                }

                .mqtt-config-content {
                    padding: 20px;
                    max-width: 95%;
                }

                .sidebar-header {
                    padding-bottom: 80px;
                }

                .bridge-container, .logout-button {
                    font-size: 12px;
                }

                .bridge-button {
                    padding: 8px 12px;
                    font-size: 12px;
                }
            }

            /* Tablet Styles */
            @media (min-width: 769px) and (max-width: 1024px) {
                .sidebar {
                    width: 280px;
                    min-width: 240px;
                }

                .bridge-modal-content {
                    max-width: 80%;
                }

                .mqtt-config-content {
                    max-width: 70%;
                }
            }

            /* Large Desktop Styles */
            @media (min-width: 1400px) {
                .sidebar {
                    width: 350px;
                    min-width: 320px;
                }

                .sidebar-title {
                    font-size: 20px;
                }

                .chat-title {
                    font-size: 22px;
                }

                .bridge-modal-content {
                    max-width: 700px;
                    padding: 40px;
                }

                .mqtt-config-content {
                    max-width: 600px;
                    padding: 40px;
                }
            }

            .mobile-overlay {
                display: none;
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: rgba(0, 0, 0, 0.5);
                z-index: 999;
            }

            @media (max-width: 768px) {
                .mobile-overlay.active {
                    display: block;
                }
            }


.mobile-menu-icon {
    display: none; 
    font-size: 24px;
    color: #e0e0e0;
    cursor: pointer;
    padding: 10px;
    width: 44px;
    height: 44px;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.4);
    position: fixed; 
    top: 15px; 
    left: 15px; 
    z-index: 1001; 
    transition: background-color 0.2s ease;
}

.mobile-menu-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .mobile-menu-icon {
        display: flex; 
    }
}

 .attachments-container {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            padding: 10px;
            background: #322027;
            border-radius: 8px;
            margin-bottom: 10px;
            max-height: 150px;
            overflow-y: auto;
        }

        .attachment-preview {
            position: relative;
            width: 80px;
            height: 80px;
            border-radius: 4px;
            overflow: hidden;
            background: #fff;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }

        .attachment-preview img, 
        .attachment-preview video {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .attachment-preview .file-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            height: 100%;
        }

        .remove-attachment {
            position: absolute;
            top: 0;
            right: 0;
            background: rgba(0,0,0,0.5);
            color: white;
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 0 0 0 4px;
            cursor: pointer;
        }

        .message-input-container {
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .upload-button {
            background: #fd30a1;
            color: white;
            border: none;
            border-radius: 50%;
            width: 36px;
            height: 36px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
        }

        /* Loading indicator */
        .loader {
            border: 3px solid #f3f3f3;
            border-top: 3px solid #3498db;
            border-radius: 50%;
            width: 20px;
            height: 20px;
            animation: spin 1s linear infinite;
            margin: 30px auto;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* Message media styles */
        .message-media {
            max-width: 300px;
            max-height: 200px;
            border-radius: 8px;
            margin-top: 5px;
        }

        .message-file {
            display: inline-block;
            padding: 5px 10px;
            background: #f1f1f1;
            border-radius: 4px;
            margin-top: 5px;
            color: #333;
            text-decoration: none;
        }
        
        .message-file:hover {
            background: #e0e0e0;
        }
        
        .message.sent .message-file {
            background: #e1f0ff;
        }
        
        .message.received .message-file {
            background: #f0f0f0;
        }

@media (max-width: 768px) {

    .mobile-menu-icon.hidden-on-mobile-menu-active {
        display: none;
    }

    .mobile-menu-icon {
        display: flex; 
    }
}

#installAppButton {
    background: linear-gradient(135deg, #a43b51, #fd30a1);
    border: none;
    animation: pulse-install 2.5s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

#installAppButton::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 40%;
    height: 200%;
    background: rgba(255,255,255,0.15);
    transform: skewX(-20deg);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% { left: -60%; }
    100% { left: 160%; }
}

@keyframes pulse-install {
    0%, 100% { box-shadow: 0 0 0 0 rgba(253, 48, 161, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(253, 48, 161, 0); }
}

#installAppButton:hover {
    background: linear-gradient(135deg, #fd30a1, #ff6ec7);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(253, 48, 161, 0.6);
}

@media (max-width: 768px) {
    .sidebar-header {
        padding: 16px !important;
        padding-bottom: 70px !important;
    }

    .bot-controls {
        gap: 8px;
    }

    .bot-button {
        padding: 14px 12px;
        font-size: 0.95rem;
        border-radius: 10px;
        min-height: 48px; /* touch target */
    }

    .bot-button i {
        font-size: 1.1rem;
        min-width: 20px;
    }

    .sidebar-title {
        font-size: 1.3rem;
    }

    .logout-button {
        padding: 10px;
        font-size: 0.9rem;
        min-height: 44px;
        border-radius: 8px;
    }
}