/* ============================================================
   Live Chat Pro — Frontend Widget Styles
   ============================================================ */

#lcp-widget-root {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
#lcp-widget-root.lcp-pos-left { left: 20px; right: auto; }

/* Unread Badge */
#lcp-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 6px rgba(239,68,68,.4);
    z-index: 10;
    animation: lcpPulse 2s infinite;
}
@keyframes lcpPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.12)} }

/* Trigger Button */
#lcp-trigger {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--lcp-color), var(--lcp-color-dark-30));
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
    transition: all .25s;
    position: relative;
    z-index: 2;
}
#lcp-trigger:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0,0,0,.25); }
#lcp-trigger:active { transform: scale(.95); }

/* Window */
#lcp-window {
    display: none;
    flex-direction: column;
    width: 370px;
    height: 530px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0,0,0,.15);
    position: absolute;
    bottom: 72px;
    right: 0;
    animation: lcpSlideUp .3s cubic-bezier(.16,1,.3,1);
}
.lcp-pos-left #lcp-window { right: auto; left: 0; }
@keyframes lcpSlideUp { from{opacity:0;transform:translateY(20px) scale(.96)} to{opacity:1;transform:translateY(0) scale(1)} }

/* Header */
#lcp-hdr {
    background: linear-gradient(135deg, var(--lcp-color), var(--lcp-color-dark-30));
    padding: 16px 18px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
#lcp-hdr-left { display: flex; align-items: center; gap: 12px; }
#lcp-hdr-avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
#lcp-hdr-title { font-size: 15px; font-weight: 700; }
#lcp-hdr-status { font-size: 12px; opacity: .85; display: flex; align-items: center; gap: 5px; margin-top: 1px; }
#lcp-status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
#lcp-status-dot.online { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,.5); }
#lcp-status-dot.offline { background: #f87171; }
#lcp-hdr-close { background: rgba(255,255,255,.15); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; }
#lcp-hdr-close:hover { background: rgba(255,255,255,.3); }

/* Body Container */
#lcp-body { flex: 1; position: relative; overflow: hidden; background: #f8fafc; min-height: 0; }

/* Start Screen */
#lcp-start-screen { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; background: #fff; text-align: center; }
#lcp-start-avatar { width: 72px; height: 72px; border-radius: 50%; background: rgba(var(--lcp-rgb), .1); display: flex; align-items: center; justify-content: center; color: var(--lcp-color); margin-bottom: 16px; flex-shrink: 0; }
#lcp-start-name { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: #1e293b; }
#lcp-start-desc { margin: 0 0 20px; font-size: 13px; color: #94a3b8; line-height: 1.5; }
#lcp-name-input { width: 100%; padding: 12px 16px; border: 2px solid #e2e8f0; border-radius: 12px; font-size: 14px; outline: none; transition: border-color .2s, box-shadow .2s; box-sizing: border-box; }
#lcp-name-input:focus { border-color: var(--lcp-color); box-shadow: 0 0 0 3px rgba(var(--lcp-rgb), .13); }
#lcp-start-btn { width: 100%; padding: 13px; background: linear-gradient(135deg, var(--lcp-color), var(--lcp-color-dark-20)); color: #fff; border: none; border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 10px; transition: all .2s; box-shadow: 0 4px 14px rgba(var(--lcp-rgb), .2); box-sizing: border-box; }
#lcp-start-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(var(--lcp-rgb), .3); }
#lcp-start-btn:active { transform: translateY(0); }
#lcp-start-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
#lcp-start-error { display: none; color: #ef4444; font-size: 12px; margin-top: 8px; }

/* Chat Log */
#lcp-chat-log { position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }

