.visitor-chat-wrapper {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
}

.chat-trigger-btn {
    background-color: #0d6efd;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.chat-trigger-btn:hover {
    transform: scale(1.05);
}

.chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 320px;
    height: 420px;
    background-color: #fff;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-window.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chat-header {
    background-color: #0d6efd;
    padding: 12px 15px;
    color: #fff;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background-color: #2ec4b6;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #2ec4b6;
}

.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f8f9fa;
}

.welcome-bubble {
    background-color: #e9ecef;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.message-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.visitor-bubble {
    background-color: #0d6efd;
    color: #fff;
    border-bottom-right-radius: 2px;
}

.moderator-bubble {
    background-color: #e2e8f0;
    color: #334155;
    border-bottom-left-radius: 2px;
}

.msg-time {
    font-size: 0.6rem;
    display: block;
    text-align: left;
    margin-top: 3px;
    opacity: 0.7;
}

.chat-footer input:focus {
    box-shadow: none;
}


/**/

.visitor-chat-wrapper {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    font-family: 'Cairo', sans-serif;
}

.chat-trigger-btn {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(13, 110, 253, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-trigger-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(13, 110, 253, 0.45);
}

.chat-trigger-btn:active {
    transform: translateY(-1px);
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 480px;
    background-color: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-window.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-header {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    padding: 16px 20px;
    color: #ffffff;
}

.status-indicator {
    width: 10px;
    height: 10px;
    background-color: #2ec4b6;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    box-shadow: 0 0 8px #2ec4b6;
    animation: pulseStatus 2s infinite;
}

@keyframes pulseStatus {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 196, 182, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(46, 196, 182, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 196, 182, 0);
    }
}

.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f8fafc;
    scroll-behavior: smooth;
}

.chat-body::-webkit-scrollbar {
    width: 5px;
}

.chat-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.welcome-bubble {
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 12px 16px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    word-wrap: break-word;
    font-size: 0.9rem;
    line-height: 1.45;
}

.visitor-bubble {
    background: #0d6efd;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.moderator-bubble {
    background: #ffffff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.msg-time {
    font-size: 0.65rem;
    display: block;
    margin-top: 4px;
    opacity: 0.75;
    text-align: left;
}

.chat-footer {
    padding: 12px 16px;
    background-color: #ffffff !important;
    border-top: 1px solid #f1f5f9 !important;
}

.chat-footer input {
    font-size: 0.9rem;
    color: #334155;
    outline: none;
}

.chat-footer input::placeholder {
    color: #94a3b8;
}

.chat-footer input:focus {
    box-shadow: none !important;
    background-color: transparent !important;
}

.chat-footer .btn-primary {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0d6efd;
    border: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.chat-footer .btn-primary:hover {
    background-color: #0b58ca;
}

.chat-footer .btn-primary:active {
    transform: scale(0.92);
}

.custom-input {
    /* 1. Base input resets & box model */
    display: block;
    width: 100%;
    box-sizing: border-box;
    /* 2. bg-transparent & border-0 */
    background-color: transparent !important;
    border: 0 !important;
    /* 3. form-control-sm (Sizing & Spacing) */
    padding: 0.25rem 0.5rem;
    /* ~4px top/bottom, 8px left/right */
    font-size: 0.875rem;
    /* 14px */
    border-radius: 0.25rem;
    /* 4px rounded corners */
    line-height: 1.5;
    /* 4. Typography & Appearance */
    font-family: inherit;
    color: #212529;
    /* Standard dark text color */
    appearance: none;
    -webkit-appearance: none;
    /* 5. Smooth focus state transition */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}


/* Placeholder styling */

.custom-input::placeholder {
    color: #6c757d;
    opacity: 1;
}


/* Focus state (removes browser outline) */

.custom-input:focus {
    outline: 0;
    color: #212529;
}

.custom-btn-primary-sm-circle {
    /* 1. Reset & Display (btn) */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    /* 2. Primary Color Styling (btn-primary) */
    color: #ffffff;
    background-color: #0d6efd;
    /* Bootstrap primary blue */
    border-color: #0d6efd;
    /* 3. Small Sizing (btn-sm) */
    font-size: 0.875rem;
    /* 14px */
    /* 4. Padding & Circle Shape (px-2 + rounded-circle) */
    padding-left: 0.5rem;
    /* ~8px (px-2) */
    padding-right: 0.5rem;
    /* ~8px (px-2) */
    padding-top: 0.25rem;
    /* Standard btn-sm vertical padding */
    padding-bottom: 0.25rem;
    border-radius: 50% !important;
    /* rounded-circle */
    /* Helper to maintain a perfect square/circle ratio */
    width: 31px;
    height: 31px;
    box-sizing: border-box;
}


/* Hover State */

.custom-btn-primary-sm-circle:hover {
    color: #ffffff;
    background-color: #0b5ed7;
    border-color: #0a58ca;
}


/* Focus State */

.custom-btn-primary-sm-circle:focus {
    color: #ffffff;
    background-color: #0b5ed7;
    border-color: #0a58ca;
    box-shadow: 0 0 0 0.25rem rgba(49, 132, 253, 0.5);
    outline: 0;
}


/* Active / Pressed State */

.custom-btn-primary-sm-circle:active {
    color: #ffffff;
    background-color: #0a58ca;
    border-color: #0a53be;
}


/* Disabled State */

.custom-btn-primary-sm-circle:disabled {
    pointer-events: none;
    opacity: 0.65;
}


/* ==========================================
   1. HEADER CONTAINER LAYOUT
========================================== */

.chat-header {
    background-color: #0b3b60;
    /* Adjust to match your theme */
    padding: 12px 16px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    /* d-flex justify-content-between align-items-center */
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* Inner flex wrapper (d-flex align-items-center gap-2) */

.chat-header>div:first-child {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* ~8px (gap-2) */
}


/* ==========================================
   2. TYPOGRAPHY & TEXT UTILITIES
========================================== */


/* h6 element resets + (mb-0 fw-bold text-white small) */

.chat-header h6 {
    margin-top: 0;
    margin-bottom: 0;
    /* mb-0 */
    font-weight: 700;
    /* fw-bold */
    color: #ffffff;
    /* text-white */
    font-size: 0.875rem;
    /* small (14px) */
    line-height: 1.2;
}


/* Subtitle (text-white-50) */

.text-white-50 {
    color: rgba(255, 255, 255, 0.5) !important;
    /* text-white-50 */
    display: block;
}


/* Status Dot Indicator */

.status-indicator {
    width: 9px;
    height: 9px;
    background-color: #22c55e;
    /* Green indicator */
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
    flex-shrink: 0;
}


/* ==========================================
   3. CLOSE BUTTON (btn-close btn-close-white)
========================================== */

.btn-close-white {
    /* Reset button styles */
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    /* Sizing (small) */
    width: 0.8em;
    height: 0.8em;
    box-sizing: content-box;
    /* Pure CSS 'X' icon representation */
    opacity: 0.75;
    transition: opacity 0.15s ease-in-out;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


/* Close icon X vector using CSS masking */

.btn-close-white::before {
    content: "";
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/contain no-repeat;
}


/* Hover & Focus states */

.btn-close-white:hover {
    opacity: 1;
}

.btn-close-white:focus {
    outline: none;
    opacity: 1;
}

@media (max-width: 480px) {
    .visitor-chat-wrapper {
        bottom: 15px;
        right: 15px;
    }
    .chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 120px);
        max-height: 550px;
    }
}