/**
 * Frontend Styles - Facebook-style Messenger
 */

/* Messenger Modal */
.lpmm-messenger-modal {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    z-index: 999999;
    font-family: Helvetica, Arial, sans-serif;
}

.lpmm-messenger-modal.minimized {
    height: 60px;
}

.lpmm-messenger-modal.hidden {
    display: none;
}

/* Messenger Container */
.lpmm-messenger-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.lpmm-messenger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e5e5ea;
    background: #f5f5f5;
    border-radius: 8px 8px 0 0;
}

.lpmm-messenger-title {
    font-size: 14px;
    font-weight: 500;
    color: #000;
}

.lpmm-messenger-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 0;
}

.lpmm-messenger-close:hover {
    color: #333;
}

/* Product Banner - Prominent at top of conversation */
.lpmm-product-banner {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.lpmm-product-banner-inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lpmm-product-banner-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.lpmm-product-banner-title {
    font-size: 14px;
    font-weight: 600;
    color: white;
    text-decoration: none;
    word-break: break-word;
    transition: all 0.2s ease;
}

.lpmm-product-banner-title:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Legacy Product Info (kept for compatibility) */
.lpmm-product-info {
    width: 100%;
    padding: 8px 0;
    font-size: 12px;
    background: #fff9e6;
    border-radius: 4px;
    text-align: center;
    margin-top: 8px;
}

.lpmm-product-link {
    color: #666;
    text-decoration: none;
    transition: all 0.2s ease;
}

.lpmm-product-link:hover {
    color: #0084ff;
    text-decoration: underline;
}

/* Messages Body */
.lpmm-messenger-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lpmm-messages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Message Bubble */
.lpmm-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 12px;
}

.lpmm-message.own {
    justify-content: flex-end;
}

.lpmm-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.lpmm-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lpmm-message.own .lpmm-message-avatar {
    display: none;
}

.lpmm-message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 70%;
}

.lpmm-message.own .lpmm-message-content {
    align-items: flex-end;
}

.lpmm-message-sender {
    font-size: 12px;
    font-weight: 500;
    color: #999;
}

.lpmm-message-text {
    background: #e4e6eb;
    color: #000;
    padding: 8px 12px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
}

.lpmm-message.own .lpmm-message-text {
    background: #0084ff;
    color: white;
}

.lpmm-message.role-seller .lpmm-message-text {
    background: #0f766e;
    color: #fff;
}

.lpmm-message.role-buyer .lpmm-message-text {
    background: #1d4ed8;
    color: #fff;
}

.lpmm-message.role-other .lpmm-message-text {
    background: #6b7280;
    color: #fff;
}

.lpmm-message-time {
    font-size: 11px;
    color: #999;
}

/* Footer - Message Form */
.lpmm-messenger-footer {
    padding: 12px 16px;
    border-top: 1px solid #e5e5ea;
    background: white;
    border-radius: 0 0 8px 8px;
}

.lpmm-message-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.lpmm-message-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
}

.lpmm-message-input:focus {
    outline: none;
    border-color: #0084ff;
    box-shadow: 0 0 0 2px rgba(0, 132, 255, 0.1);
}

.lpmm-send-btn {
    background: none;
    border: none;
    color: #0084ff;
    font-size: 16px;
    cursor: pointer;
    padding: 8px 12px;
    font-weight: 500;
}

.lpmm-send-btn:hover {
    color: #0073e6;
}

/* Contact Buttons */
.lpmm-contact-seller-btn {
    background: #0084ff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.lpmm-contact-seller-btn:hover {
    background: #0073e6;
}

/* Loading State */
.lpmm-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.lpmm-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0084ff;
    border-radius: 50%;
    animation: lpmm-spin 1s linear infinite;
}

@keyframes lpmm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.lpmm-empty-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    color: #999;
}

.lpmm-empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.lpmm-empty-state-text {
    font-size: 14px;
}

/* Scrollbar */
.lpmm-messages-list::-webkit-scrollbar {
    width: 6px;
}

.lpmm-messages-list::-webkit-scrollbar-track {
    background: transparent;
}

.lpmm-messages-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.lpmm-messages-list::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .lpmm-messenger-modal {
        width: calc(100% - 20px);
        height: 80vh;
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .lpmm-message-content {
        max-width: 85%;
    }
}

/* Animation */
@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.lpmm-messenger-modal {
    animation: slideInUp 0.3s ease-out;
}

/* Contact Seller Button */
.lpm-contact-seller-section {
    margin-top: 20px;
    margin-bottom: 20px;
}

.lpm-btn-contact-seller {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-align: center;
    justify-content: center;
}

.lpm-btn-contact-seller:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.lpm-btn-contact-seller:active {
    transform: translateY(0);
}

.lpm-btn-contact-seller:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
