/* ============================================
   ADMIN LIVE CHAT DASHBOARD
   ============================================ */

.lc-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    min-height: 500px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

/* ---- Top Bar ---- */
.lc-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}
.lc-topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.lc-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.lc-filter-tabs {
    display: flex;
    gap: 4px;
    background: #e2e8f0;
    border-radius: 8px;
    padding: 3px;
}
.lc-filter-tab {
    padding: 6px 16px;
    border-radius: 6px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.lc-filter-tab.active {
    background: #fff;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.lc-badge-danger {
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Status Toggle */
.lc-status-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.lc-status-toggle.online {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}
.lc-status-toggle.offline {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #6b7280;
}
.lc-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.lc-status-dot.online { background: #22c55e; }
.lc-status-dot.offline { background: #9ca3af; }

/* ---- Body Layout ---- */
.lc-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ---- Sidebar (Conversations List) ---- */
.lc-sidebar {
    width: 320px;
    min-width: 280px;
    border-right: 1px solid #e2e8f0;
    overflow-y: auto;
    background: #fff;
}
.lc-sidebar::-webkit-scrollbar {
    width: 4px;
}
.lc-sidebar::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 4px;
}
.lc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

/* Conversation Item */
.lc-conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
    position: relative;
}
.lc-conv-item:hover {
    background: #f8fafc;
}
.lc-conv-item.active {
    background: #eff6ff;
    border-left: 3px solid #2563eb;
}
.lc-conv-item.has-unread {
    background: #fefce8;
}
.lc-conv-item.active.has-unread {
    background: #eff6ff;
}
.lc-conv-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    flex-shrink: 0;
}
.lc-conv-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.lc-conv-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.lc-conv-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lc-conv-time {
    font-size: 11px;
    color: #94a3b8;
    flex-shrink: 0;
}
.lc-conv-company {
    font-size: 11px;
    color: #64748b;
}
.lc-conv-preview {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lc-conv-unread-badge {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* ---- Chat Area ---- */
.lc-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.lc-no-selection {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

/* Chat Header */
.lc-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}
.lc-chat-header-name {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}
.lc-chat-header-company {
    font-weight: 400;
    color: #64748b;
    font-size: 13px;
}
.lc-chat-header-meta {
    display: flex;
    align-items: center;
    margin-top: 2px;
}
.lc-chat-header-actions {
    display: flex;
    gap: 8px;
}
.lc-btn-close-conv, .lc-btn-reopen-conv {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
    color: #64748b;
}
.lc-btn-close-conv:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}
.lc-btn-reopen-conv:hover {
    background: #f0fdf4;
    border-color: #86efac;
    color: #16a34a;
}

/* Status pill */
.lc-status-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.lc-status-pill.active { background: #dcfce7; color: #166534; }
.lc-status-pill.waiting { background: #fef9c3; color: #854d0e; }
.lc-status-pill.closed { background: #f1f5f9; color: #64748b; }

/* Messages */
.lc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lc-messages::-webkit-scrollbar { width: 5px; }
.lc-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.lc-date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}
.lc-date-divider span {
    font-size: 11px;
    color: #94a3b8;
    background: #e2e8f0;
    padding: 2px 12px;
    border-radius: 10px;
}

.lc-msg {
    max-width: 70%;
    display: flex;
    flex-direction: column;
}
.lc-msg-sent {
    align-self: flex-end;
    align-items: flex-end;
}
.lc-msg-received {
    align-self: flex-start;
    align-items: flex-start;
}
.lc-msg-sender {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 2px;
    padding: 0 6px;
}
.lc-msg-bubble {
    padding: 8px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
    width: fit-content;
    max-width: 100%;
}
.lc-msg-sent .lc-msg-bubble {
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.lc-msg-received .lc-msg-bubble {
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}
.lc-msg-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 2px;
    padding: 0 6px;
}

/* Reply Area */
.lc-reply-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}
.lc-reply-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 10px 18px;
    font-size: 14px;
    outline: none;
    background: #f8fafc;
    transition: border-color 0.15s;
}
.lc-reply-input:focus {
    border-color: #93c5fd;
    background: #fff;
}
.lc-reply-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.lc-reply-btn:hover { background: #1d4ed8; }

/* ---- Customer Panel ---- */
.lc-customer-panel {
    width: 260px;
    min-width: 220px;
    border-left: 1px solid #e2e8f0;
    overflow-y: auto;
    background: #f8fafc;
}
.lc-customer-header {
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
}
.lc-customer-details {
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.lc-customer-avatar-large {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 10px;
}
.lc-customer-name {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
}
.lc-customer-company {
    font-size: 13px;
    color: #64748b;
    text-align: center;
    margin-bottom: 16px;
}
.lc-customer-fields {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}
.lc-customer-field {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.lc-field-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.lc-field-value {
    font-size: 13px;
    color: #1e293b;
    word-break: break-all;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .lc-customer-panel {
        display: none;
    }
}
@media (max-width: 768px) {
    .lc-sidebar {
        width: 240px;
        min-width: 200px;
    }
}