/* Overlay Screens */
#lcp-offline-screen,
#lcp-banned-screen,
#lcp-rating-screen { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; background: #fff; }
.lcp-screen-icon { margin-bottom: 12px; }
.lcp-screen-text { font-size: 14px; color: #64748b; text-align: center; line-height: 1.6; }
.lcp-text-banned { color: #ef4444; font-weight: 600; }

/* Rating Screen */
.lcp-rating-title { font-size: 14px; font-weight: 600; color: #1e293b; margin-bottom: 12px; }
#lcp-stars { display: flex; gap: 6px; font-size: 32px; }
#lcp-stars span { cursor: pointer; color: #e2e8f0; transition: color .1s; }
#lcp-stars span.active { color: #f59e0b; }
#lcp-feedback-input { width: 100%; padding: 10px; border: 1px solid #e2e8f0; border-radius: 8px; margin-top: 12px; resize: none; font-size: 13px; box-sizing: border-box; }
#lcp-rate-btn { margin-top: 10px; padding: 10px 24px; background: var(--lcp-color); color: #fff; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; width: 100%; box-sizing: border-box; transition: opacity .15s; }
#lcp-rate-btn:hover { opacity: .9; }

/* Typing Indicator — opacity trick, no layout shift */
#lcp-typing {
    padding: 2px 18px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 12px;
    background: #fff;
    flex-shrink: 0;
    height: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
#lcp-typing.visible { opacity: 1; pointer-events: auto; }
#lcp-typing-dots { display: flex; gap: 3px; }
#lcp-typing-dots span { width: 5px; height: 5px; border-radius: 50%; background: #94a3b8; animation: lcpBounce 1.2s infinite; }
#lcp-typing-dots span:nth-child(2) { animation-delay: .2s; }
#lcp-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes lcpBounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-5px)} }

/* Footer */
#lcp-footer { padding: 12px 14px; background: #fff; border-top: 1px solid #f1f5f9; display: flex; align-items: center; gap: 8px; position: relative; flex-shrink: 0; }
#lcp-emoji-btn { background: none; border: none; font-size: 22px; cursor: pointer; padding: 2px; border-radius: 6px; transition: background .15s; line-height: 1; }
#lcp-emoji-btn:hover { background: #f1f5f9; }
#lcp-emoji-picker { position: absolute; bottom: 56px; left: 14px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.12); display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; z-index: 100; width: 300px; max-height: 200px; overflow-y: auto; }
#lcp-emoji-picker span { font-size: 20px; padding: 4px; cursor: pointer; border-radius: 6px; text-align: center; transition: background .1s; }
#lcp-emoji-picker span:hover { background: #f1f5f9; }
#lcp-msg-input { flex: 1; padding: 10px 16px; border: 1px solid #e2e8f0; border-radius: 24px; font-size: 14px; outline: none; background: #f8fafc; transition: all .2s; min-width: 0; }
#lcp-msg-input:focus { border-color: var(--lcp-color); background: #fff; box-shadow: 0 0 0 2px rgba(var(--lcp-rgb), .1); }
#lcp-msg-input:disabled { opacity: .5; cursor: not-allowed; }
#lcp-send-btn { width: 42px; height: 42px; border-radius: 50%; border: none; background: linear-gradient(135deg, var(--lcp-color), var(--lcp-color-dark-20)); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .2s; flex-shrink: 0; }
#lcp-send-btn:hover:not(:disabled) { transform: scale(1.05); box-shadow: 0 4px 12px rgba(var(--lcp-rgb), .2); }
#lcp-send-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* Message Bubbles */
.msg-row { display: flex; flex-direction: column; max-width: 80%; }
.msg-row.msg-new { animation: lcpMsgIn .2s ease-out; }
@keyframes lcpMsgIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.msg-row.visitor { align-self: flex-end; align-items: flex-end; }
.msg-row.admin { align-self: flex-start; align-items: flex-start; }
.msg-bubble { padding: 10px 14px; font-size: 14px; line-height: 1.55; word-wrap: break-word; }
.msg-row.visitor .msg-bubble { background: linear-gradient(135deg, var(--lcp-color), var(--lcp-color-dark-15)); color: #fff; border-radius: 16px 16px 4px 16px; box-shadow: 0 2px 8px rgba(var(--lcp-rgb), .13); }
.msg-row.admin .msg-bubble { background: #fff; color: #1e293b; border-radius: 16px 16px 16px 4px; box-shadow: 0 1px 4px rgba(0,0,0,.06); border: 1px solid #f1f5f9; }
.msg-time { font-size: 10px; color: #94a3b8; margin-top: 3px; padding: 0 4px; }
.msg-row.visitor .msg-time { text-align: right; }
.lcp-date-sep { text-align: center; font-size: 11px; color: #94a3b8; padding: 6px 0; }
.lcp-date-sep span { background: #e2e8f0; padding: 3px 12px; border-radius: 8px; font-weight: 500; }

/* Scrollbar */
#lcp-chat-log::-webkit-scrollbar { width: 4px; }
#lcp-chat-log::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
#lcp-chat-log::-webkit-scrollbar-track { background: transparent; }

/* Responsive */
@media (max-width: 480px) {
    #lcp-widget-root { bottom: 10px; right: 10px; }
    #lcp-widget-root.lcp-pos-left { left: 10px; right: auto; }
    #lcp-window { width: calc(100vw - 20px); height: calc(100vh - 100px); bottom: 68px; border-radius: 12px; }
    #lcp-trigger { width: 52px; height: 52px; }
}