.chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 700px;
    height: 500px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    overflow: hidden;
}

.chat-left-panel {
    width: 240px;
    background: #f5f5f5;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.chat-session-header {
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.chat-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.chat-session-list {
    flex: 1;
    overflow-y: auto;
}

.chat-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #00aac5 0%, #0086b3 100%);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-title {
    font-size: 14px;
    font-weight: 600;
}

.chat-header-close {
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-header-close:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    background: #f8f9fa;
}

.chat-message {
    display: flex;
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
}

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

.chat-message.me {
    justify-content: flex-end;
}

.chat-message.other {
    justify-content: flex-start;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    margin: 0 8px;
    background: #e9ecef;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-bubble {
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-message.me {
    justify-content: flex-end;
}

.chat-message.other {
    justify-content: flex-start;
}

.chat-bubble.me {
    background: #00aac5;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-bubble.other {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message-time {
    font-size: 10px;
    color: #999;
    text-align: center;
}

.chat-message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
    font-size: 10px;
    color: #999;
}

.chat-message-status {
    font-weight: 600;
    letter-spacing: -2px;
}

.chat-message-status.sent {
    color: #999;
}

.chat-message-status.read {
    color: #00aac5;
}

.chat-image {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    cursor: pointer;
}

.chat-input-area {
    padding: 10px;
    background: #fff;
    border-top: 1px solid #e9ecef;
}

.chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #00aac5;
}

.chat-input::placeholder {
    color: #999;
}

.chat-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #00aac5;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-btn:hover {
    background: #0086b3;
}

.chat-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chat-send-icon {
    display: block;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    transform: translateY(-1px);
}

.chat-upload-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #f0f0f0;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-upload-btn:hover {
    background: #e0e0e0;
}

.chat-upload-input {
    display: none;
}

.chat-empty {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 13px;
}

.chat-minimize {
    font-size: 16px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-minimize:hover {
    opacity: 1;
}

.chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    right: calc(20px + env(safe-area-inset-right));
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00aac5 0%, #0086b3 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0, 172, 197, 0.4);
    cursor: pointer;
    z-index: 99;
    transition: transform 0.2s;
    user-select: none;
    touch-action: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    visibility: visible !important;
    opacity: 1 !important;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
}

.chat-toggle-btn .chat-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    background: #ff4d4f;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 0 4px;
    border-radius: 8px;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 12px;
}

.chat-session-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.chat-session-item:hover {
    background: #f8f9fa;
}

.chat-session-item.active {
    background: #e3f2fd;
}

.chat-session-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
    background: #e9ecef;
}

.chat-session-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-session-info {
    flex: 1;
    overflow: hidden;
}

.chat-session-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.chat-session-preview {
    font-size: 12px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-session-unread {
    background: #ff4d4f;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        height: calc(100vh - 60px);
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chat-left-panel {
        width: 180px;
    }
}
