* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    height: 100vh;
    background-color: #f5f5f5;
}

.container {
    display: flex;
    width: 100%;
    height: 100vh;
    background-color: #f5f5f5;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background-color: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.chats-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.chat-item:hover {
    background-color: #f8f9fa;
}

.chat-item.active {
    background-color: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.chat-item-unread {
    background-color: #fff3cd;
    font-weight: 600;
}

.chat-item-unread .chat-item-name {
    font-weight: 700;
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.chat-item-name {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.chat-item-time {
    font-size: 12px;
    color: #999;
}

.unread-badge {
    display: inline-block;
    background-color: #ffc107;
    color: #000;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 8px;
    min-width: 20px;
    text-align: center;
}

.chat-item-preview {
    font-size: 13px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fff;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.chat-header-info span {
    font-size: 14px;
    color: #666;
}

.history-btn {
    padding: 8px 16px;
    background-color: #2196f3;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.history-btn:hover {
    background-color: #1976d2;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f5f5f5;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 16px;
    padding: 20px;
}

.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.message-user {
    align-items: flex-start;
}

.message-manager {
    align-items: flex-end;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
}

.message-user .message-bubble {
    background-color: #e3f2fd;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message-manager .message-bubble {
    background-color: #2196f3;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    padding: 0 5px;
}

.message-unread {
    position: relative;
}

.message-unread .message-bubble {
    background-color: #fff3cd !important;
    border-left: 3px solid #ffc107 !important;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.3);
}

.message-unread.message-manager .message-bubble {
    background-color: #1976d2 !important;
    border-left: 3px solid #ffc107 !important;
}

.message-input-container {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    background-color: #fff;
}

.message-input-wrapper {
    display: flex;
    gap: 10px;
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 15px;
    outline: none;
}

#messageInput:focus {
    border-color: #2196f3;
}

#sendButton {
    padding: 12px 24px;
    background-color: #2196f3;
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

#sendButton:hover {
    background-color: #1976d2;
}

#sendButton:active {
    background-color: #1565c0;
}

/* Booking Card */
.booking-card-container {
    padding: 20px;
    background-color: #fff;
    border-top: 1px solid #e0e0e0;
}

.booking-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.booking-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
}

.booking-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.booking-card-toggle {
    font-size: 12px;
    color: #666;
    user-select: none;
}

.booking-card-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    font-size: 13px;
}

.booking-card-content.collapsed {
    display: none;
}

.booking-item {
    display: flex;
    flex-direction: column;
    padding: 6px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
}

.booking-label {
    font-size: 11px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.booking-value {
    font-size: 13px;
    color: #333;
    word-wrap: break-word;
}

.booking-tag {
    display: inline-block;
    background: rgba(33, 150, 243, 0.1);
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    margin: 2px;
}

/* History Popup */
.history-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.history-popup-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.history-popup-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-popup-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.history-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.history-popup-close:hover {
    background-color: #f0f0f0;
}

.history-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.history-empty {
    text-align: center;
    color: #999;
    padding: 40px 20px;
}

.history-event {
    padding: 16px;
    margin-bottom: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
}

.history-event-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
    flex-wrap: wrap;
    padding: 4px 0;
    transition: background-color 0.2s;
}

.history-event-header:hover {
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 4px;
}

.history-event-toggle {
    font-size: 12px;
    color: #999;
    margin-left: auto;
    transition: transform 0.2s;
    user-select: none;
}

.history-event-toggle.expanded {
    transform: rotate(180deg);
}

.history-event-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.history-event-type {
    font-weight: 600;
    color: #333;
    font-size: 15px;
    flex: 1;
    min-width: 200px;
}

.history-event-time {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
    font-weight: 500;
}

.history-event-content {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e8e8e8;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

.history-event-details {
    margin-bottom: 12px;
}

.history-event-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.booking-details-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.booking-detail-item {
    display: flex;
    flex-direction: column;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #2196f3;
}

.booking-detail-label {
    font-size: 11px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.booking-detail-value {
    font-size: 13px;
    color: #333;
    word-wrap: break-word;
}

.history-event-summary {
    margin-top: 12px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    border-left: 3px solid #2196f3;
}

.history-event-summary-text {
    font-size: 13px;
    color: #555;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-top: 8px;
}

.history-event-empty {
    padding: 12px;
    text-align: center;
    color: #999;
    font-style: italic;
    font-size: 14px;
}

.booking-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.booking-detail-item:last-child {
    border-bottom: none;
}

.booking-detail-item:hover {
    background-color: #f8f9fa;
}

.booking-detail-label {
    font-weight: 600;
    color: #666;
    min-width: 150px;
    font-size: 13px;
}

.booking-detail-value {
    color: #333;
    text-align: right;
    flex: 1;
    font-size: 13px;
    word-wrap: break-word;
}

