* {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
}

body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        background-color: #f8f9fa;
        color: #2d3748;
        height: 100vh;
        overflow: hidden;
}

.container {
        display: flex;
        height: 100vh;
}

/* Sidebar */
.sidebar {
        width: 300px;
        background-color: #ffffff;
        border-right: 1px solid #e2e8f0;
        display: flex;
        flex-direction: column;
        transition: transform 0.3s ease;
}

.sidebar-header {
        padding: 20px;
        border-bottom: 1px solid #e2e8f0;
        display: flex;
        justify-content: space-between;
        align-items: center;
}

.sidebar-title {
        font-size: 18px;
        font-weight: 600;
        color: #1a202c;
}

.new-chat-btn {
        background-color: #4299e1;
        color: white;
        border: none;
        border-radius: 8px;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
        font-size: 18px;
        box-shadow: 0 2px 4px rgba(66, 153, 225, 0.3);
}

.new-chat-btn:hover {
        background-color: #3182ce;
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(66, 153, 225, 0.4);
}

.conversations-list {
        flex: 1;
        overflow-y: auto;
        padding: 10px 0;
}

.conversation-item {
        padding: 16px 20px;
        cursor: pointer;
        border-bottom: 1px solid #f7fafc;
        transition: all 0.2s ease;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        border-radius: 8px;
        margin: 0 8px;
}

.conversation-item:hover {
        background-color: #f7fafc;
        transform: translateX(4px);
}

.conversation-item.active {
        background-color: #ebf8ff;
        border-left: 4px solid #4299e1;
        box-shadow: 0 2px 8px rgba(66, 153, 225, 0.2);
}

.conversation-content {
        flex: 1;
        min-width: 0;
}

.conversation-title {
        font-size: 20px;
        font-weight: 500;
        color: #1a202c;
        margin-bottom: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
}

.conversation-preview {
        font-size: 15px;
        color: #718096;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
}

.conversation-time {
        font-size: 15px;
        color: #a0aec0;
        margin-left: 8px;
        flex-shrink: 0;
}

.delete-btn {
        background: none;
        border: none;
        color: #e53e3e;
        cursor: pointer;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 20px;
        opacity: 0;
        transition: all 0.2s ease;
}

.conversation-item:hover .delete-btn {
        opacity: 1;
}

.delete-btn:hover {
        background-color: #fed7d7;
        transform: scale(1.1);
}

/* Main Chat Area */
.main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        background-color: #ffffff;
}

.chat-header {
        padding: 20px;
        border-bottom: 1px solid #e2e8f0;
        background-color: #ffffff;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chat-title {
        font-size: 25px;
        font-weight: 600;
        color: #1a202c;
}

.messages-container {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
        background-color: #f8f9fa;
}

.pinned-messages {
        background-color: #fff3cd;
        border: 1px solid #ffeaa7;
        border-radius: 8px;
        padding: 12px;
        margin-bottom: 20px;
        display: none;
}

.pinned-messages.has-pins {
        display: block;
}

.pinned-header {
        font-size: 12px;
        font-weight: 600;
        color: #856404;
        margin-bottom: 8px;
        display: flex;
        align-items: center;
        gap: 4px;
}

.pinned-message {
        background-color: #ffffff;
        border-radius: 6px;
        padding: 8px 12px;
        margin-bottom: 6px;
        font-size: 13px;
        color: #2d3748;
        cursor: pointer;
        transition: background-color 0.2s;
}

.pinned-message:hover {
        background-color: #f8f9fa;
}

.pinned-message:last-child {
        margin-bottom: 0;
}

.message-wrapper {
        position: relative;
        margin-bottom: 10px;
        margin-top: 10px;
        display: flex;
        justify-content: flex-end;
}

.message {
        max-width: 80%;
        min-width: 100px;
        padding: 12px 16px;
        border-radius: 18px;
        font-size: 22px;
        line-height: 1.4;
        word-wrap: break-word;
        background-color: #4299e1;
        color: white;
        position: relative;
        transition: all 0.2s ease;
        box-shadow: 0 2px 4px rgba(66, 153, 225, 0.3);
}

.message:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(66, 153, 225, 0.4);
}

.message-time {
        font-size: 11px;
        color: rgba(255, 255, 255, 0.8);
        margin-top: 4px;
        text-align: right;
}

.message.file {
        background-color: #48bb78;
        display: flex;
        align-items: center;
        gap: 8px;
        flex-direction: column;
}

.message.image {
        background-color: #38b2ac;
        padding: 8px;
}

