
/* Socket Craft — Live Chat */

.av-chat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1050;
    font-family: Inter, sans-serif;
}

.av-chat-toggle {
    width: 62px;
    height: 62px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #6d5dfc, #00c6ff);
    color: #fff;
    font-size: 27px;
    box-shadow: 0 12px 35px rgba(109, 93, 252, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position:relative
}

.av-chat-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(109, 93, 252, 0.45);
}

.av-chat-toggle:focus-visible,
.av-chat button:focus-visible,
.av-chat input:focus-visible {
    outline: 3px solid #00c6ff;
    outline-offset: 3px;
}

.av-chat-panel {
    position: absolute;
    right: 0;
    bottom: 78px;
    width: 370px;
    height: min(540px, calc(100dvh - 125px));
    background: #fff;
    border: 1px solid #e8eaf3;
    border-radius: 20px;
    box-shadow: 0 20px 65px rgba(7, 20, 38, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #17243b;
}

.av-chat-panel[hidden] {
    display: none !important;
}

.av-chat-header {
    padding: 20px;
    background: linear-gradient(135deg, #6d5dfc, #4a8bff);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.av-chat-header strong {
    display: block;
    font-size: 16px;
    font-weight: 700;
}

.av-chat-header span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.9;
}

.av-chat-close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

.av-chat-messages {
    flex: 1;
    min-height: 0;
    padding: 18px;
    overflow-y: auto;
    background: #f8faff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.av-chat-message {
    max-width: 85%;
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.av-chat-message-staff {
    align-self: flex-start;
    background: #fff;
    color: #263550;
    border: 1px solid #e7eaf3;
    border-bottom-left-radius: 4px;
}

.av-chat-message-visitor {
    align-self: flex-end;
    background: #6d5dfc;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.av-chat-form {
    padding: 14px;
    background: #fff;
    border-top: 1px solid #edf0f5;
}

.av-chat-visitor {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
}

.av-chat-visitor label {
    font-size: 12px;
    font-weight: 600;
    color: #34435e;
}

.av-chat-visitor input,
.av-chat-compose input {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #dfe4ee;
    border-radius: 10px;
    background: #fff;
    color: #17243b;
    font-size: 13px;
}

.av-chat-visitor input {
    margin-bottom: 5px;
}

.av-chat-compose {
    display: flex;
    gap: 9px;
    align-items: center;
}

.av-chat-compose input {
    flex: 1;
}

.av-chat-compose button {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: 0;
    border-radius: 11px;
    background: #6d5dfc;
    color: #fff;
    cursor: pointer;
}

.av-chat-compose button:hover {
    background: #5847ed;
}

.av-chat-status {
    margin: 8px 0 0;
    color: #64748b;
    font-size: 11px;
}

.av-chat-status:empty {
    display: none;
}

@media (max-width: 480px) {
    .av-chat {
        right: 14px;
        bottom: 14px;
    }

    .av-chat-toggle {
        width: 56px;
        height: 56px;
    }

    .av-chat-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 82px;
        width: auto;
        height: min(540px, calc(100dvh - 105px));
        border-radius: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .av-chat-toggle {
        transition: none;
    }
}


/* ============================================================
   Socket Craft — Live Chat UI Improvements
   ============================================================ */

/* Smoother message area */
.av-chat-messages {
    gap: 10px;
    padding: 16px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

/* Professional, compact message bubbles */
.av-chat-message {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

/* Staff messages */
.av-chat-message-staff {
    background: #ffffff;
    color: #263550;
    border: 1px solid #e5eaf3;
    border-bottom-left-radius: 5px;
}

/* Visitor messages */
.av-chat-message-visitor {
    background: linear-gradient(135deg, #6d5dfc, #6353f2);
    color: #ffffff;
    border: none;
    border-bottom-right-radius: 5px;
}

/* Sender names */
.av-chat-sender-name {
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1.4;
    margin-bottom: 5px !important;
    letter-spacing: 0.01em;
}

.av-chat-message-staff .av-chat-sender-name {
    color: #475569;
}

.av-chat-message-visitor .av-chat-sender-name {
    color: #ffffff;
}

/* Message content */
.av-chat-message-text {
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Improve input and send button */
.av-chat-compose input {
    min-height: 42px;
    transition: border-color 0.2s ease;
}

.av-chat-compose input:focus {
    border-color: #6d5dfc;
}

.av-chat-compose button {
    transition: background 0.2s ease, transform 0.2s ease;
}

.av-chat-compose button:hover:not(:disabled) {
    background: #5847ed;
    transform: translateY(-1px);
}

.av-chat-compose button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile improvements */
@media (max-width: 480px) {
    .av-chat-messages {
        padding: 12px;
        gap: 9px;
    }

    .av-chat-message {
        max-width: 88%;
        padding: 10px 12px;
    }

    .av-chat-header {
        padding: 16px;
    }

    .av-chat-form {
        padding: 12px;
    }
}


/* ============================================================
   MOBILE LIVE CHAT FIX
   ============================================================ */

@media (max-width: 480px) {

    .av-chat {
        position: fixed;
        right: 12px;
        bottom: 12px;
        z-index: 9999;
    }

    .av-chat-panel {
        position: fixed;

        top: 12px;
        left: 12px;
        right: 12px;
        bottom: 80px;

        width: auto;
        height: auto;
        max-height: none;

        display: flex;
        flex-direction: column;

        border-radius: 16px;
        overflow: hidden;
        z-index: 10000;
    }

    .av-chat-header {
        flex-shrink: 0;
    }

    .av-chat-messages {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .av-chat-form {
        flex-shrink: 0;
    }

    .av-chat-compose input {
        font-size: 16px;
    }

    .av-chat-toggle {
        width: 56px;
        height: 56px;
    }
}


/* ============================================================
   PREVENT BACKGROUND SCROLLING WHILE MOBILE CHAT IS OPEN
   ============================================================ */

@media (max-width: 480px) {

    html.av-chat-open,
    body.av-chat-open {
        overflow: hidden !important;
        overscroll-behavior: none;
    }

    .av-chat-panel {
        overscroll-behavior: contain;
    }

    .av-chat-messages {
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }
}

@media (max-width: 480px) {
    html.av-chat-open {
        overflow: hidden !important;
        overscroll-behavior: none;
    }

    .av-chat-panel {
        position: fixed;
        top: 12px;
        bottom: 80px;
        left: 12px;
        right: 12px;
        height: auto;
        max-height: none;
        overflow: hidden;
        overscroll-behavior: contain;
    }

    .av-chat-messages {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }
}


/* Live Chat message timestamps */

.av-chat-message-time {
    display: block;
    margin-top: 6px;
    font-size: 10px;
    line-height: 1.3;
    text-align: right;
    opacity: 0.7;
}

.av-chat-message-staff .av-chat-message-time {
    color: #64748b;
}

.av-chat-message-visitor .av-chat-message-time {
    color: #ffffff;
}


/* Live Chat unread badge */

.av-chat-toggle {
    position: relative;
}


.av-chat-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;

    min-width: 20px;
    height: 20px;
    padding: 0 5px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #ef4444;
    color: #ffffff;

    border: 2px solid #ffffff;
    border-radius: 999px;

    font-size: 10px;
    font-weight: 700;
    line-height: 1;

    box-sizing: border-box;
    z-index: 10;
    pointer-events: none;
}

.av-chat-unread-badge[hidden] {
    display: none !important;
}


.av-chat-unread-badge[hidden] {
    display: none !important;
}


/* ==========================================
   LIVE CHAT HEADER ACTIONS
========================================== */

.av-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.av-chat-sound {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    padding: 0;
    border: none;
    border-radius: 10px;

    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;

    cursor: pointer;
    transition: background 0.2s ease;
}

.av-chat-sound:hover {
    background: rgba(255, 255, 255, 0.22);
}

.av-chat-sound:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.av-chat-sound i {
    font-size: 17px;
}

