* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    height: 100vh;
}

/* Modal nhập tên */
.modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 5px 30px rgba(0,0,0,0.2);
}

.modal-content h2 {
    color: #075e54;
    margin-bottom: 15px;
    font-size: 24px;
}

.modal-content p {
    color: #666;
    margin-bottom: 20px;
}

.name-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: border-color 0.3s;
}

.name-input:focus {
    outline: none;
    border-color: #075e54;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary {
    background: #075e54;
    color: white;
}

.btn-primary:hover {
    background: #054d44;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Chat container */
.chat-container {
    max-width: 1000px;
    margin: 20px auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Admin container */
.admin-container {
    display: flex;
    height: 100vh;
    background: #f0f2f5;
}

.sidebar {
    width: 350px;
    background: #1a2634;
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #2a3747;
}

.sidebar-header h3 {
    margin-bottom: 5px;
    font-size: 16px;
    font-weight: 500;
}

.online-count {
    font-size: 13px;
    color: #8a9bb5;
}

.customer-search {
    padding: 15px;
    border-bottom: 1px solid #2a3747;
}

.customer-search input {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    background: #2a3747;
    color: white;
    font-size: 14px;
}

.customer-search input::placeholder {
    color: #8a9bb5;
}

.customer-search input:focus {
    outline: none;
    background: #334153;
}

.customer-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.customer-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 5px;
    background: #2a3747;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    position: relative;
}

.customer-item:hover {
    background: #334153;
}

.customer-item.active {
    background: #075e54;
}

.customer-avatar {
    width: 40px;
    height: 40px;
    background: #075e54;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

.customer-item .customer-info {
    flex: 1;
    min-width: 0;
}

.customer-name {
    font-weight: 500;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-last-message {
    font-size: 12px;
    color: #8a9bb5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-time {
    font-size: 11px;
    color: #8a9bb5;
    margin-left: 10px;
}

.customer-status {
    font-size: 12px;
    margin-left: 5px;
}

.no-customers {
    text-align: center;
    color: #8a9bb5;
    padding: 30px;
}

/* Chat header */
.chat-header {
    background: #075e54;
    color: white;
    padding: 15px 20px;
}

.customer-info h3 {
    margin-bottom: 5px;
}

.customer-details {
    font-size: 12px;
    opacity: 0.8;
}

.customer-badge {
    background: rgba(255,255,255,0.2);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 13px;
}

/* Messages */
.messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #e5ddd5;
    display: flex;
    flex-direction: column;
}

.message {
    max-width: 70%;
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 10px;
    position: relative;
    word-wrap: break-word;
}

.message.sent {
    background: #dcf8c6;
    align-self: flex-end;
}

.message.received {
    background: white;
    align-self: flex-start;
}

.message.system {
    background: #f0f0f0;
    align-self: center;
    font-style: italic;
    color: #666;
    font-size: 13px;
}

.sender {
    font-size: 12px;
    font-weight: bold;
    color: #075e54;
    margin-bottom: 3px;
}

.message.received .sender {
    color: #075e54;
}

.message.sent .sender {
    color: #1b5e20;
}

.chat-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 5px;
    cursor: pointer;
}

.chat-video {
    max-width: 100%;
    max-height: 300px;
    border-radius: 5px;
}

.timestamp {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    display: block;
    text-align: right;
}

/* Typing indicator */
.typing-indicator {
    padding: 10px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* Input area */
.input-container {
    display: flex;
    padding: 15px;
    background: white;
    gap: 10px;
    border-top: 1px solid #e0e0e0;
}

#messageInput {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
}

#messageInput:focus {
    border-color: #075e54;
}

.file-btn, .send-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.file-btn {
    background: #f0f0f0;
    color: #333;
}

.file-btn:hover {
    background: #e0e0e0;
}

.send-btn {
    background: #075e54;
    color: white;
}

.send-btn:hover {
    background: #054d44;
}

.upload-status {
    padding: 10px 15px;
    background: #f8f9fa;
    text-align: center;
    font-size: 13px;
    color: #075e54;
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 250px;
    }
    
    .message {
        max-width: 85%;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
}