/* Chat Interface Styles - Exact Match to Perfect Design */
.chat-wrapper {
    padding: 0;
    background: transparent;
    min-height: 100vh;
}

.chat-container {
    height: calc(100vh - 120px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin: 20px;
    display: flex;
    flex-direction: row;
}

/* Left Sidebar - exact match to perfect design */
.chat-sidebar {
    width: 380px;
    height: 100%;
    background: #f8f9fc;
    border-right: 1px solid #e3e6f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.chat-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e3e6f0;
    background: white;
}

.chat-header h5 {
    color: #2c3e50;
    font-weight: 600;
    font-size: 16px;
    margin: 0;
}

/* Users Section - More Compact */
.users-section {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
}

.users-header {
    color: #5a5c69;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    padding: 9px;
}

/* Search Input - Compact */
.search-container {
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d3e2;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #4e73df;
    box-shadow: 0 0 0 2px rgba(78, 115, 223, 0.1);
}

/* User Categories - Compact */
.user-category {
    margin-bottom: 20px;
}

.category-header {
    color: #5a5c69;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.category-header i {
    margin-right: 6px;
    color: #4e73df;
    font-size: 12px;
}

/* User Items - Compact and Stylish Design */
.user-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: white;
    border: 1px solid #e3e6f0;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-item:hover {
    background: #f8f9fc;
    border-color: #4e73df;
    box-shadow: 0 2px 8px rgba(78, 115, 223, 0.15);
    transform: translateY(-1px);
}

.user-item.selected {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    color: white;
    border-color: #4e73df;
    box-shadow: 0 4px 12px rgba(78, 115, 223, 0.3);
}

/* User Avatar - Stylish with Shadow (matching main chat header) */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 12px;
    position: relative;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.user-avatar:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.5);
}

.user-avatar.premium {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

/* User Info - Compact Text */
.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 2px;
    line-height: 1.3;
}

.user-role {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    line-height: 1.2;
}

/* Status badges - Compact Design */
.user-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.basic {
    background: #3498db;
    color: white;
}

.status-badge.premium {
    background: #f39c12;
    color: white;
}

.unread-count {
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
}

.online-indicator {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px #e3e6f0;
}

/* Selected user styling */
.user-item.selected .user-name,
.user-item.selected .user-role {
    color: white;
}

.user-item.selected .user-avatar {
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3), 0 2px 8px rgba(40, 167, 69, 0.5);
    border: 2px solid rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

.user-item.selected .status-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.user-item.selected .online-indicator {
    border-color: rgba(255, 255, 255, 0.8);
}

/* Main Chat Area - Fixed Height to Match Sidebar */
.chat-main {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    min-width: 0;
}

/* Chat Header with Selected User - Stylish Design */
.chat-main-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e3e6f0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fc 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.selected-user-info {
    display: flex;
    align-items: center;
}

.selected-user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 15px;
    font-size: 18px;
    box-shadow: 0 3px 8px rgba(40, 167, 69, 0.3);
    flex-shrink: 0;
}

.selected-user-details {
    flex: 1;
    min-width: 0;
}

.selected-user-name {
    font-weight: 600;
    font-size: 16px;
    color: #2d3748;
    margin-bottom: 2px;
    line-height: 1.3;
}

.selected-user-role {
    font-size: 13px;
    color: #718096;
    font-weight: 500;
}

.subscription-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.subscription-badge.basic {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
}

.subscription-badge.premium {
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
    color: white;
}

/* Messages Container - Takes Full Height */
.messages-container {
    flex: 1;
    padding: 60px 40px;
    overflow-y: auto;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.start-conversation-message {
    text-align: center;
    color: #6c757d;
    max-width: 400px;
}

.conversation-icon {
    font-size: 100px;
    margin-bottom: 30px;
    opacity: 0.3;
    color: #cbd5e0;
}

.start-conversation-message h4 {
    color: #2d3748;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 28px;
}

.start-conversation-message p {
    color: #718096;
    font-size: 16px;
    margin: 0;
    opacity: 0.8;
}

.welcome-message {
    text-align: center;
    color: #6c757d;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
    color: #4e73df;
}

.welcome-message h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
}

/* Message Input - Fixed at Bottom */
.message-input-container {
    padding: 25px 40px;
    border-top: 1px solid #e3e6f0;
    background: #ffffff;
    flex-shrink: 0;
}

.message-input-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f7fafc;
    border-radius: 25px;
    padding: -1px 20px;
    border: 1px solid #e2e8f0;
}

.message-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 8px 14px;
    font-size: 15px;
    color: #2d3748;
}

.message-input::placeholder {
    color: #a0aec0;
}

.send-button {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.3);
}

.send-button:hover {
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
}

/* Messages display */
.messages-list {
    width: 100%;
    max-width: 800px;
}

.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-end;
}

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 18px;
    border-radius: 18px;
    position: relative;
}

.message.sent .message-bubble {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(78, 115, 223, 0.3);
}

.message.received .message-bubble {
    background: white;
    color: #2c3e50;
    border: 1px solid #e3e6f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-wrapper {
        padding: 10px;
    }
    
    .chat-container {
        height: calc(100vh - 20px);
        margin: 10px;
    }
    
    .chat-sidebar {
        width: 100%;
        position: absolute;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .chat-sidebar.show {
        transform: translateX(0);
    }
    
    .chat-main {
        width: 100%;
    }
}

/* Custom Scrollbar */
.users-section::-webkit-scrollbar,
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.users-section::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.users-section::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.users-section::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}