﻿html, body {
    height: 100%;
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI", sans-serif;
    font-size:  1rem;
}

chat-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

    chat-app .header {
        flex-shrink: 0;
        height: 60px;
        background-color: #1a1a1a;
        color: white;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 10px;
        font-size: 18px;
        border-bottom: 1px solid #333;
    }

    chat-app .title {
        font-size: 20px;
        font-weight: bold;
        color: #ff4e02;
    }

    chat-app .user-info {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    chat-app .avatar {
        width: 32px;
        height: 32px;
        background-color: #444;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        color: white;
        text-transform: uppercase;
    }

    chat-app .logout {
        background: none;
        border: 1px solid #888;
        color: white;
        padding: 7px 10px;
        border-radius: 4px;
        cursor: pointer;
        font-size: 14px;
    }

        chat-app .logout:hover {
            background-color: #555;
        }

    chat-app .main {
        flex: 1;
        display: flex;
        overflow: hidden;
        height: 100%;
    }

        chat-app .main .chat-list {
            width: 300px;
            background-color: #2a2a2a;
            overflow-y: auto;
            height: 100%;
            box-sizing: border-box;
            flex-shrink: 0;
        }


.chat-views {
    flex: 1;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(350px, 1fr); /* 1 column per chat view */
    overflow-x: auto;
    gap: 10px;
    padding: 10px;
    height: 100%;
    box-sizing: border-box;
    background-color: #373737;
}


chat-view {
    height: 100%;
    min-width: 250px;
    flex-shrink: 0;
    box-sizing: border-box;
    background-color: #1a1a1a;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* prevent outer scrollbars */
    position: relative; /* required for overlay positioning too */
}

    chat-view .chat-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        position: relative;
        padding: 15px 20px;
        background-color: #2a2a2a;
        border-bottom: 1px solid #444;
    }

    chat-view .chat-info {
        flex: 1;
    }
        chat-view .chat-info .name-status {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        chat-view .chat-info .name {
            font-size: 1.5rem;
            color: #fff;
            margin-bottom: 10px;
        }

        chat-view .chat-info .description {
            font-size: 1rem;
            color: #cacaca;
        }

        chat-view .client-status {
            padding: 2px 5px;
            border-radius: 3px;
            color: #fff;
            margin-bottom: 8px;
        }
            chat-view .client-status.online {
                background-color: green;
            }
            chat-view .client-status.offline {
                background-color: red;
            }
    chat-view .chat-controls-wrapper {
        position: relative;
        min-width: fit-content;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
    }

    chat-view .chat-controls {
        display: flex;
        flex-direction: row; /* 👈 now horizontal */
        align-items: center;
        gap: 12px;
        margin-top: 30px; /* space below close button */
    }

        chat-view .chat-controls i {
            color: #ccc;
            font-size: 1.1rem;
            cursor: pointer;
            transition: transform 0.2s;
        }

            chat-view .chat-controls i:hover {
                transform: scale(1.2);
                color: #fff;
            }

    chat-view .chat-view-close-button {
        position: absolute;
        top: 0;
        right: 0;
        font-size: 1.3rem;
        color: #6b6b6b;
        cursor: pointer;
    }

        chat-view .chat-view-close-button:hover {
            color: white;
            transform: scale(1.2);
        }

    chat-view .chat-body {
        flex: 1 1 auto;
        overflow-y: auto;
        padding: 12px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    chat-view .chat-footer-wrapper {
        position: relative;
    }

        /* Blur + dim the underlying footer when overlay is active */
        .chat-footer-wrapper.overlay-active .chat-footer {
            filter: blur(2px) brightness(0.5);
            pointer-events: none; /* prevent clicks on blurred footer */
        }

    /* Ghosted overlay on top */
    .chat-footer-overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.2); /* more transparent */
        backdrop-filter: blur(2px); /* softens it further */
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 10;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        transition: opacity 0.3s ease;
    }
    .chat-footer-wrapper.chat-ended .chat-footer,
    .chat-footer-wrapper.chat-ended .chat-footer-overlay {
        display: none;
    }

    chat-view .chat-join-button {
        background: transparent;
        color: #fff;
        border: 2px solid #fff;
        padding: 10px 22px;
        border-radius: 25px;
        font-weight: 600;
        font-size: 1rem;
        cursor: pointer;
        backdrop-filter: blur(1px);
        transition: background 0.3s, color 0.3s, border 0.3s;
    }

        chat-view .chat-join-button:hover {
            background: #fff;
            color: #000;
        }


    chat-view .chat-footer {
        padding: 20px 15px 10px 15px;
        border-top: 1px solid #383838;
        background-color: #1a1a1a;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
    }

    chat-view .chat-input {
        background-color: #222;
        border: 1px solid #444;
        padding: 8px;
        height:40px;
        border-radius: 4px;
        color: white;
        outline: none;
        resize: none;
        width: 100%;
        font-family: system-ui, -apple-system, "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI", sans-serif;
    }


        chat-view .chat-input:empty:before {
            content: attr(placeholder);
            color: #666;
        }

    

    chat-view .chat-actions {
        display: flex;
        align-items: center;
        margin-top: 10px;
        gap: 10px;
    }

        chat-view .chat-actions i {
            cursor: pointer;
            color: #888;
            font-size: 1.1rem;
            transition: transform 0.2s;
        }

            chat-view .chat-actions i:hover {
                transform: scale(1.2);
                color: #ccc;
            }

    chat-view .send-button {
        margin-left: auto;
        background-color: #007bff;
        color: white;
        border: none;
        padding: 6px 12px;
        border-radius: 4px;
        cursor: pointer;
        font-weight: bold;
    }

        chat-view .send-button:hover {
            background-color: #0056b3;
        }
        chat-view .send-button:disabled {
            background-color: #444;
        }

    chat-view .canned-responses-panel {
        background: #2a2a2a;
        padding: 10px 15px;
        border-top: 1px solid #444;
        border-bottom: 1px solid #444;
        max-height: 225px;
        min-height: 135px;
        overflow-y: auto;
    }

    chat-view .canned-response {
        padding: 6px 8px;
        cursor: pointer;
        border-radius: 4px;
        background: #3a3a3a;
        margin-bottom: 4px;
        color: #eee;
        transition: background 0.2s;
    }

        chat-view .canned-response:hover {
            background: #555;
        }

