/* Chat Widget Styles */
.chat-widget-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(59,130,246,0.35);
    z-index: 9999;
    transition: transform 0.2s, box-shadow 0.2s;
}
.chat-widget-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(59,130,246,0.5);
}
.chat-widget-btn .chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

.chat-widget-popup {
    position: fixed;
    bottom: 92px;
    right: 20px;
    width: 360px;
    height: 500px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.chat-widget-popup.open {
    display: flex;
}

.chat-widget-popup .cw-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-widget-popup .cw-header .cw-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.8;
}
.chat-widget-popup .cw-header .cw-close:hover { opacity: 1; }

.chat-widget-popup .cw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-widget-popup .cw-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.5;
    word-break: break-word;
}
.chat-widget-popup .cw-msg.customer {
    align-self: flex-end;
    background: #3b82f6;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-widget-popup .cw-msg.admin {
    align-self: flex-start;
    background: #f1f5f9;
    color: #334155;
    border-bottom-left-radius: 4px;
}
.chat-widget-popup .cw-msg .cw-time {
    font-size: 0.6rem;
    opacity: 0.6;
    margin-top: 4px;
}
.chat-widget-popup .cw-msg .cw-read {
    font-size: 0.55rem;
    color: rgba(255,255,255,0.5);
    margin-top: 1px;
}
.chat-widget-popup .cw-msg .cw-read.read {
    color: #86efac;
    font-weight: 600;
}
.chat-widget-popup .cw-msg.admin.unread {
    background: #dbeafe;
    border-left: 3px solid #3b82f6;
}

.chat-widget-popup .cw-input-area {
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
}
.chat-widget-popup .cw-input-area input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.85rem;
    outline: none;
}
.chat-widget-popup .cw-input-area input:focus {
    border-color: #3b82f6;
}
.chat-widget-popup .cw-input-area button {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-widget-popup .cw-input-area button:hover { background: #2563eb; }

.chat-widget-popup .cw-login-msg {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #94a3b8;
    padding: 20px;
}
.chat-widget-popup .cw-login-msg a {
    color: #3b82f6;
    font-weight: 600;
}

/* Mobile */
@media (max-width: 768px) {
    .chat-widget-btn {
        bottom: 18px;
        right: 14px;
        width: 48px;
        height: 48px;
        font-size: 1.15rem;
    }
    .chat-widget-popup {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
}
