/* Secure Live Chat - Public Styles (v1.4.0) - Modern UX Redesign */

/* Chat Bubble */
#slc-chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #a96fd6 0%, #8a4fb8 100%);
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(169, 111, 214, 0.4);
    transition: all 0.3s;
    z-index: 9998;
    opacity: 1 !important;
    visibility: visible !important;
}

#slc-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(169, 111, 214, 0.6);
}

#slc-chat-bubble i {
    font-size: 24px;
    color: #fff !important;
}

#slc-chat-bubble svg {
    color: #fff !important;
}

#slc-chat-bubble.hidden {
    opacity: 0 !important;
    pointer-events: none;
    transform: scale(0.8);
}

/* Chat Window Container */
#slc-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 20000;
}

#slc-chat-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 420px;
    height: 600px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

#slc-chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

#slc-chat-window.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* Window Header */
.slc-window-header {
    background: linear-gradient(135deg, #a96fd6 0%, #8a4fb8 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(169, 111, 214, 0.2);
}

.slc-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

#slc-header-title {
    font-weight: 600;
    font-size: 16px;
}

.slc-header-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.slc-icon-btn {
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    border-radius: 50% !important;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slc-icon-btn i {
    color: #fff !important;
}

.slc-icon-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

#slc-close-chat {
    font-size: 22px;
}

/* Chat Body */
#slc-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Start Screen */
#slc-start-screen {
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: center;
    height: 100%;
}

#slc-start-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#slc-start-form p {
    margin: 0 0 4px 0;
    color: #666;
    font-size: 16px;
    text-align: center;
}

#slc-start-form input {
    width: 100%;
    padding: 14px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s;
}

#slc-start-form input:focus {
    outline: none;
    border-color: #a96fd6;
    box-shadow: 0 0 0 3px rgba(169, 111, 214, 0.1);
}

#slc-start-chat-btn {
    background: linear-gradient(135deg, #a96fd6 0%, #8a4fb8 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(169, 111, 214, 0.3);
    margin: 8px auto 0 auto;
    width: fit-content;
    min-width: 140px;
}

#slc-start-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(169, 111, 214, 0.4);
}

#slc-start-chat-btn:active {
    transform: translateY(0);
}

/* Conversation List */
#slc-conversation-list {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.slc-conv-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 16px 0;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 16px;
}

.slc-conv-list-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1a1a1a;
}

.slc-new-btn {
    background: linear-gradient(135deg, #a96fd6 0%, #8a4fb8 100%);
    color: #fff !important;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.slc-new-btn i {
    color: #fff !important;
}

.slc-new-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(169, 111, 214, 0.3);
}

#slc-conversations {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slc-conversation-item {
    padding: 14px;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    overflow: hidden;
}

.slc-conversation-item:hover {
    border-color: #a96fd6;
    box-shadow: 0 4px 12px rgba(169, 111, 214, 0.15);
}

.slc-conv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.slc-conv-name {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 14px;
}

.slc-conv-time {
    font-size: 11px;
    color: #999;
}

.slc-conv-preview {
    font-size: 13px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Chat Screen */
#slc-chat-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

#slc-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9f9f9;
}

/* Message Wrapper Layout */
.slc-message-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 4px;
}

.slc-message-wrapper.user {
    align-self: flex-end;
}

.slc-message-wrapper.admin {
    flex-direction: row;
    align-self: flex-start;
}

/* Message Icons */
.slc-message-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
}

.slc-message-wrapper.admin .slc-message-icon {
    background: #a96fd6;
    color: #fff;
}

.slc-message-wrapper.user .slc-message-icon,
.slc-message-wrapper.admin .slc-message-icon.robot-icon {
    background: #ddd;
    color: #666;
}

/* Message Content Wrapper */
.slc-message-content {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.slc-message-wrapper.user .slc-message-content {
    align-items: flex-end;
}

.slc-message-wrapper.admin .slc-message-content {
    align-items: flex-start;
}

/* Message Bubbles */
.slc-message {
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
    max-width: 100%;
}

.slc-message.user {
    background: #fff;
    color: #1a1a1a;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.slc-message.admin {
    background: #fff;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Admin messages (left side) */
.slc-message.admin {
    border-bottom-left-radius: 4px;
}

/* User messages (right side) */
.slc-message.user {
    border-bottom-right-radius: 4px;
    background: #f0f2f5;
}

/* Pending message state (reduced opacity) */
.slc-message.pending {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

/* Failed message state */
.slc-message.failed {
    opacity: 0.7;
    background: #ffebee !important;
    color: #c62828 !important;
}

.slc-msg-time {
    font-size: 10px;
    color: #999;
    padding: 0 4px;
    align-self: flex-end;
}

/* Support Badge (legacy) */
.slc-support-badge {
    position: absolute;
    top: -10px;
    left: -5px;
    background: #fff;
    color: #a96fd6;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1;
    white-space: nowrap;
}

.slc-message.admin {
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    margin-top: 15px;
    /* Add space for badge */
}

/* Chat Footer */
/* Chat Input Area */
#slc-input-area {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#slc-message-input {
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    max-height: 250px;
    min-height: 80px;
    line-height: 1.4;
    overflow-y: auto;
    scrollbar-width: none;
    box-sizing: border-box;
}

#slc-message-input::-webkit-scrollbar {
    display: none;
}

#slc-message-input:focus {
    outline: none;
    border-color: #a96fd6;
}

#slc-message-input::placeholder {
    color: #999;
}

.slc-input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.slc-input-tools {
    display: flex;
    gap: 8px;
}

.slc-input-icon-btn {
    background: transparent !important;
    border: none !important;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    transition: all 0.2s;
    line-height: 1;
    color: #666;
    width: 32px;
    height: 32px;
}

.slc-input-icon-btn:hover {
    background: #f0f2f5 !important;
    color: #a96fd6;
}

#slc-send-btn {
    background: linear-gradient(135deg, #a96fd6 0%, #8a4fb8 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(169, 111, 214, 0.3);
}

#slc-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(169, 111, 214, 0.4);
}

#slc-send-btn i {
    font-size: 16px;
    margin-left: -2px;
}

/* Emoji Picker */
#slc-emoji-picker {
    position: absolute;
    bottom: 70px;
    left: 15px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    z-index: 100;
}

.slc-emoji-item {
    font-size: 24px;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
    user-select: none;
}

.slc-emoji-item:hover {
    background: #f0f2f5;
    transform: scale(1.2);
}

/* Hidden class */
.hidden {
    display: none !important;
}