/* Style the custom element itself */
chat-list {
    display: block;
    max-width: 300px;
    width: 100%;
    overflow-y: auto;
    min-height: 0;
    flex: 1;
    background: #1f1f1f;
    color: white;
    border-right: 1px solid #333;
}


    /* Outer list containing all chat groups */
    chat-list .chat-groups {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    /* Each chat group section */
    chat-list .chat-group {
        border-bottom: 1px solid #444;
    }

    /* Group header (clickable to collapse) */
    chat-list .chat-group-header {
        background: #333;
        color: #ccc;
        padding: 10px 12px;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

        /* Chevron animation */
        chat-list .chat-group-header .chevron {
            transition: transform 0.2s ease;
        }

    chat-list .chat-group.collapsed .chat-group-header .chevron {
        transform: rotate(-180deg);
    }

    /* Hidden chat list when collapsed */
    chat-list .chat-group.collapsed .chat-group-chats {
        display: none;
    }

    /* Inner list of chat cards */
    chat-list .chat-group-chats {
        overflow: hidden;
        max-height: 1000px; /* arbitrary large value */
        transition: max-height 0.3s ease;
    }

    chat-list .chat-group.collapsed .chat-group-chats {
        max-height: 0;
    }

    chat-list .chat-card {
        display: flex;
        align-items: center;
        padding: 10px 12px;
        margin: 6px 8px;
        background: #2a2a2a;
        border-radius: 1px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
        transition: background 0.2s ease, box-shadow 0.2s ease;
        cursor: pointer;
    }

        chat-list .chat-card:hover {
            background: #353535;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
        }

        chat-list .chat-card .icon {
            margin-right: 10px;
            font-size: 20px;
            flex-shrink: 0;
            color: #58b5d7;
        }

        chat-list .chat-card .info {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 2px;
            overflow: hidden;
        }

            chat-list .chat-card .info .name {
                font-weight: 600;
                font-size: 0.95rem;
                color: #fff;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                margin-bottom: 3px;
            }

            chat-list .chat-card .info .location {
                font-size: 0.85rem;
                color: #aaa;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

        chat-list .chat-card[data-status="queue"] {
            border-left: 4px solid orange;
        }

        chat-list .chat-card[data-status="mine"] {
            border-left: 4px solid #58b5d7;
        }

        chat-list .chat-card[data-status="missed"] {
            border-left: 4px solid red;
        }

        chat-list .chat-card[data-status="ended"] {
            border-left: 4px solid gray;
        }

    chat-list .count-badge {
        display: inline-block;
        padding: 2px 6px;
        background: #555;
        color: #fff;
        font-size: 0.75rem;
        border-radius: 999px;
        min-width: 18px;
        text-align: center;
        transition: background 0.3s, transform 0.2s;
    }

        chat-list .count-badge.flash {
            background: #58b5d7;
            transform: scale(1.15);
        }

    chat-list .chat-group-meta {
        display: flex;
        align-items: center;
        gap: 15px;
    }

    chat-list .chevron {
        transition: transform 0.3s ease, color 0.2s ease;
        cursor: pointer;
    }

        chat-list .chevron.disabled {
            color: #555;
            cursor: default;
        }








.portal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.5s ease;
    pointer-events: all;
}

    .portal-overlay.fade-out {
        opacity: 0;
        pointer-events: none;
    }

.overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 1.5rem;
}

    .overlay-content i {
        font-size: 2.5rem;
        animation: spin 1s linear infinite;
    }

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}



