﻿/* Enquiry Chat Interface Styles for Reliables.Web */

.enquiry-chat-container {
    display: flex;
    flex-direction: column;
    height: 70vh;
    max-height: 800px;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.chat-header {
    background: linear-gradient(135deg, #2d6760 0%, #1a4a44 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .chat-header h5 {
        margin: 0;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 8px;
    }

.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

    .chat-messages-container::-webkit-scrollbar {
        width: 6px;
    }

    .chat-messages-container::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .chat-messages-container::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 3px;
    }

        .chat-messages-container::-webkit-scrollbar-thumb:hover {
            background: #a8a8a8;
        }

.message-item {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

    .message-item.buyer {
        align-items: flex-end;
    }

    .message-item.supplier {
        align-items: flex-start;
    }

.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-item.buyer .message-bubble {
    background: linear-gradient(135deg, #2d6760 0%, #1a4a44 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

.message-item.supplier .message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e1e8ed;
    border-bottom-left-radius: 6px;
}

.message-subject {
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 6px;
    opacity: 0.95;
}

.message-content {
    line-height: 1.4;
    margin-bottom: 4px;
}

.message-response {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.9em;
}

.message-item.supplier .message-response {
    border-top-color: #e1e8ed;
}

.message-meta {
    font-size: 0.75em;
    color: #666;
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
    max-width: 75%;
}

.respond-section {
    margin-top: 8px;
    max-width: 75%;
}

.respond-toggle {
    background: none;
    border: none;
    color: #2d6760;
    font-size: 0.8em;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 0;
}

    .respond-toggle:hover {
        color: #1a4a44;
    }

.respond-form {
    margin-top: 8px;
    display: none;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
}

.respond-input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 0.9em;
    resize: vertical;
    min-height: 60px;
}

    .respond-input:focus {
        outline: none;
        border-color: #2d6760;
        box-shadow: 0 0 0 2px rgba(45, 103, 96, 0.1);
    }

.respond-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.respond-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8em;
    cursor: pointer;
}

    .respond-btn:hover {
        background: #218838;
    }

.respond-cancel {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8em;
    cursor: pointer;
}

    .respond-cancel:hover {
        background: #5a6268;
    }

.chat-input-section {
    padding: 20px;
    background: white;
    border-top: 1px solid #e1e8ed;
}

.new-message-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subject-input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9em;
    background: #f8f9fa;
}

    .subject-input:focus {
        outline: none;
        border-color: #2d6760;
        box-shadow: 0 0 0 2px rgba(45, 103, 96, 0.1);
        background: white;
    }

.message-input-group {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 12px 16px;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    font-family: inherit;
    font-size: 0.95em;
}

    .message-input:focus {
        outline: none;
        border-color: #2d6760;
        box-shadow: 0 0 0 2px rgba(45, 103, 96, 0.1);
    }

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #2d6760 0%, #1a4a44 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(45, 103, 96, 0.3);
    font-size: 1.2em;
}

    .send-btn:hover {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(45, 103, 96, 0.4);
    }

    .send-btn:active {
        transform: scale(0.95);
    }

    .send-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        transform: scale(1);
    }

    .send-btn i {
        display: flex;
        align-items: center;
        justify-content: center;
    }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

    .empty-state i {
        font-size: 3em;
        color: #ddd;
        margin-bottom: 16px;
    }

.loading-indicator {
    text-align: center;
    padding: 20px;
    color: #666;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid #f1aeb5;
}

.success-message {
    background: #d1ecf1;
    color: #0c5460;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid #b8daff;
}

    .message-item.sent {
        align-items: flex-end;
    }

    .message-item.received {
        align-items: flex-start;
    }

    .message-item.sent .message-bubble {
        background: linear-gradient(135deg, #2d6760 0%, #1a4a44 100%);
        color: white;
        border-bottom-right-radius: 6px;
    }

    .message-item.received .message-bubble {
        background: white;
        color: #333;
        border: 1px solid #e1e8ed;
        border-bottom-left-radius: 6px;
    }

.message-replies {
    margin-left: 24px;
    margin-top: 12px;
    border-left: 2px solid #e1e8ed;
    padding-left: 16px;
}

.reply-section {
    margin-top: 8px;
    max-width: 75%;
}

.reply-toggle {
    background: none;
    border: none;
    color: #2d6760;
    font-size: 0.8em;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 0;
}

    .reply-toggle:hover {
        color: #1a4a44;
    }

.reply-form {
    margin-top: 8px;
    display: none;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
}

.reply-input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 0.9em;
    resize: vertical;
    min-height: 60px;
}

    .reply-input:focus {
        outline: none;
        border-color: #2d6760;
        box-shadow: 0 0 0 2px rgba(45, 103, 96, 0.1);
    }

.reply-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.reply-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8em;
    cursor: pointer;
}

    .reply-btn:hover {
        background: #218838;
    }

.reply-cancel {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8em;
    cursor: pointer;
}

    .reply-cancel:hover {
        background: #5a6268;
    }

/* Responsive Design */
@media (max-width: 768px) {
    .enquiry-chat-container {
        height: 75vh;
        border-radius: 0;
        margin: 0;
    }

    .message-bubble {
        max-width: 85%;
    }

    .message-meta {
        max-width: 85%;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .chat-messages-container {
        padding: 16px;
    }

    .chat-input-section {
        padding: 16px;
    }

    .message-input-group {
        gap: 8px;
    }

    .send-btn {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 480px) {
    .message-bubble {
        max-width: 90%;
        padding: 10px 14px;
    }

    .chat-messages-container {
        padding: 12px;
    }

    .chat-input-section {
        padding: 12px;
    }

    .subject-input,
    .message-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Animation for new messages */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-item.new {
    animation: slideIn 0.3s ease-out;
}

/* Status indicators */
.status-indicator {
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 12px;
    margin-left: 8px;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-responded {
    background: #d1ecf1;
    color: #0c5460;
}

/* Threaded conversation styling */
.message-thread {
    margin-bottom: 20px;
}

.message-replies {
    margin-left: 40px;
    margin-top: 10px;
    padding-left: 15px;
    border-left: 3px solid #e1e8ed;
}

.message-actions {
    margin-top: 8px;
    display: flex;
    gap: 10px;
}

.reply-toggle {
    background: none;
    border: none;
    color: #2d6760;
    font-size: 0.8em;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.reply-toggle:hover {
    text-decoration: underline;
}

.reply-form {
    margin-top: 10px;
    display: none;
}

.reply-input {
    width: 100%;
    border-radius: 15px;
    border: 1px solid #ddd;
    padding: 8px 15px;
    margin-bottom: 5px;
    resize: none;
    font-family: inherit;
}

.reply-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.reply-btn {
    background: #28a745;
    border: none;
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.8em;
    cursor: pointer;
}

.reply-cancel {
    background: #6c757d;
    border: none;
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.8em;
    cursor: pointer;
}

.reply-btn:hover {
    background: #218838;
}

.reply-cancel:hover {
    background: #5a6268;
}

.reply-input:focus {
    outline: none;
    border-color: #2d6760;
    box-shadow: 0 0 0 3px rgba(45, 103, 96, 0.1);
}

@media (max-width: 768px) {
    .message-replies {
        margin-left: 20px;
        padding-left: 10px;
    }
}
