/* Conversation List */
.wcvm-conversation-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.wcvm-conversation-list li {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    margin: 0;
    transition: background-color 0.2s ease-in-out;
}

.wcvm-conversation-list li:last-child {
    border-bottom: none;
}

.wcvm-conversation-list a {
    text-decoration: none;
    color: #333;
    display: block;
}

.wcvm-conversation-list li:hover {
    background-color: #f9f9f9;
}

.wcvm-conversation-list small {
    display: block;
    color: #777;
    font-size: 0.9em;
    margin-top: 4px;
}

/* Product title in conversation list */
.wcvm-convo-product-title {
    display: block;
    font-style: italic;
    color: #555;
    font-size: 0.95em;
    margin-top: 2px;
}

/* Product context in chat header */
.wcvm-product-context {
    margin: -5px 0 15px 0;
    font-size: 0.9em;
}
.wcvm-product-context a {
    font-weight: bold;
    text-decoration: none;
}

/* Main Chat Container */
.wcvm-chat-container {
    display: flex;
    flex-direction: column;
    height: 60vh;
    max-height: 600px;
    min-height: 400px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
}

/* Message Thread */
.wcvm-message-thread {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 20px 10px 20px;
    overflow-y: scroll;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
    background-color: #fff;
    border: none;
    margin-bottom: 0;
    max-height: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.wcvm-message-thread.wcvm-thread-loaded {
    opacity: 1;
}

.wcvm-message {
    margin-bottom: 15px;
    max-width: 85%;
    clear: both;
    opacity: 0;
    animation: wcvm-fade-in 0.4s forwards;
}

@keyframes wcvm-fade-in {
    to {
        opacity: 1;
    }
}

.wcvm-message-meta {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
    padding: 0 5px;
}

.wcvm-message-meta .wcvm-message-time {
    margin-left: 8px;
    font-style: italic;
}

.wcvm-message-content {
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Sent Messages (Current User) */
.wcvm-message.sent {
    align-self: flex-end;
    text-align: right;
}

.wcvm-message.sent .wcvm-message-content {
    /*background-color: #0073e6;*/
    background-color: #C6A758;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Received Messages (Other User) */
.wcvm-message.received {
    align-self: flex-start;
}

.wcvm-message.received .wcvm-message-content {
    background-color: #e5e5ea;
    color: #000;
    border-bottom-left-radius: 4px;
}

/* Form Styling */
.wcvm-form {
    display: flex;
    align-items: flex-end;
    padding: 12px;
    border-top: 1px solid #e0e0e0;
    background-color: #f9f9f9;
}

.wcvm-form textarea {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 18px;
    padding: 8px 15px;
    resize: none;
    margin-right: 10px;
    line-height: 1.5;
    max-height: 100px;
    transition: border-color 0.2s;
    font-family: inherit;
    font-size: 1em;
}

.wcvm-form textarea:focus {
    outline: none;
    /*border-color: #0073e6;*/
    border-color: #C6A758;
}

#wcvm-send-message-button {
    flex-shrink: 0;
    /*background-color: #0073e6;*/
    background-color: #C6A758;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    position: relative;
}

#wcvm-send-message-button:hover {
    background-color: #005a9c;
    background-color: #ab8b3a;
}

#wcvm-send-message-button:active {
    transform: scale(0.9);
}

.wcvm-button-icon svg {
    width: 20px;
    height: 20px;
    fill: #fff;
    transform: rotate(10deg) translateX(1px);
}

#wcvm-send-message-button.disabled,
#wcvm-send-message-button.is-loading {
    cursor: not-allowed;
    background-color: #999;
}

#wcvm-send-message-button.is-loading .wcvm-button-icon {
    visibility: hidden;
}

.wcvm-sending-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: wcvm-spin 1s linear infinite;
    display: none;
}

#wcvm-send-message-button.is-loading .wcvm-sending-spinner {
    display: block;
}

.is-loading {
    margin: 0 !important;
}

@keyframes wcvm-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* --- NEW: Mobile Responsive Styles --- */
@media (max-width: 768px) {
    /* Make the chat container taller on mobile for a better experience */
    .wcvm-chat-container {
        height: 75vh;
        width: 100%;
        max-height: none; /* Remove max-height on mobile */
    }

    /* Reduce padding on smaller screens */
    .wcvm-message-thread {
        padding: 15px 10px;
    }

    .wcvm-form {
        padding: 8px;
    }

    /* Adjust font sizes for better readability */
    .wcvm-message-content {
        font-size: 0.95em;
    }

    .wcvm-message-meta {
        font-size: 0.8em;
    }

    .wcvm-form textarea {
        padding: 6px 12px;
        font-size: 0.95em;
    }
}
