/* ═══════════════════════════════════════════════════════════
   GLIX AI CHAT WIDGET
   Matches site palette: --ink #1D1D1F, --blue #22d3ee
════════════════════════════════════════════════════════════ */

/* ── Widget hidden until API key is configured ───────────── */
#glix-widget { display: none; }

/* ── Floating button ─────────────────────────────────────── */
#glix-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: #1D1D1F;
    box-shadow: 0 0 0 1px rgba(34,211,238,0.18), 0 8px 32px rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s ease;
    outline: none;
}

#glix-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 0 1px rgba(34,211,238,0.35), 0 12px 40px rgba(34,211,238,0.18);
}

#glix-btn.glix-btn--active {
    background: #22d3ee;
    box-shadow: 0 0 0 1px rgba(34,211,238,0.4), 0 8px 32px rgba(34,211,238,0.25);
}

/* icon swap */
#glix-btn .glix-icon-open,
#glix-btn .glix-icon-close { transition: opacity 0.2s, transform 0.2s; }
#glix-btn .glix-icon-close  { position: absolute; opacity: 0; transform: rotate(-90deg) scale(0.7); }
#glix-btn.glix-btn--active .glix-icon-open  { opacity: 0; transform: rotate(90deg) scale(0.7); }
#glix-btn.glix-btn--active .glix-icon-close { opacity: 1; transform: rotate(0) scale(1); }

#glix-btn .glix-icon-open svg { display: block; }
#glix-btn .glix-icon-close svg { display: block; }

/* pulse ring — page load attention */
#glix-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(34,211,238,0.5);
    opacity: 0;
    animation: glixPulse 2.4s ease-out 1.2s 3;
}

@keyframes glixPulse {
    0%   { opacity: 0.9; transform: scale(1); }
    100% { opacity: 0;   transform: scale(1.7); }
}

/* ── Greeting bubble ─────────────────────────────────────── */
#glix-bubble {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: 9998;
    background: #1D1D1F;
    border: 1px solid rgba(34,211,238,0.2);
    border-radius: 16px 16px 4px 16px;
    padding: 12px 16px;
    max-width: 240px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
    transform: translateY(10px) scale(0.92);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
}

#glix-bubble.glix-bubble--visible {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

#glix-bubble p {
    margin: 0;
    font-size: 0.825rem;
    line-height: 1.5;
    color: rgba(255,255,255,0.9);
    font-family: 'Inter', sans-serif;
}

#glix-bubble-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: color 0.2s;
}
#glix-bubble-close:hover { color: rgba(255,255,255,0.75); }

/* ── Chat panel ──────────────────────────────────────────── */
#glix-panel {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: 9998;
    width: 370px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #111113;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(34,211,238,0.07);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(16px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.28s ease;
}

#glix-panel.glix-panel--open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* ── Panel header ────────────────────────────────────────── */
.glix-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    flex-shrink: 0;
}

.glix-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0e3f4a 0%, #1D1D1F 100%);
    border: 1.5px solid rgba(34,211,238,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.glix-avatar svg { color: #22d3ee; }

.glix-header-text { flex: 1; min-width: 0; }
.glix-header-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    font-family: 'Inter', sans-serif;
    line-height: 1.2;
}
.glix-header-sub {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.4);
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
}
.glix-online-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(52,211,153,0.6);
}

#glix-close-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}
#glix-close-btn:hover {
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.06);
}

/* ── Messages area ───────────────────────────────────────── */
#glix-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

#glix-messages::-webkit-scrollbar { width: 4px; }
#glix-messages::-webkit-scrollbar-track { background: transparent; }
#glix-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* ── Message bubbles ─────────────────────────────────────── */
.glix-msg {
    display: flex;
    flex-direction: column;
    max-width: 86%;
    animation: glixMsgIn 0.28s cubic-bezier(0.34,1.56,0.64,1) both;
}

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

.glix-msg--ai   { align-self: flex-start; }
.glix-msg--user { align-self: flex-end; }

.glix-bubble-text {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.855rem;
    line-height: 1.6;
    font-family: 'Inter', sans-serif;
    word-break: break-word;
}

.glix-msg--ai .glix-bubble-text {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.88);
    border-bottom-left-radius: 4px;
}

.glix-msg--user .glix-bubble-text {
    background: rgba(34,211,238,0.12);
    border: 1px solid rgba(34,211,238,0.2);
    color: rgba(255,255,255,0.92);
    border-bottom-right-radius: 4px;
}

/* ── Typing indicator ────────────────────────────────────── */
.glix-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.glix-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(34,211,238,0.6);
    display: block;
    animation: glixBounce 1.2s ease-in-out infinite;
}
.glix-typing span:nth-child(2) { animation-delay: 0.18s; }
.glix-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes glixBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Warn / limit banner ─────────────────────────────────── */
.glix-warn-banner {
    margin: 0 14px;
    padding: 8px 12px;
    background: rgba(251,191,36,0.08);
    border: 1px solid rgba(251,191,36,0.2);
    border-radius: 10px;
    font-size: 0.775rem;
    color: rgba(251,191,36,0.9);
    font-family: 'Inter', sans-serif;
    text-align: center;
    flex-shrink: 0;
}

.glix-limit-state {
    margin: 0 14px;
    padding: 14px;
    background: rgba(34,211,238,0.06);
    border: 1px solid rgba(34,211,238,0.15);
    border-radius: 12px;
    text-align: center;
    flex-shrink: 0;
}
.glix-limit-state p {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    margin: 0 0 10px;
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
}
.glix-limit-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #22d3ee;
    color: #000;
    font-weight: 700;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    transition: opacity 0.2s;
}
.glix-limit-cta:hover { opacity: 0.88; color: #000; }

/* ── Input area ──────────────────────────────────────────── */
.glix-input-wrap {
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
    background: rgba(0,0,0,0.2);
}

#glix-input {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 9px 13px;
    font-size: 0.855rem;
    color: rgba(255,255,255,0.9);
    font-family: 'Inter', sans-serif;
    resize: none;
    outline: none;
    max-height: 100px;
    min-height: 40px;
    line-height: 1.45;
    transition: border-color 0.2s;
    scrollbar-width: none;
}
#glix-input::-webkit-scrollbar { display: none; }
#glix-input::placeholder { color: rgba(255,255,255,0.25); }
#glix-input:focus { border-color: rgba(34,211,238,0.35); }
#glix-input:disabled { opacity: 0.4; cursor: not-allowed; }

#glix-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: #22d3ee;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.15s;
    outline: none;
}
#glix-send:hover:not(:disabled) { opacity: 0.85; transform: scale(1.05); }
#glix-send:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* ── Mobile adjustments ──────────────────────────────────── */
@media (max-width: 480px) {
    #glix-btn    { bottom: 20px; right: 18px; }
    #glix-bubble { right: 18px; bottom: 90px; max-width: 220px; }
    #glix-panel  {
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 70vh;
        max-height: 70vh;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
    }
}
