/* ═══════════════════════════════════════════════════════════════
   ADSLADS Chat Widget
   ═══════════════════════════════════════════════════════════════ */

/* ── Bubble ────────────────────────────────────────────────────── */
.chat-bubble {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(26, 115, 232, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    z-index: 9998;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chat-bubble:hover           { transform: scale(1.08); box-shadow: 0 6px 22px rgba(26, 115, 232, 0.55); }
.chat-bubble--active         { background: linear-gradient(135deg, #0d47a1, #1a73e8); }
.chat-bubble-badge {
    position: absolute;
    top: 2px; right: 2px;
    width: 18px; height: 18px;
    background: #e53935;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}

/* ── Panel ─────────────────────────────────────────────────────── */
.chat-panel {
    position: fixed;
    bottom: 96px;
    right: 28px;
    width: 360px;
    max-height: 540px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
}
.chat-panel--open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── Header ────────────────────────────────────────────────────── */
.chat-header {
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chat-header-info          { display: flex; align-items: center; gap: 10px; }
.chat-header-icon          { font-size: 22px; opacity: 0.9; }
.chat-header-title         { font-weight: 600; font-size: 14px; line-height: 1.2; }
.chat-header-status        { font-size: 11px; opacity: 0.8; display: flex; align-items: center; gap: 4px; }
.status-dot {
    width: 7px; height: 7px;
    background: #4caf50;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%,100% { opacity: 1; } 50% { opacity: 0.4; }
}
.chat-header-actions       { display: flex; gap: 4px; }
.chat-icon-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.75);
    width: 28px; height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.chat-icon-btn:hover        { background: rgba(255,255,255,0.15); color: #fff; }

/* ── Messages ──────────────────────────────────────────────────── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f7f9fc;
    scroll-behavior: smooth;
}
.chat-msg                   { display: flex; flex-direction: column; max-width: 82%; }
.chat-msg--user             { align-self: flex-end; align-items: flex-end; }
.chat-msg--bot              { align-self: flex-start; align-items: flex-start; }

.chat-msg-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}
.chat-msg--user .chat-msg-bubble {
    background: #1a73e8;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg--bot .chat-msg-bubble {
    background: #fff;
    color: #222;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.chat-msg-time {
    font-size: 10.5px;
    color: #999;
    margin-top: 3px;
    padding: 0 4px;
}

/* ── Typing indicator ──────────────────────────────────────────── */
.chat-typing {
    display: flex; align-items: center; gap: 4px; padding: 10px 14px;
    min-width: 52px;
}
.chat-typing span {
    width: 7px; height: 7px;
    background: #bbb;
    border-radius: 50%;
    animation: typing-bounce 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
    0%,60%,100% { transform: translateY(0); }
    30%          { transform: translateY(-6px); }
}

/* ── System note ───────────────────────────────────────────────── */
.chat-system-note {
    align-self: center;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 20px;
    display: flex; align-items: center; gap: 5px;
}

/* ── Input area ────────────────────────────────────────────────── */
.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e8eaf0;
    background: #fff;
    flex-shrink: 0;
}
.chat-input {
    flex: 1;
    border: 1px solid #dde1ea;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13.5px;
    resize: none;
    outline: none;
    line-height: 1.45;
    transition: border-color 0.15s;
    font-family: inherit;
    max-height: 120px;
    overflow-y: auto;
}
.chat-input:focus           { border-color: #1a73e8; }
.chat-send-btn {
    width: 38px; height: 38px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
}
.chat-send-btn:hover        { background: #1558b0; transform: scale(1.05); }
.chat-send-btn:active       { transform: scale(0.96); }

/* ── Footer note ───────────────────────────────────────────────── */
.chat-footer-note {
    text-align: center;
    font-size: 11px;
    color: #aaa;
    padding: 4px 12px 8px;
    background: #fff;
    flex-shrink: 0;
}
.chat-footer-note a         { color: #1a73e8; text-decoration: none; }
.chat-footer-note a:hover   { text-decoration: underline; }

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 420px) {
    .chat-panel {
        right: 0; left: 0; bottom: 0;
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 70vh;
    }
    .chat-bubble { bottom: 16px; right: 16px; }
}