.chat-set-container {
    width: 100%;
    background: #1f1f1f;
    border-bottom: 1px solid #333;
    box-sizing: border-box;
    display: none;
    z-index: 5;
}

chat-set {
    display: block;
    box-sizing: border-box;
    padding: 15px;
    background: #2a2a2a;
    animation: slideDown 0.2s ease-out;
    max-height: 300px;
    display: flex;
    flex-direction: column;
}

.chat-set-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reset-button {
    background-color: transparent;
    border: 1px solid #555555;
    border-radius: 4px;
    padding: 1px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    color: #cacaca;
}
    .reset-button:hover {
        background-color: #555;
    }

    /* Header */
    chat-set .chat-set-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
    }

        chat-set .chat-set-header .label {
            font-size: 1rem;
            font-weight: 600;
            color: #f0f0f0;
        }

        chat-set .chat-set-header .close-button {
            font-size: 1rem;
            color: #999;
            cursor: pointer;
            transition: color 0.2s;
        }

            chat-set .chat-set-header .close-button:hover {
                color: #fff;
            }

    /* Search Input */
    chat-set input[type="text"] {
        width: 100%;
        padding: 6px 10px;
        font-size: 1rem;
        border: 1px solid #555;
        border-radius: 4px;
        background: #1c1c1c;
        color: #f0f0f0;
        margin-bottom: 10px;
    }

    /* Scrollable Results Area */
    chat-set .chat-set-result-scroll {
        flex: 1 1 auto;
        overflow-y: auto;
    }

    /* Results List */
    chat-set .result-list {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    chat-set .result-item {
        display: flex;
        align-items: flex-start;
        padding: 8px 10px;
        border-radius: 4px;
        background: #3a3a3a;
        margin-bottom: 6px;
        cursor: pointer;
        transition: background 0.2s;
        color: #fff;
    }

        chat-set .result-item:hover {
            background: #333;
        }

    chat-set .result-item i {
        flex-shrink: 0;
        font-size: 1.2rem;
        margin-right: 10px;
        color: #0056b3;
    }

    chat-set .result-content {
        flex-grow: 1;
    }

    chat-set .result-name {
        font-weight: 500;
        color: #f0f0f0;
    }

    chat-set .result-description {
        font-size: 0.9rem;
        color: #bbb;
        margin-top: 2px;
    }

/* Animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.searching {
    padding: 12px;
    text-align: center;
    color: #ccc;
    font-style: italic;
    font-size: 0.95rem;
}

    .searching::before {
        content: '';
        display: inline-block;
        width: 14px;
        height: 14px;
        border: 2px solid #ccc;
        border-top-color: transparent;
        border-radius: 50%;
        margin-right: 8px;
        vertical-align: middle;
        animation: spin 1s linear infinite;
    }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.searching.error::before {
    display: none;
    color: #f88;
}

.end-chat-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.end-chat-panel {
    background: #1e1e1e;
    padding: 24px;
    /* border-radius: 6px; */
    text-align: center;
    /* max-width: 400px; */
    width: 100%;
    box-shadow: 0 0 12px rgba(0,0,0,0.5);
}
    .end-chat-panel p {
        margin-bottom: 20px;
        color: #fff;
        font-size: 1.1rem;
    }

    .end-chat-panel .buttons button {
        margin: 0 8px;
        padding: 8px 14px;
        border: none;
        border-radius: 4px;
        cursor: pointer;
    }

        .end-chat-panel .buttons button[data-choice="cancel"] {
            background: #555;
            color: white;
        }

        .end-chat-panel .buttons button[data-choice="end-only"] {
            background: #f0ad4e;
            color: black;
        }

        .end-chat-panel .buttons button[data-choice="end-and-close"] {
            background: #d9534f;
            color: white;
        }




