/* ============================
   CHAT WIDGET (Block 4 — Live Demo)
   ============================ */
.chat-widget {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(108, 99, 255, 0.08);
    animation: borderGlow 4s ease-in-out infinite;
}

/* Header */
.chat-widget__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.chat-widget__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.chat-widget__info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.chat-widget__name {
    font-size: 14px;
    font-weight: 700;
}

.chat-widget__status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--accent-green);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: statusPulse 2s ease-in-out infinite;
}

.chat-widget__messages-left {
    padding: 4px 12px;
    background: rgba(108, 99, 255, 0.1);
    border: 1px solid rgba(108, 99, 255, 0.2);
    border-radius: 100px;
    font-size: 12px;
    color: var(--accent-purple);
    font-weight: 600;
    white-space: nowrap;
}

/* Body */
.chat-widget__body {
    min-height: 380px;
    max-height: 380px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.chat-widget__body::-webkit-scrollbar {
    width: 4px;
}

.chat-widget__body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-widget__body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Welcome screen */
.chat-widget__welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    min-height: 300px;
    gap: 24px;
}

.chat-widget__welcome p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.chat-widget__hints {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 360px;
}

.chat-hint {
    padding: 10px 16px;
    background: rgba(108, 99, 255, 0.08);
    border: 1px solid rgba(108, 99, 255, 0.2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.chat-hint:hover {
    background: rgba(108, 99, 255, 0.15);
    border-color: var(--accent-purple);
    color: var(--text-primary);
}

/* Messages */
.chat-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.55;
    animation: chatMsgIn 0.35s ease forwards;
    word-wrap: break-word;
}

@keyframes chatMsgIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-msg--user {
    align-self: flex-end;
    background: var(--accent-purple);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg--bot {
    align-self: flex-start;
    background: var(--bg-input);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    position: relative;
}

.chat-msg--bot .chat-msg__name {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-green);
    margin-bottom: 4px;
    display: block;
}

/* Typing indicator */
.chat-widget__typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.chat-widget__typing span {
    width: 6px;
    height: 6px;
    background: var(--accent-purple);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.chat-widget__typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-widget__typing span:nth-child(3) { animation-delay: 0.4s; }

/* Footer / Input */
.chat-widget__footer {
    border-top: 1px solid var(--border-color);
}

.chat-widget__form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
}

.chat-widget__input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color var(--transition-fast);
}

.chat-widget__input:focus {
    border-color: var(--accent-purple);
}

.chat-widget__input::placeholder {
    color: var(--text-muted);
}

.chat-widget__send {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    color: #fff;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.chat-widget__send:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.chat-widget__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Limit reached overlay */
.chat-widget__limit {
    text-align: center;
    padding: 24px;
}

.chat-widget__limit p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
