/* =============================================================
   Calik X · AI Assistant Widget Styles
   ============================================================= */

/* ── Floating toggle button ─────────────────────────────────── */
.cx-ai {
    position: fixed;
    bottom: 88px;
    right: 100px;
    z-index: 999980;
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', Futura, var(--cx-font, 'nbarchitekt'), sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cx-ai__toggle {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: rgba(11, 11, 14, 0.55);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: none;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: #fff;
    z-index: 0;
}

/* LED ring — static purple-blue conic-gradient, no animation */
.cx-ai__toggle::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(
        #0a1aff   0%,
        #3a0d8c  25%,
        #bf5af2  50%,
        #3a0d8c  75%,
        #0a1aff 100%
    );
    pointer-events: none;
    z-index: -1;
    opacity: 0.88;
}

/* Inner mask to keep button background clean */
.cx-ai__toggle::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: rgba(11, 11, 14, 0.9);
    pointer-events: none;
    z-index: -1;
}

@keyframes cxAiLedSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.cx-ai.is-open .cx-ai__toggle {
    box-shadow: 0 4px 28px rgba(10, 132, 255, 0.35), 0 4px 20px rgba(0, 0, 0, 0.5);
}
.cx-ai__toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 32px rgba(191, 90, 242, 0.45), 0 6px 24px rgba(0, 0, 0, 0.6);
}
.cx-ai__toggle svg {
    width: 22px;
    height: 22px;
    stroke: rgba(255, 255, 255, 0.8);
    position: absolute;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
/* default: AI icon visible, close icon hidden */
.cx-ai__toggle .cx-ai__close-ico {
    opacity: 0;
    transform: rotate(-90deg) scale(0.8);
}
.cx-ai.is-open .cx-ai__toggle > svg:not(.cx-ai__close-ico) {
    opacity: 0;
    transform: rotate(90deg) scale(0.8);
}
.cx-ai.is-open .cx-ai__toggle .cx-ai__close-ico {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.cx-ai__badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, rgba(10,132,255,0.30) 0%, rgba(191,90,242,0.30) 100%);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.14em;
    padding: 2.5px 6px;
    border-radius: 6px;
    pointer-events: none;
    line-height: 1;
    font-family: 'SF Pro Display', 'Inter', system-ui, sans-serif;
    text-shadow: 0 0 8px rgba(10,132,255,0.9), 0 0 14px rgba(191,90,242,0.6);
    box-shadow: 0 0 8px rgba(10,132,255,0.3), 0 0 16px rgba(191,90,242,0.2), inset 0 1px 0 rgba(255,255,255,0.15);
}

/* ── Greeting bubble ────────────────────────────────────────── */
.cx-ai__bubble {
    position: absolute;
    bottom: calc(100% + 14px);
    right: 0;
    width: 230px;
    background: rgba(8, 8, 14, 0.82);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 18px 18px 4px 18px;
    padding: 12px 15px 13px 14px;
    color: rgba(255,255,255,0.92);
    font-size: 13px;
    line-height: 1.55;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    transition: opacity 0.4s cubic-bezier(0.16,1,0.3,1), transform 0.4s cubic-bezier(0.16,1,0.3,1);
    white-space: normal;
    box-shadow: 0 8px 32px rgba(0,0,0,0.50), 0 0 0 0.5px rgba(255,255,255,0.04);
    z-index: 1;
}
.cx-ai__bubble.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
/* Tail arrow pointing down-right toward button */
.cx-ai__bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 20px;
    width: 13px;
    height: 13px;
    background: rgba(8, 8, 14, 0.82);
    border-right: 1px solid rgba(255,255,255,0.09);
    border-bottom: 1px solid rgba(255,255,255,0.09);
    transform: rotate(45deg);
    border-radius: 0 0 3px 0;
}