/* Base bubble */
/* Base bubble */
chat-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 16px;
    position: relative;
    word-wrap: break-word;
    font-size: 0.95rem;
    display: inline-block;
    line-height: 1.4;
}

    chat-bubble.right {
        align-self: flex-end;
        background-color: #00465b;
        color: #e0e0e0;
        border-bottom-right-radius: 0px;
        text-align: right;
    }

    /* User/Question message (left side) */
    chat-bubble.left {
        align-self: flex-start;
        border-bottom-left-radius: 0;
        text-align: left;
        background-color: #c7572f;
        color: #fff;
    }

        chat-bubble.left.typing {
            background-color: #ccc;
            color: #000;
        }
        chat-bubble.left.note {
            background-color: #ffff93;
            color: #000;
        }
        chat-bubble.right.note {
            background-color: #ffff93;
            color: #000;
        }

        chat-bubble.event {
            width: 100% !important;
            max-width: none !important;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            color: #aaa;
            font-size: 1rem;
            margin: 10px 0;
            padding: 0 10px;
            line-height: 1;
        }
            /* Horizontal lines before/after event text */
            chat-bubble.event::before,
            chat-bubble.event::after {
                content: "";
                flex: 1;
                height: 1px;
                background: #444;
                margin: 0 10px;
            }

            chat-bubble.event .event-message {
                display: inline;
                white-space: pre-wrap; /* ✅ Ensures spaces inside are preserved */
            }


/* Main message text block */
.bubble-content {
    white-space: pre-wrap;
}

/* Metadata (timestamp, sender) */
.bubble-meta {
    font-size: 0.75rem;
    margin-top: 4px;
    text-align: right;
    opacity: 0.6;
}

    .bubble-meta i {
        font-size: 0.75rem;
    }

/* Attachments block */
.bubble-attachments {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Image attachment */
.attachment-img img {
    max-width: 150px;
    border-radius: 4px;
}

/* File attachments */
.attachment-file a {
    color: #fff;
}

.attachment-file i {
    margin-right: 6px;
    color: #fff;
}

/* Audio attachment */
.attachment-audio audio {
    width: 200px;
}

.ticketBold {
    color: #58b5d7;
    white-space: normal;
}


.image-viewer-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.image-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    cursor: zoom-out;
}

.image-viewer-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 1001;
}

    .image-viewer-content img {
        max-width: 100%;
        max-height: 100%;
        border-radius: 6px;
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    }

.preview-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 16px;
    position: relative;
    word-wrap: break-word;
    font-size: 0.95rem;
    display: inline-block;
    line-height: 1.4;
    align-self: flex-start;
    border-bottom-left-radius: 0;
    text-align: left;
    background-color: #ebebc0;
    color: #000;
}



chat-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

    chat-attachments .attachment {
        background-color: #3a3a3a;
        border: 1px solid #555;
        border-radius: 5px;
        padding: 4px 10px;
        font-size: 0.85rem;
        color: #ccc;
        display: flex;
        align-items: center;
        gap: 6px;
    }

        chat-attachments .attachment svg {
            width: 16px;
            height: 16px;
            cursor: pointer;
            fill: #666;
            transition: fill 0.2s ease;
        }

            chat-attachments .attachment svg:hover {
                fill: #d00;
            }


.ff-app {
    border-radius: 50%;
}


.attachment-message {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #010d29;
    color: #fff;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 6px;
    align-self: flex-end; /* 🔑 pushes this item to the right */
}

    .attachment-message i {
        color: #fff;
        margin-left:10px;
    }



.fa-spin {
    animation: fa-spin 1s infinite linear !important;
    display: inline-block;
}
