/**
 * Meetgle Messages Modal Styles
 * Styles for the private messaging feature
 */

/* Modal Content */
.messages-modal-content {
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
}

/* Header */
.messages-modal-header {
    background: var(--theme-modal-header-gradient, linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #3b82f6 100%));
    padding: 24px;
    border-radius: 16px 16px 0 0;
    position: relative;
    flex-shrink: 0;
}

.messages-header-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

/* Conversations Container */
.messages-container {
    background: #f9fafb;
    max-height: 60vh;
    overflow-y: auto;
    flex: 1;
}

/* Loading State */
.messages-loading {
    text-align: center;
    padding: 40px 0;
}

.messages-loading p {
    color: #6b7280;
    font-size: 14px;
    margin: 16px 0 0 0;
}

.messages-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--theme-button-primary, #8b5cf6);
    border-radius: 50%;
    animation: messagesSpin 1s linear infinite;
    margin: 0 auto;
}

@keyframes messagesSpin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.messages-empty {
    text-align: center;
    padding: 40px 20px;
}

/* Conversations List */
.conversations-list {
    display: flex;
    flex-direction: column;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.conversation-item:hover {
    background: #f9f9f9;
}

.conversation-item.unread {
    background: #fef3f8;
}

.conversation-item.unread:hover {
    background: #fde8f0;
}

.conversation-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

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

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.conversation-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.conversation-time {
    font-size: 12px;
    color: #9ca3af;
    flex-shrink: 0;
}

.conversation-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversation-message {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.conversation-item.unread .conversation-message {
    color: #1a1a1a;
    font-weight: 500;
}

.conversation-unread {
    background: var(--theme-button-primary, #ec4899);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 8px;
}

/* Verification Badges */
.verification-badge {
    font-size: 12px;
    margin-left: 2px;
}

.verification-badge.blue {
    color: #3b82f6;
    font-weight: 700;
}

.verification-badge.gold {
    font-size: 14px;
}

/* Chat View */
#messagesChatView {
    flex-direction: column;
    height: 100%;
    max-height: 85vh;
}

.messages-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--theme-modal-header-gradient, linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #3b82f6 100%));
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

.messages-back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s;
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
}

.messages-back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.messages-chat-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
}

.messages-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.messages-chat-user-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.messages-chat-username {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.messages-chat-verification {
    font-size: 14px;
}

.messages-chat-verification.blue {
    color: #93c5fd;
    font-weight: 700;
}

/* Messages Container */
.messages-chat-container {
    flex: 1;
    overflow-y: auto;
    background: #f9fafb;
    padding: 16px;
    min-height: 300px;
    max-height: calc(85vh - 200px);
}

.chat-messages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Message Bubbles */
.chat-message {
    display: flex;
    max-width: 80%;
}

.chat-message.own {
    margin-left: auto;
    justify-content: flex-end;
}

.chat-message.other {
    margin-right: auto;
    justify-content: flex-start;
}

.chat-message-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    max-width: 100%;
    word-wrap: break-word;
}

.chat-message.own .chat-message-bubble {
    background: var(--theme-gradient-primary, linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%));
    color: #fff;
    border-bottom-right-radius: 6px;
}

.chat-message.other .chat-message-bubble {
    background: #fff;
    color: #1a1a1a;
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message-text {
    font-size: 14px;
    line-height: 1.4;
    display: block;
}

.chat-message-photo {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    cursor: pointer;
    display: block;
}

.chat-message-time {
    font-size: 10px;
    opacity: 0.7;
    display: block;
    margin-top: 4px;
    text-align: right;
}

.chat-message.other .chat-message-time {
    color: #9ca3af;
    text-align: left;
}

/* Input Container */
.messages-input-container {
    padding: 12px 16px 16px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
}

.messages-cost-indicator {
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.messages-balance-display {
    color: #f59e0b;
    font-weight: 500;
}

.messages-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.messages-photo-btn {
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
    flex-shrink: 0;
}

.messages-photo-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.messages-text-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.messages-text-input:focus {
    border-color: var(--theme-button-primary, #8b5cf6);
}

.messages-text-input::placeholder {
    color: #9ca3af;
}

.messages-send-btn {
    background: var(--theme-gradient-primary, linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%));
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1;
}

.messages-send-btn:hover {
    transform: scale(1.05);
}

.messages-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Envelope Button Badge */
.messages-envelope-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .messages-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }
    
    .messages-modal-header {
        border-radius: 0;
    }
    
    .messages-chat-header {
        border-radius: 0;
    }
    
    .messages-input-container {
        border-radius: 0;
        padding-bottom: 20px;
    }
    
    .messages-chat-container {
        max-height: calc(100vh - 200px);
    }
    
    .chat-message {
        max-width: 85%;
    }
    
    .chat-message-photo {
        max-width: 180px;
    }
}