/* ── Chat panel ─────────────────────────────────────────────── */
.cx-ai__panel {
    position: absolute;
    bottom: calc(100% + 14px);
    right: 0;
    left: auto;
    transform: translateY(14px);
    width: 420px;
    max-width: calc(100vw - 28px);
    background: rgba(6, 6, 10, 0.48);
    backdrop-filter: blur(52px) saturate(220%) brightness(0.92);
    -webkit-backdrop-filter: blur(52px) saturate(220%) brightness(0.92);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 22px;
    box-shadow:
        0 36px 90px -24px rgba(0, 0, 0, 0.7),
        0 0 0 0.5px rgba(255,255,255,0.03),
        inset 0 1px 0 rgba(255,255,255,0.05);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.cx-ai.is-open .cx-ai__panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* ── Panel header ───────────────────────────────────────────── */
.cx-ai__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 15px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.cx-ai__head__av {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(10, 132, 255, 0.1);
    border: 1px solid rgba(10, 132, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cx-ai__head__av svg {
    width: 15px;
    height: 15px;
    stroke: #0a84ff;
}
.cx-ai__head__name {
    font-size: 12.5px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
}
.cx-ai__head__sub {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 1px;
    letter-spacing: 0.03em;
}
.cx-ai__head__close {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
.cx-ai__head__close svg { width: 14px; height: 14px; stroke: currentColor; }
.cx-ai__head__close:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* ── Messages ───────────────────────────────────────────────── */
.cx-ai__messages {
    max-height: 380px;
    overflow-y: auto;
    padding: 14px 14px 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.cx-ai__messages::-webkit-scrollbar { width: 3px; }
.cx-ai__messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.cx-ai__msg {
    max-width: 90%;
    padding: 10px 13px;
    border-radius: 16px;
    font-size: 12.5px;
    line-height: 1.68;
    color: rgba(244, 244, 244, 0.92);
    white-space: pre-wrap;
    word-break: break-word;
}
.cx-ai__msg--bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-bottom-left-radius: 4px;
}

/* ── Project preview image ───────────────────────────────────── */
.cx-ai__project-img {
    display: block;
    width: 100%;
    max-width: 340px;
    height: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    margin-bottom: 10px;
    object-fit: cover;
    opacity: 0;
    transform: translateY(6px);
    animation: cx-ai-img-in 0.35s ease forwards;
}
@keyframes cx-ai-img-in {
    to { opacity: 1; transform: translateY(0); }
}
.cx-ai__msg--user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(10,132,255,0.28), rgba(191,90,242,0.28));
    border: 1px solid rgba(10, 132, 255, 0.22);
    border-bottom-right-radius: 4px;
    color: #fff;
}

/* typing cursor */
.cx-ai__msg.is-typing::after {
    content: '';
    display: inline-block;
    width: 3px;
    height: 14px;
    background: rgba(10, 132, 255, 0.8);
    border-radius: 2px;
    animation: cx-ai-blink 0.85s ease-in-out infinite;
    margin-left: 3px;
    vertical-align: middle;
}
@keyframes cx-ai-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ── Input row ──────────────────────────────────────────────── */
.cx-ai__foot {
    display: flex;
    gap: 8px;
    padding: 11px 13px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(0, 0, 0, 0.08);
}
.cx-ai__input {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 11px;
    color: #f4f4f4;
    font-size: 12.5px;
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', Futura, sans-serif;
    padding: 9px 12px;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
    user-select: text !important;
    -webkit-user-select: text !important;
}
.cx-ai__input:focus { border-color: rgba(10, 132, 255, 0.5); background: rgba(255,255,255,0.07); }
.cx-ai__input::placeholder { color: rgba(255, 255, 255, 0.18); }
.cx-ai__send {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0a84ff, #bf5af2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.15s ease;
}
.cx-ai__send:hover { opacity: 0.82; transform: scale(1.07); }
.cx-ai__send svg { width: 14px; height: 14px; stroke: #fff; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    .cx-ai {
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }
    .cx-ai__panel { width: calc(100vw - 24px); max-height: 65vh; }
}

/* Touch: suppress default tap highlight on AI assistant widget */
#ai-assistant,
#ai-assistant * {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.cx-ai__messages { touch-action: pan-y; }
.cx-ai__input    { touch-action: manipulation; }

/* =============================================================
   Calik X · Scene Bridge — Back Button
   ============================================================= */

.cx-work-back-btn {
    position: fixed;
    top: 22px;
    left: 22px;
    z-index: 999970;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px 8px 11px;
    background: rgba(11, 11, 14, 0.72);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 50px;
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--cx-font, 'nbarchitekt', sans-serif);
    font-size: 12.5px;
    letter-spacing: 0.04em;
    cursor: pointer;
    opacity: 0;
    transform: translateX(-12px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease, color 0.2s ease;
}
.cx-work-back-btn.is-visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}
.cx-work-back-btn:hover {
    background: rgba(22, 22, 28, 0.92);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.18);
}
.cx-work-back-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    flex-shrink: 0;
}

/* ==============================================
   Calik X · Sidebar Hint Arrow (LED breathing)
   Sits right next to the top-left ☰ button.
   Blinking left-pointing arrow → ← ☰
   ============================================== */
.cx-sidebar-hint {
    position: fixed;
    top: 13px;          /* same height as the ☰ button */
    left: 50px;         /* just to the right of the ~40px hamburger */
    z-index: 9500;
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.cx-sidebar-hint--out {
    opacity: 0 !important;
    transform: translateX(-10px) !important;
}

/* glowing left-pointing arrow circle */
.cx-sidebar-hint__arrow {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: rgba(10,132,255,0.12);
    border: 1.5px solid rgba(10,132,255,0.5);
    display: flex; align-items: center; justify-content: center;
    animation: cxSidebarLed 1.6s ease-in-out infinite;
    color: #0a84ff;
    flex-shrink: 0;
}
/* arrow SVG bounces toward the ☰ (left) */
.cx-sidebar-hint__arrow svg {
    width: 15px; height: 15px;
    animation: cxSidebarBounce 1.6s ease-in-out infinite;
}
@keyframes cxSidebarLed {
    0%,100% {
        box-shadow: 0 0 5px rgba(10,132,255,0.4), 0 0 12px rgba(10,132,255,0.15);
        border-color: rgba(10,132,255,0.5);
        background: rgba(10,132,255,0.10);
    }
    50% {
        box-shadow: 0 0 14px rgba(10,132,255,0.8), 0 0 28px rgba(10,132,255,0.35);
        border-color: rgba(10,132,255,1);
        background: rgba(10,132,255,0.22);
    }
}
/* bounce LEFT toward the hamburger */
@keyframes cxSidebarBounce {
    0%,100% { transform: translateX(0); }
    50%      { transform: translateX(-4px); }
}

.cx-sidebar-hint__label {
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(10,132,255,0.65);
    white-space: nowrap;
}
