/* ========================================
   MODERN CHAT MESSAGE BUBBLES UI
   Prefix: wmsg- (WhatsApp Message)
   ======================================== */

/* Chat Container */
.wmsg-chat-container {
    padding: 1rem;
    background: #f8f9fa;
}

/* Message Row */
.wmsg-message-row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    animation: wmsg-slide-in 0.3s ease-out;
}

.wmsg-message-row.wmsg-from-contact {
    justify-content: flex-start;
}

.wmsg-message-row.wmsg-from-agent {
    justify-content: flex-end;
}

/* Date Separator */
.wmsg-date-separator {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1.5rem 0;
}

.wmsg-date-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Message Bubble Wrapper */
.wmsg-bubble-wrapper {
    max-width: 65%;
    display: flex;
    flex-direction: column;
}

.wmsg-campaign-bubble {
    max-width: 440px !important;
}

/* Message Bubble */
.wmsg-bubble {
    position: relative;
    padding: 0.875rem 1rem;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.wmsg-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Contact Message (Left - Gray) */
.wmsg-bubble.wmsg-contact {
    background: #F0F2F5;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

/* Agent Message (Right - Gradient) */
.wmsg-bubble.wmsg-agent {
    background: linear-gradient(135deg, #0EA5E9 0%, #3B82F6 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Note Message (Amber Gradient) */
.wmsg-bubble.wmsg-note {
    background: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%) !important;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Message Content */
.wmsg-content {
    margin-bottom: 0.5rem;
}

/* Media Elements */
.wmsg-media-image {
    max-width: 100%;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.wmsg-media-image:hover {
    transform: scale(1.02);
}

.wmsg-media-video {
    max-width: 300px;
    width: 100%;
    border-radius: 12px;
    margin-bottom: 0.75rem;
}

.wmsg-media-audio {
    width: 100%;
    margin-bottom: 0.75rem;
    border-radius: 8px;
}

/* Document/Location Buttons */
.wmsg-action-button {
    display: block;
    width: 100%;
    padding: 0.875rem 1.25rem;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.wmsg-action-button:hover {
    background: white;
    border-color: #3B82F6;
    color: #3B82F6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    text-decoration: none;
}

/* Header Text */
.wmsg-header-text {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: white;
    line-height: 1.4;
}

/* Message Text */
.wmsg-text {
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
    text-align: left !important;
}

.wmsg-bubble.wmsg-contact .wmsg-text {
    color: #1f2937;
}

.wmsg-bubble.wmsg-agent .wmsg-text {
    color: white;
}

.wmsg-bubble.wmsg-note .wmsg-text {
    color: white;
}

/* Links in messages */
.wmsg-text a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    opacity: 0.95;
}

.wmsg-text a:hover {
    opacity: 1;
}

/* Original Message (Translated) */
.wmsg-original-text {
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
    text-align: right;
    font-style: italic;
}

/* Footer Text */
.wmsg-footer-text {
    font-size: 0.75rem;
    opacity: 0.8;
    color: white;
    margin-bottom: 0.5rem;
}

/* Interactive Buttons */
.wmsg-interactive-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.wmsg-interactive-button {
    display: block;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.wmsg-interactive-button:hover {
    background: white;
    border-color: #3B82F6;
    color: #3B82F6;
    transform: translateX(4px);
    text-decoration: none;
}

/* Timestamp */
.wmsg-timestamp {
    display: flex;
    align-items: center;
    font-size: 0.6875rem;
    opacity: 0.6;
    margin-top: 0.25rem;
    gap: 0.375rem;
}

.wmsg-bubble.wmsg-contact .wmsg-timestamp {
    color: #6b7280;
}

.wmsg-bubble.wmsg-agent .wmsg-timestamp,
.wmsg-bubble.wmsg-note .wmsg-timestamp {
    color: white;
    justify-content: flex-end;
}

.wmsg-timestamp-icon {
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    max-width: 10px;
    max-height: 10px;
    fill: currentColor;
    flex-shrink: 0;
}

.wmsg-timestamp-text {
    font-weight: 500;
}

.wmsg-sender-name {
    margin-left: 0.25rem;
    font-weight: 600;
}

/* Error Alert */
.wmsg-error-alert {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid #ef4444;
    border-radius: 12px;
    color: #991b1b;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.wmsg-error-icon {
    font-size: 1.125rem;
}

/* Animations */
@keyframes wmsg-slide-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .wmsg-bubble-wrapper {
        max-width: 85%;
    }

    .wmsg-campaign-bubble {
        max-width: 90% !important;
    }

    .wmsg-bubble {
        padding: 0.75rem 0.875rem;
    }

    .wmsg-text {
        font-size: 0.875rem;
    }

    .wmsg-header-text {
        font-size: 1rem;
    }

    .wmsg-media-video {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .wmsg-bubble-wrapper {
        max-width: 90%;
    }

    .wmsg-message-row {
        margin-bottom: 1rem;
    }

    .wmsg-date-badge {
        font-size: 0.6875rem;
        padding: 0.375rem 1rem;
    }
}

/* Print Styles */
@media print {
    .wmsg-bubble {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }

    .wmsg-bubble:hover {
        transform: none;
    }
}