/* =============================================================================
   chat-widget.css - Floating HTML5 Chat Widget Styles
   ============================================================================= */

/* ---- FLOATING ACTION BUTTON ---- */
.rcw-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rcw-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.5);
}

.rcw-fab.active {
    transform: scale(0.9);
    opacity: 0.7;
}

.rcw-fab-icon {
    width: 24px;
    height: 24px;
}

.rcw-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    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;
    border: 2px solid white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---- CHAT PANEL ---- */
.rcw-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 380px;
    height: 540px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    animation: rcw-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes rcw-slide-up {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- HEADER ---- */
.rcw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-shrink: 0;
}

.rcw-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rcw-header-right {
    display: flex;
    gap: 4px;
}

.rcw-header-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.rcw-header-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.rcw-header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.rcw-connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: background 0.3s;
}

.rcw-connection-dot.connected {
    background: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.3);
}

.rcw-connection-dot.disconnected {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

/* ---- ONLINE BAR ---- */
.rcw-online-bar {
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.rcw-online-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.rcw-online-avatars {
    display: flex;
    gap: 6px;
    align-items: center;
    overflow-x: auto;
}

.rcw-online-avatar {
    position: relative;
    flex-shrink: 0;
}

.rcw-avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 600;
}

.rcw-avatar-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4ade80;
    border: 2px solid white;
}

.rcw-online-more {
    font-size: 12px;
    color: #667eea;
    font-weight: 600;
    padding-left: 4px;
}

/* ---- VIEWS ---- */
.rcw-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---- SEARCH ---- */
.rcw-search {
    padding: 12px 16px;
    flex-shrink: 0;
}

.rcw-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    background: #f8fafc;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.rcw-search input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ---- CONVERSATIONS LIST ---- */
.rcw-conversations {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
}

.rcw-conv-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s;
    gap: 12px;
}

.rcw-conv-item:hover {
    background: #f8fafc;
}

.rcw-conv-item.unread {
    background: #f0f7ff;
}

.rcw-conv-item.unread:hover {
    background: #e6f0ff;
}

.rcw-conv-avatar {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rcw-conv-content {
    flex: 1;
    min-width: 0;
}

.rcw-conv-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rcw-conv-preview {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.rcw-conv-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.rcw-conv-time {
    font-size: 11px;
    color: #94a3b8;
}

.rcw-conv-badge {
    background: #667eea;
    color: white;
    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;
}

.rcw-new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 12px 16px;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.rcw-new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ---- MESSAGES ---- */
.rcw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rcw-date-separator {
    text-align: center;
    padding: 8px 0;
}

.rcw-date-separator span {
    font-size: 11px;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 12px;
}

.rcw-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.rcw-msg-sent {
    align-self: flex-end;
}

.rcw-msg-received {
    align-self: flex-start;
}

.rcw-msg-system {
    align-self: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px 16px;
    max-width: 90%;
    text-align: center;
}

.rcw-msg-system .rcw-msg-body {
    font-size: 12px;
    color: #64748b;
}

.rcw-msg-system .rcw-msg-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
}

.rcw-msg-sender {
    font-size: 11px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 2px;
    padding-left: 4px;
}

.rcw-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
}

.rcw-msg-sent .rcw-msg-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.rcw-msg-received .rcw-msg-bubble {
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

.rcw-msg-body {
    font-size: 14px;
    line-height: 1.5;
}

.rcw-msg-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.rcw-msg-time {
    font-size: 10px;
    opacity: 0.7;
}

.rcw-msg-status {
    font-size: 12px;
    opacity: 0.8;
}

/* ---- TYPING INDICATOR ---- */
.rcw-typing {
    padding: 4px 16px;
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.rcw-typing-name {
    font-weight: 600;
    color: #667eea;
}

.rcw-typing-dots span {
    animation: rcw-blink 1.4s infinite both;
}

.rcw-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.rcw-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes rcw-blink {
    0%, 60%, 100% { opacity: 0.2; }
    30% { opacity: 1; }
}

/* ---- INPUT AREA ---- */
.rcw-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
    background: white;
}

.rcw-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.4;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.rcw-input-area textarea:focus {
    border-color: #667eea;
}

.rcw-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.rcw-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.rcw-send-btn:not(:disabled):hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ---- EMPTY STATE ---- */
.rcw-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #94a3b8;
    text-align: center;
    flex: 1;
}

.rcw-empty-state p {
    font-size: 14px;
    margin-top: 12px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 480px) {
    .rcw-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .rcw-fab {
        bottom: 16px;
        right: 16px;
    }
}

/* ---- SCROLLBAR ---- */
.rcw-messages::-webkit-scrollbar,
.rcw-conversations::-webkit-scrollbar {
    width: 4px;
}

.rcw-messages::-webkit-scrollbar-track,
.rcw-conversations::-webkit-scrollbar-track {
    background: transparent;
}

.rcw-messages::-webkit-scrollbar-thumb,
.rcw-conversations::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
