:root {
    --slc-primary: #cc0000;
    --slc-primary-dark: #a30000;
    --slc-primary-rgba: rgba(204, 0, 0, 0.4);
    --slc-primary-light-rgba: rgba(204, 0, 0, 0.35);
}

/* ===== FLOATING ACTION BUTTON ===== */
#slc-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background-color: var(--slc-primary, #cc0000);
    border-radius: 50%;
    box-shadow: 0 4px 16px var(--slc-primary-rgba, rgba(204,0,0,0.4));
    cursor: pointer;
    z-index: 999997;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible; /* allow ring to show outside */
    transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease;
}
/* Spinning ring animation — centered around 60px circle */
#slc-chat-fab::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--slc-primary, #cc0000);
    border-right-color: var(--slc-primary-light-rgba, rgba(204,0,0,0.35));
    animation: slc-spin 2s linear infinite;
    pointer-events: none;
    box-sizing: border-box;
}
@keyframes slc-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
#slc-chat-fab:hover {
    transform: scale(1.06);
    background-color: var(--slc-primary-dark, #a30000);
    box-shadow: 0 6px 20px var(--slc-primary-rgba, rgba(204,0,0,0.55));
}
/* Icon centered inside circle with breathing room — like WhatsApp */
#slc-chat-fab img {
    width: 68%;
    height: 68%;
    object-fit: contain;
    position: relative; /* stay above ::before */
    z-index: 1;
    pointer-events: none;
}

/* ===== CHAT WINDOW ===== */
#slc-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 340px;
    height: 470px;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    z-index: 999998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    opacity: 0;
    transform: translateY(15px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
#slc-chat-window.slc-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ===== HEADER ===== */
#slc-chat-header {
    background: var(--slc-primary, #cc0000);
    color: #ffffff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
#slc-header-avatar {
    width: 38px;
    height: 38px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
#slc-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}
#slc-header-info {
    flex: 1;
}
#slc-header-name {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
}
#slc-header-status {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 2px;
    min-height: 16px;
}
#slc-chat-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    opacity: 0.85;
}
#slc-chat-close:hover { opacity: 1; }

/* ===== BODY ===== */
#slc-chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
}

/* ===== MESSAGES ===== */
.slc-msg-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    clear: both;
}
.slc-msg-wrapper.user { align-items: flex-end; }
.slc-msg-wrapper.admin { align-items: flex-start; }

.slc-msg { 
    padding: 10px 14px; 
    border-radius: 14px; 
    max-width: 80%; 
    font-size: 14px;
    word-wrap: break-word;
    line-height: 1.5;
}
.slc-msg.user { 
    background: var(--slc-primary, #cc0000); 
    color: #ffffff;
    border-bottom-right-radius: 3px;
}
.slc-msg.admin { 
    background: #e8e8e8; 
    color: #222222;
    border-bottom-left-radius: 3px;
}
.slc-msg-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

/* ===== TYPING INDICATOR ===== */
#slc-typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: #999;
    font-size: 13px;
}
#slc-typing-indicator .slc-dots span {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--slc-primary, #cc0000);
    margin: 0 2px;
    animation: slc-bounce 1.3s infinite ease-in-out;
}
#slc-typing-indicator .slc-dots span:nth-child(2) { animation-delay: 0.2s; }
#slc-typing-indicator .slc-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes slc-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ===== FOOTER INPUT ===== */
#slc-chat-footer {
    padding: 12px;
    border-top: 1px solid #eeeeee;
    background: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}
#slc-message-input {
    flex: 1;
    padding: 10px 15px;
    border: 1.5px solid #ddd;
    border-radius: 22px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
#slc-message-input:focus { border-color: var(--slc-primary, #cc0000); }
#slc-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--slc-primary, #cc0000);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}
#slc-send-btn:hover { background: var(--slc-primary-dark, #a30000); }
#slc-send-btn:active { transform: scale(0.93); }

/* ===== RESPONSIVE BREAKPOINT ===== */
@media (max-width: 1024px) {
    #slc-chat-fab {
        right: 20px;
        bottom: 22px;
        width: 52px;
        height: 52px;
    }
    #slc-chat-fab::before {
        top: -5px;
        left: -5px;
        width: 62px;
        height: 62px;
    }
    #slc-chat-window {
        right: 20px;
        bottom: 84px;
        width: calc(100vw - 40px);
        max-width: 340px;
        height: 440px;
    }
}

/* ===== RTL SUPPORT (Arabic / Hebrew) ===== */
#slc-chat-window.slc-rtl {
    direction: rtl;
    text-align: right;
}
#slc-chat-window.slc-rtl #slc-chat-close {
    margin-right: auto;
    margin-left: 0;
}
#slc-chat-window.slc-rtl #slc-send-btn svg {
    transform: scaleX(-1);
}
#slc-chat-window.slc-rtl .slc-msg-time {
    text-align: right;
}

