/* css/chat.css */
.av-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1050;
    font-family: system-ui, -apple-system, sans-serif;
}

.av-chat-button {
    width: 60px;
    height: 60px;
    background: #0d6efd;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.4);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    outline: none;
}

.av-chat-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(13, 110, 253, 0.6);
}

.av-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.av-chat-window.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.av-chat-header {
    background: #0d6efd;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.av-chat-header-close {
    cursor: pointer;
    font-size: 20px;
    opacity: 0.8;
}

.av-chat-header-close:hover {
    opacity: 1;
}

.av-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
}

.av-chat-msg-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 5px;
}
.av-chat-msg-wrapper.client {
    flex-direction: row-reverse;
}
.av-chat-msg-wrapper.manager {
    flex-direction: row;
}

.av-chat-avatar {
    width: 32px;
    height: 32px;
    background: #0d6efd;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.av-chat-msg-container {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.av-chat-msg-name {
    font-size: 11px;
    color: #6c757d;
    margin-bottom: 3px;
    margin-left: 5px;
}

.av-chat-msg {
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.av-chat-msg.client {
    background: #0d6efd;
    color: white;
    border-bottom-right-radius: 4px;
}

.av-chat-msg.manager {
    background: #e9ecef;
    color: #212529;
    border-bottom-left-radius: 4px;
}

.av-chat-msg-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.av-chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 10px;
}

.av-chat-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 8px 15px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
}

.av-chat-input:focus {
    border-color: #0d6efd;
}

.av-chat-send {
    background: #0d6efd;
    color: white;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.av-chat-send:hover {
    background: #0b5ed7;
}

.av-chat-attach {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: #6c757d;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.av-chat-attach:hover {
    background: #e9ecef;
    color: #0d6efd;
}

.av-chat-attach.loading {
    animation: avChatPulse 1s infinite;
    pointer-events: none;
    opacity: 0.6;
}

@keyframes avChatPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.chat-image {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 5px;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

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

.chat-lightbox {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    z-index: 1060;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
}
.chat-lightbox.active {
    opacity: 1; pointer-events: auto;
}
.chat-lightbox img {
    max-width: 90%; max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    transform: scale(0.9); transition: transform 0.3s;
}
.chat-lightbox.active img {
    transform: scale(1);
}
.chat-lightbox-close {
    position: absolute; top: 20px; right: 30px;
    color: white; font-size: 40px; cursor: pointer;
    font-weight: 300;
}
.chat-lightbox-close:hover {
    color: #ccc;
}

/* Mobile responsive */
@media (max-width: 576px) {
    .av-chat-widget {
        bottom: 20px;
        right: 20px;
    }
    .av-chat-button {
        width: 55px;
        height: 55px;
        font-size: 24px;
    }
    .av-chat-window {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important; /* Override base 500px */
        border-radius: 0 !important;
        z-index: 9999 !important;
        transform: translateY(100%);
    }
    .av-chat-window.open {
        transform: translateY(0) !important;
    }
    .av-chat-header {
        padding: 12px 15px;
    }
    .av-chat-input {
        font-size: 16px !important; /* Fix for iOS Safari auto-zoom bug */
    }
}
