/* ============================================================
   Challenge Circle — chat.css
   IconZ AI chat widget
   ============================================================ */

/* ── Trigger Button ──────────────────────────────────────── */
#chat-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--purple);
    border: none;
    border-radius: 16px;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(139,92,246,0.5);
    transition: transform 0.3s cubic-bezier(0.19,1,0.22,1),
                opacity  0.3s cubic-bezier(0.19,1,0.22,1),
                background 0.2s;
    font-size: 22px;
    font-weight: 900;
    font-style: italic;
    color: #fff;
    font-family: var(--font);
}
#chat-trigger:hover    { background: var(--purple-deep); transform: scale(1.1); }
#chat-trigger:active   { transform: scale(0.95); }
#chat-trigger.hidden-trigger {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

/* ── Chat Window ─────────────────────────────────────────── */
#iconz-chat {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 360px;
    height: 520px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(139,92,246,0.2);
    border-radius: 36px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    /* Closed state */
    transform: translateY(120%) scale(0.9);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.5s cubic-bezier(0.19,1,0.22,1),
                opacity  0.5s cubic-bezier(0.19,1,0.22,1);
}
#iconz-chat.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* ── Chat Header ─────────────────────────────────────────── */
.chat-header {
    padding: 18px 20px;
    background: linear-gradient(135deg, #6d28d9, #4c1d95);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.chat-header-identity { display: flex; align-items: center; gap: 14px; }
.chat-header-logo {
    width: 42px; height: 42px;
    background: #fff;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    flex-shrink: 0;
    font-size: 20px;
    font-weight: 900;
    font-style: italic;
    color: var(--purple-deep);
    font-family: var(--font);
}
.chat-header-name {
    font-size: 14px;
    font-weight: 900;
    color: #fff;
}
.chat-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}
.chat-status-dot {
    width: 6px; height: 6px;
    background: #34d399;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}
.chat-status-label {
    font-size: 10px;
    color: rgba(196,181,253,0.9);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.chat-header-actions { display: flex; gap: 8px; }
.chat-header-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    transition: color 0.2s;
    line-height: 1;
}
.chat-header-btn:hover { color: #fff; }

/* ── Messages Area ───────────────────────────────────────── */
#chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(139,92,246,0.3) transparent;
}

.chat-row-ai   { display: flex; gap: 10px; align-items: flex-end; }
.chat-row-user { display: flex; justify-content: flex-end; }

.chat-ai-avatar {
    width: 28px; height: 28px;
    background: var(--purple-deep);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
    font-weight: 900;
    color: #fff;
    flex-shrink: 0;
    font-style: italic;
    font-family: var(--font);
}
.chat-bubble-ai {
    background: rgba(139,92,246,0.1);
    border: 1px solid rgba(139,92,246,0.15);
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.6;
    color: #e2e8f0;
    max-width: 80%;
}
.chat-bubble-user {
    background: rgba(139,92,246,0.5);
    border-radius: 18px 18px 4px 18px;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.6;
    color: #fff;
    max-width: 80%;
}

/* Quick-reply chips */
.chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-left: 38px;
}
.chat-chip {
    background: rgba(139,92,246,0.1);
    border: 1px solid rgba(139,92,246,0.2);
    color: var(--purple-light);
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--font);
}
.chat-chip:hover { background: rgba(139,92,246,0.2); }
.chat-chip-gold {
    background: rgba(245,158,11,0.1);
    border-color: rgba(245,158,11,0.2);
    color: var(--gold);
}
.chat-chip-gold:hover { background: rgba(245,158,11,0.18); }

/* Typing indicator */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: rgba(139,92,246,0.1);
    border: 1px solid rgba(139,92,246,0.15);
    border-radius: 18px 18px 18px 4px;
}

/* ── Input Area ──────────────────────────────────────────── */
.chat-footer {
    padding: 14px 16px;
    background: rgba(0,0,0,0.5);
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.chat-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
#chat-input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 11px 18px;
    font-size: 13px;
    color: #fff;
    font-family: var(--font);
    transition: border-color 0.2s;
}
#chat-input:focus  { border-color: rgba(139,92,246,0.5); outline: none; }
#chat-input::placeholder { color: #6b7280; }
.chat-send-btn {
    width: 40px; height: 40px;
    background: var(--purple);
    border: none;
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}
.chat-send-btn:hover  { background: var(--purple-deep); }
.chat-send-btn:active { transform: scale(0.92); }

@media (max-width: 480px) {
    #iconz-chat { width: calc(100vw - 24px); right: 12px; bottom: 12px; }
    #chat-trigger {
        right: 14px;
        bottom: 14px;
        width: 46px;
        height: 46px;
        font-size: 18px;
        border-radius: 13px;
    }
}