.message.reply {
        background-color: #9f7aea;
}

.message.pinned {
        background-color: #ed8936;
}

.image-preview {
        max-width: 1000px;
        max-height: 1000px;
        /* width: auto;
            height: auto; */
        border-radius: 8px;
        object-fit: cover;
        margin-bottom: 4px;
}

.file-info {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
}

.file-icon {
        font-size: 16px;
}

.file-name {
        flex: 1;
        font-size: 13px;
}

.download-link {
        color: rgba(255, 255, 255, 0.9);
        text-decoration: underline;
        cursor: pointer;
        font-size: 12px;
}

.download-link:hover {
        color: white;
}

.reply-indicator {
        font-size: 11px;
        color: rgba(255, 255, 255, 0.7);
        margin-bottom: 4px;
        font-style: italic;
}

.message-utils {
        position: absolute;
        top: -8px;
        right: -8px;
        background-color: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 50%;
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        opacity: 0;
        transition: all 0.2s ease;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message-wrapper:hover .message-utils {
        opacity: 1;
}

.message-utils:hover {
        background-color: #f7fafc;
        transform: scale(1.1);
}

.utils-menu {
        position: absolute;
        top: 100%;
        right: 0;
        background-color: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        min-width: 120px;
        opacity: 0;
        transform: translateY(-10px);
        transition: all 0.2s ease;
        pointer-events: none;
}

.utils-menu.active {
        opacity: 1;
        transform: translateY(0);
        pointer-events: all;
}

.utils-menu-item {
        padding: 8px 12px;
        cursor: pointer;
        font-size: 13px;
        color: #2d3748;
        transition: background-color 0.2s;
        border-bottom: 1px solid #f7fafc;
}

.utils-menu-item:last-child {
        border-bottom: none;
}

.utils-menu-item:hover {
        background-color: #f7fafc;
}

.utils-menu-item.danger {
        color: #e53e3e;
}

.utils-menu-item.danger:hover {
        background-color: #fed7d7;
}

.empty-state {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #a0aec0;
        font-size: 16px;
        text-align: center;
}

/* Input Area */
.input-area {
        padding: 20px;
        border-top: 1px solid #e2e8f0;
        background-color: #ffffff;
}

.reply-preview {
        background-color: #f7fafc;
        border-left: 4px solid #4299e1;
        padding: 8px 12px;
        margin-bottom: 8px;
        border-radius: 4px;
        font-size: 12px;
        color: #718096;
        display: none;
}

.reply-preview.active {
        display: block;
}

.reply-close {
        float: right;
        cursor: pointer;
        color: #a0aec0;
        font-weight: bold;
}

.input-container {
        display: flex;
        align-items: flex-end;
        gap: 12px;
        background-color: #f7fafc;
        border-radius: 24px;
        padding: 8px 16px;
        border: 2px solid #e2e8f0;
        transition: all 0.2s ease;
}

.input-container:focus-within {
        border-color: #4299e1;
        box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.message-input {
        flex: 1;
        border: none;
        background: none;
        outline: none;
        padding: 8px 0;
        font-size: 14px;
        color: #2d3748;
        resize: none;
        max-height: 120px;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 17px;
}

.message-input::placeholder {
        color: #a0aec0;
}

.input-actions {
        display: flex;
        align-items: center;
        gap: 8px;
}

.attach-btn,
.send-btn {
        background: none;
        border: none;
        color: #4299e1;
        cursor: pointer;
        padding: 8px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        transition: all 0.2s ease;
}

.attach-btn:hover,
.send-btn:hover {
        background-color: #ebf8ff;
        transform: scale(1.1);
}

.send-btn:disabled {
        color: #a0aec0;
        cursor: not-allowed;
}

.send-btn:disabled:hover {
        background-color: transparent;
        transform: none;
}

.hidden-file-input {
        display: none;
}

/* Modal */
.modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
}

.modal-overlay.active {
        opacity: 1;
        visibility: visible;
}

.modal {
        background-color: #ffffff;
        border-radius: 12px;
        padding: 24px;
        width: 90%;
        max-width: 400px;
        transform: scale(0.9);
        transition: transform 0.3s ease;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-overlay.active .modal {
        transform: scale(1);
}

.modal-header {
        font-size: 18px;
        font-weight: 600;
        color: #1a202c;
        margin-bottom: 16px;
}

.modal-input {
        width: 100%;
        padding: 12px 16px;
        border: 2px solid #e2e8f0;
        border-radius: 8px;
        font-size: 14px;
        outline: none;
        transition: border-color 0.2s;
        margin-bottom: 16px;
}

.modal-input:focus {
        border-color: #4299e1;
}

.modal-actions {
        display: flex;
        gap: 12px;
        justify-content: flex-end;
}

.modal-btn {
        padding: 10px 20px;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
}

.modal-btn.primary {
        background-color: #4299e1;
        color: white;
}

.modal-btn.primary:hover {
        background-color: #3182ce;
        transform: translateY(-1px);
}

.modal-btn.secondary {
        background-color: #e2e8f0;
        color: #2d3748;
}

.modal-btn.secondary:hover {
        background-color: #cbd5e0;
}

/* Context Menu */
.context-menu {
        position: fixed;
        background-color: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
        z-index: 1001;
        min-width: 140px;
        opacity: 0;
        transform: scale(0.95);
        transition: all 0.15s ease;
        pointer-events: none;
}

.context-menu.active {
        opacity: 1;
        transform: scale(1);
        pointer-events: all;
}

.context-menu-item {
        padding: 10px 16px;
        cursor: pointer;
        font-size: 13px;
        color: #2d3748;
        transition: background-color 0.2s;
        border-bottom: 1px solid #f7fafc;
}

.context-menu-item:last-child {
        border-bottom: none;
}

.context-menu-item:hover {
        background-color: #f7fafc;
}

.context-menu-item.danger {
        color: #e53e3e;
}

.context-menu-item.danger:hover {
        background-color: #fed7d7;
}

/* Scrollbar Styling */
.conversations-list::-webkit-scrollbar,
.messages-container::-webkit-scrollbar {
        width: 6px;
}

.conversations-list::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track {
        background: transparent;
}

.conversations-list::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb {
        background: #cbd5e0;
        border-radius: 3px;
}

.conversations-list::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover {
        background: #a0aec0;
}

/* Animations */
@keyframes fadeInUp {
        from {
                opacity: 0;
                transform: translateY(20px);
        }

        to {
                opacity: 1;
                transform: translateY(0);
        }
}

.message-wrapper {
        animation: fadeInUp 0.3s ease;
}

.pin-icon {
        color: #f6ad55;
        margin-right: 4px;
}

/* Hiệu ứng cho message-wrapper khi active */
.message-wrapper.active-message {
        animation: highlightActive 1s;
        box-shadow: 0 0 0 3px #b0beff, 0 2px 8px #b0beff44;
        background: #e6eaff;
        border-radius: 7px;
}

@keyframes highlightActive {
        0% {
                background: #fffbe6;
        }

        50% {
                background: #b0beff;
        }

        100% {
                background: #e6eaff;
        }
}

/* Responsive Design */
@media (max-width: 900px) {
        .sidebar {
                position: fixed;
                left: -100vw;
                top: 0;
                width: 80vw;
                max-width: 350px;
                z-index: 1000;
                height: 100vh;
                background: #fff;
                transition: left 0.3s;
        }

        .sidebar.open {
                left: 0;
        }

        .main-content {
                width: 100vw;
        }

        #fixedPinnedMessage {
                left: 0 !important;
                width: 100vw !important;
        }

        .image-preview {
                max-width: 90vw;
                max-height: 60vw;
        }

}

@media (max-width: 600px) {
        .sidebar {
                width: 100vw;
                max-width: 100vw;
        }

        .main-content {
                width: 100vw;
        }

        .message {
                max-width: 98vw;
                font-size: 16px;
        }

        .chat-title,
        .conversation-title {
                font-size: 18px;
        }

        .conversation-preview,
        .conversation-time {
                font-size: 12px;
        }

        .input-area {
                padding: 10px;
        }

        .image-preview {
                max-width: 50vw;
                /* max-height: 50vw; */
        }

        #fixedPinnedMessage {
                left: 0 !important;
                width: 100vw !important;
                font-size: 13px !important;
                padding: 8px 8px 8px 8px !important;
        }

}

/* Nút mở sidebar trên mobile */
.mobile-menu-btn {
        display: none;
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 999;
        background: #b0beff;
        border: none;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        font-size: 24px;
        color: #222;
        box-shadow: 0 2px 8px #b0beff44;
}

@media (max-width: 900px) {
        .mobile-menu-btn {
                display: block;
        }
}

.chat-link {
        color: #3182ce;
        text-decoration: underline;
        word-break: break-all;
}

.chat-link:hover {
        color: #2b6cb0;
        background: #e6eaff;
}

#fixedPinnedMessage:hover {
        background: #a0b8ff;
        cursor: pointer;
}