/**
 * Chat System Styles
 * WhatsApp/Messenger-inspired design
 * Updated: Dark theme with bg-gray-850 (#1a1d24) and border-gray-800 (#1f2937)
 */

.chat-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.chat-header {
    background: #2d3748; /* Solid dark gray - simple and clean */
    color: white;
    padding: 12px 15px; /* Reduced from 20px */
    border-radius: 12px 12px 0 0;
    box-shadow: none; /* Removed shadow for minimalist look */
    border-bottom: 1px solid #374151; /* Subtle separator */
}

.chat-header h1 {
    margin: 0;
    font-size: 18px; /* Reduced from 24px */
    font-weight: 600;
}

.chat-header p {
    margin: 4px 0 0 0; /* Reduced from 5px */
    opacity: 0.85; /* Slightly reduced from 0.9 */
    font-size: 12px; /* Reduced from 14px */
}

.chat-stats {
    display: flex;
    align-items: center;
    gap: 10px; /* Reduced from 15px */
    margin-top: 6px; /* Reduced from 10px */
    font-size: 11px; /* Reduced from 14px */
    opacity: 0.8; /* Added to make it less prominent */
}

.chat-stats i {
    margin-right: 4px; /* Reduced from 5px */
    font-size: 10px; /* Smaller icons */
}

.chat-body {
    background: #1a1d24; /* bg-gray-850 */
    border-left: 1px solid #1f2937; /* border-gray-800 */
    border-right: 1px solid #1f2937; /* border-gray-800 */
    min-height: 500px;
    max-height: 600px;
    overflow-y: auto;
    padding: 20px;
    position: relative;
}

.chat-messages-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Empty state */
.chat-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280; /* Lighter gray for dark background */
}

.chat-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
    color: #9ca3af;
}

.chat-empty p {
    font-size: 16px;
    margin: 0;
}

/* Loading indicator */
.chat-loading {
    text-align: center;
    padding: 10px;
    color: #9ca3af; /* Lighter gray for dark background */
    font-size: 14px;
}

.chat-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Message bubble */
.chat-message {
    display: flex;
    gap: 10px;
    align-items: flex-start; /* Align items to top */
    animation: fadeIn 0.3s ease-in;
}

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

.chat-message.own {
    flex-direction: row-reverse;
}

.message-avatar {
    flex-shrink: 0;
    align-self: center; /* Center avatar vertically */
}

.message-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.message-content {
    max-width: 70%;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.message-user {
    color: #60a5fa; /* Lighter blue for dark background */
    font-weight: 600;
}

.chat-message.own .message-user {
    color: #3b82f6; /* Lighter blue for dark background */
}

.message-text {
    background: #2d3748; /* Dark gray for message bubbles */
    color: #e5e7eb; /* Light text color */
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    word-wrap: break-word;
    line-height: 1.5;
}

.chat-message.own .message-text {
    background: linear-gradient(135deg, #4280FF 0%, #007bff 100%);
    color: white;
}

.message-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 2px;
}

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

.message-time {
    color: #9ca3af; /* Lighter gray for dark background */
    font-size: 11px;
    font-style: italic;
}

/* Chat footer (form) */
.chat-footer {
    background: #1a1d24; /* bg-gray-850 */
    padding: 20px;
    border-radius: 0 0 12px 12px;
    border: 1px solid #1f2937; /* border-gray-800 */
    border-top: none;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding: 12px;
    background: #2d3748; /* Darker gray for user info */
    border-radius: 8px;
    border: 1px solid #374151;
}

.chat-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-user-details {
    flex: 1;
}

.chat-user-name {
    display: block;
    font-weight: 600;
    color: #f3f4f6; /* Light text for dark background */
    font-size: 14px;
}

.chat-user-email {
    display: block;
    color: #9ca3af; /* Lighter gray for dark background */
    font-size: 12px;
}

.chat-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
}

.chat-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #374151; /* Darker border for dark theme */
    border-radius: 24px;
    font-size: 14px;
    resize: none;
    min-height: 48px;
    max-height: 120px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #2d3748; /* Dark input background */
    color: #f3f4f6; /* Light text color */
}

.chat-input:focus {
    outline: none;
    border-color: #4280FF;
    background: #374151; /* Slightly lighter on focus */
}

.chat-input::placeholder {
    color: #6b7280; /* Lighter placeholder for dark background */
}

.chat-send-btn {
    background: linear-gradient(135deg, #4280FF 0%, #007bff 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    min-width: 100px;
}

.chat-send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 128, 255, 0.4);
}

.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-send-btn i {
    margin-right: 6px;
}

.chat-cooldown {
    text-align: center;
    color: #f59e0b;
    font-size: 13px;
    margin-top: 8px;
    display: none;
}

.chat-cooldown i {
    margin-right: 5px;
}

/* Login prompt */
.chat-login-prompt {
    text-align: center;
    padding: 30px;
    background: #2d3748; /* Dark background for login prompt */
    border-radius: 8px;
    border: 1px solid #374151;
}

.chat-login-prompt i {
    font-size: 48px;
    color: #60a5fa; /* Lighter blue for dark background */
    margin-bottom: 15px;
}

.chat-login-prompt p {
    margin: 0 0 20px 0;
    color: #d1d5db; /* Light gray text */
    font-size: 16px;
}

.chat-login-btn {
    background: #374151; /* Dark button background */
    color: #f3f4f6; /* Light text */
    border: 2px solid #4b5563;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.chat-login-btn:hover {
    border-color: #4280FF;
    background: #4b5563;
    color: #60a5fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 128, 255, 0.3);
}

.chat-login-btn img {
    width: 20px;
    height: 20px;
}

/* Refresh button */
.chat-refresh-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-refresh-btn:hover {
    background: rgba(255,255,255,0.3);
}

.chat-refresh-btn i {
    margin-right: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        padding: 10px;
    }

    .chat-header {
        padding: 10px 12px; /* Even more compact on mobile */
        border-radius: 8px 8px 0 0;
    }

    .chat-header h1 {
        font-size: 16px; /* Smaller on mobile */
    }

    .chat-header p {
        font-size: 11px; /* Smaller on mobile */
    }

    .chat-stats {
        font-size: 10px; /* Smaller on mobile */
        gap: 8px;
        margin-top: 4px;
    }

    .chat-body {
        min-height: 400px;
        max-height: 500px;
        padding: 15px;
    }

    .message-content {
        max-width: 80%;
    }

    .message-avatar img {
        width: 32px;
        height: 32px;
    }

    .chat-footer {
        padding: 15px;
    }

    .chat-send-btn {
        padding: 12px 20px;
        min-width: 80px;
    }
}

