/**
 * Unified Messaging System - CSS Styles
 * Phase 4: Context-Aware UI Components
 * 
 * Styles for both Stream Chats (public) and Direct Messages (private) components
 */

/* ========================================
   SHARED MESSAGING STYLES
   ======================================== */

.unified-messaging-container {
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.message-input-group {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #2a2a2a;
    border-top: 1px solid #333;
}

.message-input-group input {
    flex: 1;
    background: #333;
    border: 1px solid #444;
    border-radius: 20px;
    padding: 8px 16px;
    color: #fff;
    font-size: 14px;
}

.message-input-group input:focus {
    outline: none;
    border-color: #ff9100;
    box-shadow: 0 0 0 2px rgba(255, 145, 0, 0.2);
}

.message-input-group button {
    background: linear-gradient(45deg, #ff9100, #ffb347);
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.message-input-group button:hover:not(:disabled) {
    background: linear-gradient(45deg, #ffb347, #ffd700);
    transform: translateY(-1px);
}

.message-input-group button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   STREAM CHAT COMPONENT (PUBLIC CONTEXT)
   ======================================== */

.stream-chat-container {
    height: 500px;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #333;
}

.stream-chat-header {
    background: linear-gradient(45deg, #2a2a2a, #333);
    padding: 15px;
    border-bottom: 1px solid #444;
    text-align: center;
}

.stream-chat-header h4 {
    color: #ff9100;
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: bold;
}

.stream-chat-header small {
    color: #aaa;
    font-size: 12px;
}

.stream-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #1a1a1a;
    max-height: 350px;
}

.stream-chat-message {
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #2a2a2a;
    border-radius: 8px;
    border-left: 3px solid #ff9100;
}

.stream-chat-message .message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.stream-chat-message .message-header strong {
    color: #ff9100;
    font-size: 13px;
}

.stream-chat-message .message-header small {
    color: #666;
    font-size: 11px;
}

.stream-chat-message .message-content {
    color: #ccc;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.stream-chat-input {
    background: #2a2a2a;
    border-top: 1px solid #444;
}

/* ========================================
   DIRECT MESSAGES COMPONENT (PRIVATE CONTEXT)
   ======================================== */

.direct-messages-container {
    height: 600px;
    display: flex;
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #333;
}

/* Sidebar with conversation list */
.dm-sidebar {
    width: 300px;
    background: #2a2a2a;
    border-right: 1px solid #444;
    display: flex;
    flex-direction: column;
}

.dm-header {
    padding: 20px;
    border-bottom: 1px solid #444;
    text-align: center;
    background: linear-gradient(45deg, #333, #2a2a2a);
}

.dm-header h4 {
    color: #ff9100;
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: bold;
}

.dm-header small {
    color: #aaa;
    font-size: 12px;
}

.dm-conversation-list {
    flex: 1;
    overflow-y: auto;
}

.dm-conversation-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dm-conversation-item:hover {
    background: #333;
}

.dm-conversation-item.active {
    background: #444;
    border-right: 3px solid #ff9100;
}

.conversation-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff9100, #ffb347);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    margin-right: 12px;
    flex-shrink: 0;
}

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

.conversation-name {
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview {
    color: #aaa;
    font-size: 12px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    color: #666;
    font-size: 11px;
}

/* Chat area */
.dm-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dm-chat-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.dm-chat-content {
    flex: 1;
    display: none;
    flex-direction: column;
}

.dm-chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #444;
    background: #2a2a2a;
}

.chat-header-content {
    display: flex;
    align-items: center;
}

.chat-participant strong {
    color: #ff9100;
    font-size: 16px;
}

.chat-participant small {
    color: #aaa;
    font-size: 12px;
    display: block;
}

.dm-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #1a1a1a;
}

.dm-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.dm-message.sent {
    align-items: flex-end;
}

.dm-message.received {
    align-items: flex-start;
}

.dm-message .message-content {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.dm-message.sent .message-content {
    background: linear-gradient(45deg, #ff9100, #ffb347);
    color: white;
    border-bottom-right-radius: 5px;
}

.dm-message.received .message-content {
    background: #333;
    color: #ccc;
    border-bottom-left-radius: 5px;
}

.dm-message .message-meta {
    margin-top: 4px;
    font-size: 11px;
}

.dm-message.sent .message-meta {
    text-align: right;
}

.dm-message.received .message-meta {
    text-align: left;
}

.dm-chat-input {
    background: #2a2a2a;
    border-top: 1px solid #444;
}

/* ========================================
   DATING INTEGRATION STYLES
   ======================================== */

.btn-connect-dating {
    background: linear-gradient(45deg, #ff9100, #ffb347);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-connect-dating:hover:not(:disabled) {
    background: linear-gradient(45deg, #ffb347, #ffd700);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 145, 0, 0.4);
}

.btn-connect-dating:disabled {
    opacity: 0.8;
    cursor: not-allowed;
    transform: none;
}

.btn-connect-dating::before {
    content: "💕";
    font-size: 14px;
}

/* Success state */
.btn-connect-dating.btn-success::before {
    content: "✓";
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .direct-messages-container {
        height: 500px;
        flex-direction: column;
    }
    
    .dm-sidebar {
        width: 100%;
        height: 200px;
    }
    
    .dm-chat-area {
        height: 300px;
    }
    
    .stream-chat-container {
        height: 400px;
    }
    
    .stream-chat-messages {
        max-height: 250px;
    }
    
    .dm-message .message-content {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .dm-conversation-item {
        padding: 10px;
    }
    
    .conversation-avatar {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .message-input-group {
        padding: 8px;
    }
    
    .message-input-group input {
        font-size: 13px;
    }
    
    .message-input-group button {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

.stream-chat-messages::-webkit-scrollbar,
.dm-chat-messages::-webkit-scrollbar,
.dm-conversation-list::-webkit-scrollbar {
    width: 6px;
}

.stream-chat-messages::-webkit-scrollbar-track,
.dm-chat-messages::-webkit-scrollbar-track,
.dm-conversation-list::-webkit-scrollbar-track {
    background: #2a2a2a;
}

.stream-chat-messages::-webkit-scrollbar-thumb,
.dm-chat-messages::-webkit-scrollbar-thumb,
.dm-conversation-list::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.stream-chat-messages::-webkit-scrollbar-thumb:hover,
.dm-chat-messages::-webkit-scrollbar-thumb:hover,
.dm-conversation-list::-webkit-scrollbar-thumb:hover {
    background: #ff9100;
}

/* ========================================
   ANIMATIONS
   ======================================== */

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

.stream-chat-message,
.dm-message {
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.message-sending {
    animation: pulse 1s infinite;
}