/* live-chat.css */

/* Variables */
:root {
    --chat-primary: #1F2937;
    --chat-secondary: #3B82F6;
    --chat-bg: #F3F4F6;
    --chat-text: #111827;
    --chat-light: #FFFFFF;
    --chat-border: #E5E7EB;
    --chat-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* =========================================
   Frontend Chat Widget
   ========================================= */
#live-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.chat-launcher {
    width: 60px;
    height: 60px;
    background: var(--chat-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chat-light);
    cursor: pointer;
    box-shadow: var(--chat-shadow);
    transition: transform 0.3s ease;
}

.chat-launcher:hover {
    transform: scale(1.05);
}

.chat-launcher i {
    font-size: 30px;
    height: 30px;
    width: 30px;
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--chat-light);
    border-radius: 12px;
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform-origin: bottom right;
}

#live-chat-widget.chat-closed .chat-window {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

#live-chat-widget.chat-open .chat-window {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.chat-header {
    background: var(--chat-primary);
    color: var(--chat-light);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#close-chat {
    cursor: pointer;
}

.chat-body {
    flex: 1;
    background: var(--chat-bg);
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-msg {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-msg.system {
    align-self: center;
    background: #E5E7EB;
    color: #6B7280;
    font-size: 12px;
    border-radius: 10px;
    padding: 5px 10px;
}

.chat-msg.user {
    align-self: flex-end;
    background: var(--chat-secondary);
    color: var(--chat-light);
    border-bottom-right-radius: 5px;
}

.chat-msg.admin {
    align-self: flex-start;
    background: var(--chat-light);
    color: var(--chat-text);
    border: 1px solid var(--chat-border);
    border-bottom-left-radius: 5px;
}

.chat-footer {
    display: flex;
    padding: 15px;
    background: var(--chat-light);
    border-top: 1px solid var(--chat-border);
    gap: 10px;
}

.chat-footer input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.chat-footer input:focus {
    border-color: var(--chat-secondary);
}

.chat-footer button {
    background: var(--chat-secondary);
    color: var(--chat-light);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================
   Backend Admin Panel
   ========================================= */
.live-chat-admin-wrapper {
    margin-top: 20px;
}

.chat-admin-container {
    display: flex;
    height: 600px;
    background: #fff;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    margin-top: 20px;
}

.chat-list-panel {
    width: 300px;
    border-right: 1px solid #ccd0d4;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

.chat-list-panel h3 {
    padding: 15px;
    margin: 0;
    border-bottom: 1px solid #ccd0d4;
    background: #fff;
}

#admin-chat-list {
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

#admin-chat-list li {
    padding: 15px;
    border-bottom: 1px solid #eaeaea;
    cursor: pointer;
    transition: background 0.2s;
}

#admin-chat-list li:hover {
    background: #edf2f7;
}

#admin-chat-list li.active {
    background: #e2e8f0;
    border-left: 4px solid var(--chat-secondary);
}

.chat-list-item-uuid {
    font-weight: bold;
    font-size: 13px;
    color: #2271b1;
}

.chat-list-item-time {
    font-size: 11px;
    color: #646970;
    margin-top: 5px;
}

.chat-view-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

#admin-chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ccd0d4;
    font-weight: 600;
    font-size: 16px;
}

#admin-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#admin-chat-footer {
    padding: 15px 20px;
    border-top: 1px solid #ccd0d4;
    display: flex;
    gap: 10px;
    background: #fff;
}

#admin-chat-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
}

#admin-chat-send {
    padding: 0 20px;
    background: var(--chat-secondary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}
