/* ==========================================================================
   CICI AI ASSISTANT — MODERN CHATBOT WIDGET STYLESHEET
   Matches User Mockup with 3D Winking Robot & Real-time Backend Pipeline
   ========================================================================== */

/* 1. FLOATING STACK (SCROLL-TOP & FLOATING ACTION BUTTONS) */
.floating-scroll-top {
    position: fixed;
    bottom: 26px;
    left: 26px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #340438;
    color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 8px 24px rgba(52, 4, 56, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 990;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.9);
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.floating-scroll-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.floating-scroll-top:hover {
    background: #520b58;
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 12px 28px rgba(52, 4, 56, 0.45);
    color: #ffffff !important;
}

.floating-scroll-top:active {
    transform: translateY(0) scale(0.96);
}

.floating-right-stack {
    position: fixed;
    bottom: 26px;
    right: 26px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
    z-index: 995;
}

.floating-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 48px;
    padding: 0 18px 0 14px;
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    outline: none;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    position: relative;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    box-sizing: border-box;
}

/* WhatsApp Floating Button */
.floating-wa-btn {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #ffffff !important;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.38);
}

.floating-wa-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(37, 211, 102, 0.5);
    color: #ffffff !important;
}

.floating-btn-pulse {
    position: absolute;
    inset: -3px;
    border-radius: 999px;
    border: 2px solid #25D366;
    animation: waPulseRing 2.4s cubic-bezier(0.25, 0, 0, 1) infinite;
    pointer-events: none;
}

@keyframes waPulseRing {
    0% { transform: scale(0.96); opacity: 0.8; }
    70% { transform: scale(1.12); opacity: 0; }
    100% { transform: scale(1.12); opacity: 0; }
}

.floating-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.floating-btn-label {
    letter-spacing: 0.01em;
    font-size: 0.88rem;
    white-space: nowrap;
}

/* AI Chatbot Floating Button */
.floating-ai-btn {
    background: linear-gradient(135deg, #702652 0%, #340438 100%);
    color: #ffffff !important;
    box-shadow: 0 8px 24px rgba(52, 4, 56, 0.38);
    position: relative;
    overflow: hidden;
    border: 1.5px solid rgba(254, 205, 232, 0.45);
}

.floating-ai-btn:hover,
.floating-ai-btn.active {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(112, 38, 82, 0.52);
    background: linear-gradient(135deg, #8a2f64 0%, #430648 100%);
    color: #ffffff !important;
}

.floating-ai-avatar-thumb {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #250328;
    border: 1.5px solid #fbcfe8;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.floating-ai-avatar-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.15);
}

.floating-online-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    margin-left: 2px;
}

/* Customer Portal Layout Overrides (Prevent Colliding with 5-Tab Bottom Navigation) */
.customer-layout .floating-scroll-top {
    display: none !important;
}

.customer-layout .floating-right-stack {
    bottom: 86px !important; /* Floats safely above the 72px bottom navigation */
    right: 16px;
    z-index: 998;
}

/* Sembunyikan otomatis tombol floating jika ada wizard action bar (tombol 'Lanjutkan') */
body:has(.wizard-floating-action-bar) .floating-right-stack,
body:has(.wizard-floating-action-bar) .floating-scroll-top {
    display: none !important;
}

@media (min-width: 481px) {
    .customer-layout .floating-right-stack {
        right: calc(50% - 240px + 16px);
    }
}

@media (max-width: 480px) {
    .floating-scroll-top {
        bottom: 18px;
        left: 16px;
        width: 44px;
        height: 44px;
    }
    .floating-right-stack {
        bottom: 18px;
        right: 16px;
        gap: 10px;
    }
    .customer-layout .floating-right-stack {
        bottom: 84px !important;
        right: 12px;
        gap: 8px;
    }
    .floating-action-btn {
        height: 42px;
        padding: 0 14px 0 10px;
        font-size: 0.82rem;
        gap: 8px;
    }
    .floating-ai-avatar-thumb {
        width: 30px;
        height: 30px;
    }
}

/* 2. CHAT MODAL CONTAINER */
.ai-chat-widget {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 440px;
    max-width: calc(100vw - 32px);
    height: 680px;
    max-height: calc(100vh - 110px);
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 24px 70px rgba(45, 7, 47, 0.35), 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1.5px solid rgba(236, 210, 226, 0.7);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(24px) scale(0.95);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s ease, height 0.3s ease;
}

.ai-chat-widget.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Fullscreen / Maximized Mode */
.ai-chat-widget.fullscreen {
    top: 20px !important;
    bottom: 20px !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: min(920px, calc(100vw - 32px)) !important;
    height: calc(100vh - 40px) !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 28px !important;
    box-shadow: 0 35px 110px rgba(45, 7, 47, 0.55) !important;
    z-index: 99999 !important;
}

@media (max-width: 640px) {
    .ai-chat-widget {
        bottom: 84px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        height: calc(100vh - 100px);
        border-radius: 24px;
    }

    .ai-chat-widget.fullscreen {
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        width: 100vw !important;
        height: 100vh !important;
        border-radius: 0 !important;
    }
}

/* 3. GLOSSY PURPLE HEADER (MATCHING MOCKUP) */
.ai-chat-header {
    position: relative;
    background: linear-gradient(135deg, #240428 0%, #3a083d 35%, #59105b 75%, #420645 100%);
    padding: 1rem 1.25rem 1.25rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Glossy glow streak background */
.ai-chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 150%;
    background: radial-gradient(circle, rgba(232, 121, 203, 0.22) 0%, rgba(88, 16, 92, 0) 70%);
    pointer-events: none;
}

.ai-header-decor-curves {
    position: absolute;
    inset: 0;
    opacity: 0.15;
    background-image: radial-gradient(#fff 1px, transparent 1px);
    background-size: 16px 16px;
    pointer-events: none;
}

/* Translucent shopping bag with C logo in header background */
.ai-header-shop-bag {
    position: absolute;
    right: 90px;
    top: 10px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    pointer-events: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.ai-header-shop-bag svg {
    color: #fbcfe8;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.ai-header-info {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    z-index: 2;
}

/* 3D Robot Container with "Halo!" speech bubble */
.ai-header-robot-wrapper {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.ai-header-robot-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
    transition: transform 0.3s ease;
}

.ai-header-robot-wrapper:hover .ai-header-robot-img {
    transform: scale(1.08) rotate(-2deg);
}

/* Speech bubble "Halo!" above robot */
.ai-speech-bubble-halo {
    position: absolute;
    top: -12px;
    left: -4px;
    background: #ffffff;
    color: #3b083d;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
    animation: bubbleFloat 3s infinite ease-in-out;
    border: 1px solid #fbcfe8;
    z-index: 3;
}

.ai-speech-bubble-halo::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 14px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #ffffff;
}

@keyframes bubbleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.ai-title-column {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ai-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-bot-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.ai-pill-demo {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 9999px;
    background: #e11d48;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.4);
}

.ai-header-status-line {
    font-size: 0.76rem;
    color: #fbcfe8;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
}

.ai-status-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    display: inline-block;
}

.ai-header-actions {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    z-index: 3;
}

/* Translucent glass circular action buttons */
.ai-btn-glass {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: all 0.2s ease;
    outline: none;
}

.ai-btn-glass:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.06);
    border-color: rgba(255, 255, 255, 0.45);
}

@media (max-width: 480px) {
    .ai-chat-header {
        gap: 0.45rem;
        padding: 0.8rem 0.8rem 0.9rem;
    }

    .ai-header-info {
        flex: 1 1 auto;
        min-width: 0;
        gap: 0.55rem;
    }

    .ai-header-robot-wrapper {
        width: 48px;
        height: 48px;
    }

    .ai-speech-bubble-halo {
        top: -8px;
        left: -2px;
        padding: 1px 6px;
        font-size: 0.62rem;
    }

    .ai-title-column {
        flex: 1 1 auto;
        min-width: 0;
    }

    .ai-bot-name {
        font-size: 0.9rem;
    }

    .ai-header-status-line {
        gap: 0.3rem;
        font-size: 0.65rem;
        line-height: 1.2;
    }

    .ai-header-actions {
        flex: 0 0 auto;
        gap: 0.25rem;
    }

    .ai-btn-glass {
        width: 30px;
        height: 30px;
        flex: 0 0 30px;
    }
}

@media (max-width: 360px) {
    .ai-chat-header {
        gap: 0.3rem;
        padding: 0.7rem 0.65rem 0.8rem;
    }

    .ai-header-info {
        gap: 0.4rem;
    }

    .ai-header-robot-wrapper {
        width: 42px;
        height: 42px;
    }

    .ai-bot-name {
        font-size: 0.84rem;
    }

    .ai-header-status-line {
        font-size: 0.6rem;
    }

    .ai-header-actions {
        gap: 0.15rem;
    }

    .ai-btn-glass {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
    }
}

/* 4. CHAT BODY */
.ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.15rem;
    background: linear-gradient(180deg, #fdf6fa 0%, #ffffff 100%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.ai-date-pill-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0.25rem 0 0.5rem;
}

.ai-date-pill-wrap::before {
    content: '';
    position: absolute;
    left: 10%;
    right: 10%;
    top: 50%;
    height: 1px;
    background: #eedbe6;
    z-index: 1;
}

.ai-date-pill {
    position: relative;
    z-index: 2;
    background: #fdf2f8;
    border: 1px solid #f5d0e5;
    color: #8b5cf6;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 3px 14px;
    border-radius: 9999px;
}

/* Message groups */
.ai-msg-group {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    max-width: 90%;
    animation: msgFadeIn 0.25s ease forwards;
    flex-shrink: 0;
}

@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-msg-group.bot {
    align-self: flex-start;
    scroll-margin-top: 14px;
    scroll-margin-bottom: 24px;
}

.ai-msg-group.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* Circular robot avatar for messages */
.ai-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #3b083d;
    border: 1.5px solid #fbcfe8;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(59, 8, 61, 0.15);
}

.ai-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.15);
}

.ai-bubble {
    padding: 0.85rem 1.05rem;
    border-radius: 20px;
    font-size: 0.85rem;
    line-height: 1.5;
    position: relative;
}

.ai-msg-group.bot .ai-bubble {
    background: #ffffff;
    color: #2b0b2e;
    border: 1px solid #edd5e4;
    border-top-left-radius: 6px;
    box-shadow: 0 4px 14px rgba(52, 4, 56, 0.05);
}

.ai-bubble .ai-markdown-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    margin: 0.12rem 0.08rem;
    padding: 0.24rem 0.62rem;
    vertical-align: middle;
    border: 1px solid #e8cddd;
    border-radius: 999px;
    background: linear-gradient(135deg, #fff7fb 0%, #f8eaf3 100%);
    color: #753f68 !important;
    font-size: 0.92em;
    font-weight: 700;
    line-height: 1.35;
    text-decoration: none;
    box-shadow: 0 2px 7px rgba(112, 38, 82, 0.08);
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.ai-bubble .ai-markdown-link > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.ai-bubble .ai-markdown-link > svg {
    display: block;
    flex: 0 0 11px;
    width: 11px;
    height: 11px;
}

.ai-bubble .ai-markdown-link:hover {
    background: #f4e1ed;
    border-color: #d8b6cb;
    box-shadow: 0 4px 10px rgba(112, 38, 82, 0.13);
    transform: translateY(-1px);
}

.ai-bubble .ai-markdown-link:focus-visible {
    outline: 2px solid #a86c98;
    outline-offset: 2px;
}

.ai-msg-group.user .ai-bubble {
    background: linear-gradient(135deg, #702652 0%, #340438 100%);
    color: #ffffff;
    border-top-right-radius: 6px;
    box-shadow: 0 6px 16px rgba(52, 4, 56, 0.2);
}

/* 5. POPULAR QUESTIONS CARDS (MATCHING MOCKUP) */
.ai-suggestions-wrap {
    margin-top: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.ai-suggestions-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.74rem;
    font-weight: 800;
    color: #a855f7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.1rem;
    margin-left: 2px;
}

.ai-suggestion-card-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1.5px solid #f0d5e5;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(52, 4, 56, 0.03);
    text-align: left;
    outline: none;
    width: 100%;
}

.ai-suggestion-card-btn:hover {
    background: #fdf5fa;
    border-color: #c026d3;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(192, 38, 211, 0.12);
}

.ai-suggestion-card-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.ai-suggestion-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #fdf2f8;
    border: 1px solid #fbcfe8;
    color: #be185d;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-suggestion-card-text {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2b0b2e;
}

.ai-suggestion-card-chevron {
    color: #a855f7;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.ai-suggestion-card-btn:hover .ai-suggestion-card-chevron {
    transform: translateX(3px);
    color: #c026d3;
}

/* ==========================================================================
   6. REAL-TIME MULTI-STEP PIPELINE CARD (MATCHING SCREENSHOT 2)
   ========================================================================== */
.ai-pipeline-card {
    background: #ffffff;
    border: 1.5px solid #edd5e4;
    border-radius: 20px;
    padding: 0.85rem 0.85rem 0.75rem;
    margin: 0.5rem 0 1.25rem;
    box-shadow: 0 4px 18px rgba(52, 4, 56, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    animation: pipelineFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    scroll-margin-bottom: 28px;
}

@keyframes pipelineFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header hint for horizontal scroll */
.ai-pipeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.2rem;
}

.ai-pipeline-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #702652;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ai-pipeline-scroll-hint {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #9333ea;
    font-size: 0.66rem;
    font-weight: 600;
    background: #fdf2f8;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid #fbcfe8;
    user-select: none;
}

/* Steps container: Horizontal Scroll (Bisa di-scroll ke samping) */
.ai-pipeline-steps {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 4px 10px 4px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: #d8b4fe rgba(253, 242, 248, 0.8);
}

/* Custom sleek horizontal scrollbar */
.ai-pipeline-steps::-webkit-scrollbar {
    height: 5px;
}

.ai-pipeline-steps::-webkit-scrollbar-track {
    background: #fdf2f8;
    border-radius: 999px;
}

.ai-pipeline-steps::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #d8b4fe, #c026d3);
    border-radius: 999px;
}

.ai-pipeline-steps::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #c084fc, #9333ea);
}

/* Step item: Fixed width to prevent squishing when scrolling */
.ai-step-item {
    flex: 0 0 auto;
    width: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    scroll-snap-align: center;
}

.ai-step-card {
    position: relative;
    width: 100%;
    background: #ffffff;
    border: 1.5px solid #e9d5e2;
    border-radius: 14px;
    padding: 0.65rem 0.35rem 0.55rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.25s ease;
    box-sizing: border-box;
}

/* Active / Running Step Card */
.ai-step-item.active .ai-step-card {
    background: #faf5ff;
    border-color: #c084fc;
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.2);
    transform: translateY(-2px);
}

/* Completed Step Card */
.ai-step-item.completed .ai-step-card {
    background: #f0fdf4;
    border-color: #86efac;
}

.ai-step-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a855f7;
}

.ai-step-item.completed .ai-step-icon {
    color: #10b981;
}

/* Status badge top-right of step card */
.ai-step-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
}

/* Completed: Green circle check */
.ai-step-item.completed .ai-step-badge {
    background: #10b981;
    color: #ffffff;
}

/* Running: Purple rotating spinner */
.ai-step-item.active .ai-step-badge {
    border: 2px solid #c084fc;
    border-top-color: #7e22ce;
    border-radius: 50%;
    animation: stepSpin 0.8s linear infinite;
}

@keyframes stepSpin {
    to { transform: rotate(360deg); }
}

/* Waiting: Light grey ring */
.ai-step-item.waiting .ai-step-badge {
    border: 1.5px solid #cbd5e1;
    background: transparent;
}

.ai-step-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: #1e1b4b;
    line-height: 1.2;
    margin-top: 0.15rem;
    max-width: 82px;
    white-space: normal;
    text-align: center;
}

.ai-step-status {
    font-size: 0.62rem;
    font-weight: 600;
    color: #94a3b8;
}

.ai-step-item.active .ai-step-status {
    color: #9333ea;
    font-weight: 700;
}

.ai-step-item.completed .ai-step-status {
    color: #16a34a;
    font-weight: 700;
}

/* Horizontal connector dot between steps */
.ai-step-connector {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d8b4fe;
    flex-shrink: 0;
    margin-bottom: 8px;
}

/* Progress bar & percentage bottom */
.ai-pipeline-progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.25rem;
}

.ai-pipeline-track {
    flex: 1;
    height: 6px;
    background: #f1e4ec;
    border-radius: 9999px;
    overflow: hidden;
}

.ai-pipeline-fill {
    height: 100%;
    width: 10%;
    background: linear-gradient(90deg, #965c87 0%, #c026d3 50%, #db2777 100%);
    border-radius: 9999px;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-pipeline-pct {
    font-size: 0.8rem;
    font-weight: 800;
    color: #3b083d;
    min-width: 32px;
    text-align: right;
}

/* ==========================================================================
   7. CHAT HISTORY HEADER & PILL (CHATGPT / GEMINI STYLE)
   ========================================================================== */
.ai-history-header-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.85rem;
    margin-bottom: 0.85rem;
    background: #fdf2f8;
    border: 1px solid #fbcfe8;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(112, 38, 82, 0.04);
}

.ai-history-pill-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #831843;
}

.ai-btn-new-chat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #702652 0%, #340438 100%);
    color: #ffffff;
    border: none;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.ai-btn-new-chat:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #8a2f64 0%, #4a064f 100%);
    box-shadow: 0 3px 10px rgba(112, 38, 82, 0.25);
}

/* Collapsible finished badge */
.ai-pipeline-collapsed-badge {
    background: #fdf4fa;
    border: 1px solid #f3d1e6;
    border-radius: 12px;
    padding: 0.45rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #831843;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
    margin: 0.25rem 0;
}

.ai-pipeline-collapsed-badge:hover {
    background: #fae8f4;
}

/* 7. CHAT FOOTER & INPUT BAR */
.ai-chat-footer {
    padding: 0.85rem 1.15rem 1rem;
    background: #ffffff;
    border-top: 1px solid #edd5e4;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex-shrink: 0;
}

.ai-input-pill-wrap {
    display: flex;
    align-items: center;
    background: #faf6f9;
    border: 1.5px solid #ecd2e2;
    border-radius: 9999px;
    padding: 4px 6px 4px 10px;
    box-shadow: 0 2px 8px rgba(52, 4, 56, 0.03);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.ai-input-pill-wrap:focus-within {
    border-color: #c026d3;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(192, 38, 211, 0.12);
}

.ai-input-field {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.55rem 0.65rem;
    font-size: 0.88rem;
    color: #2b0b2e;
    outline: none;
}

.ai-input-field::placeholder {
    color: #9d8795;
}

/* Gradient round send button with paper plane */
.ai-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #702652 0%, #340438 100%);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(52, 4, 56, 0.25);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.ai-send-btn:hover {
    transform: scale(1.06);
    background: linear-gradient(135deg, #832e60 0%, #4a0750 100%);
    box-shadow: 0 6px 18px rgba(52, 4, 56, 0.35);
}

.ai-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ai-footer-note {
    text-align: center;
    font-size: 0.72rem;
    color: #be185d;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.ai-footer-note svg {
    color: #db2777;
}

.ai-footer-note-sub {
    color: #94a3b8;
    font-style: italic;
}

/* ==========================================================================
   8. CHAT HISTORY DRAWER PANEL (CHATGPT / GEMINI MULTI-THREAD STYLE)
   ========================================================================== */
.ai-history-drawer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    z-index: 60;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 6px 0 28px rgba(52, 4, 56, 0.16);
}

.ai-history-drawer.open {
    transform: translateX(0);
}

.ai-history-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.15rem;
    border-bottom: 1.5px solid #f3d1e6;
    background: linear-gradient(135deg, #fdf4fa 0%, #fae8f5 100%);
}

.ai-history-drawer-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 800;
    color: #3b083d;
}

.ai-history-drawer-title svg {
    color: #a855f7;
}

.ai-btn-close-drawer {
    background: transparent;
    border: none;
    color: #702652;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.ai-btn-close-drawer:hover {
    background: #fad2eb;
    color: #3b083d;
    transform: scale(1.08);
}

.ai-history-drawer-actions {
    padding: 0.85rem 1.15rem 0.5rem;
}

.ai-new-chat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    background: linear-gradient(135deg, #702652 0%, #340438 100%);
    color: #ffffff !important;
    border: none;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.22s ease;
    box-shadow: 0 4px 14px rgba(52, 4, 56, 0.2);
    outline: none;
}

.ai-new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(52, 4, 56, 0.32);
    background: linear-gradient(135deg, #8a2f64 0%, #4a064f 100%);
}

.ai-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1.15rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ai-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 0.9rem;
    border-radius: 14px;
    background: #faf6f9;
    border: 1.5px solid #f0d5e5;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    user-select: none;
}

.ai-history-item:hover {
    background: #fdf2f8;
    border-color: #c084fc;
    transform: translateX(4px);
    box-shadow: 0 4px 14px rgba(192, 38, 211, 0.1);
}

.ai-history-item.active {
    background: #fdf2f8;
    border-color: #a855f7;
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.18);
}

.ai-history-item-left {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.ai-history-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #f3e8f1;
    color: #702652;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.ai-history-item.active .ai-history-item-icon {
    background: #702652;
    color: #ffffff;
}

.ai-history-item-content {
    flex: 1;
    min-width: 0;
}

.ai-history-item-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-history-item-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e1b4b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    flex: 1;
}

.ai-history-active-badge {
    font-size: 0.62rem;
    font-weight: 800;
    background: #a855f7;
    color: #ffffff;
    padding: 1px 6px;
    border-radius: 999px;
    flex-shrink: 0;
}

.ai-history-item-meta {
    font-size: 0.68rem;
    color: #831843;
    opacity: 0.75;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}

.ai-history-item-del-btn {
    background: transparent;
    border: none;
    color: #9d8795;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.5;
    flex-shrink: 0;
    margin-left: 6px;
    outline: none;
}

.ai-history-item-del-btn:hover {
    color: #dc2626;
    background: #fee2e2;
    opacity: 1;
}

.ai-history-empty {
    padding: 3rem 1.25rem;
    text-align: center;
    color: #702652;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
}

.ai-history-empty-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #fdf2f8;
    border: 1.5px solid #fbcfe8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c026d3;
    margin-bottom: 0.25rem;
}

.ai-history-empty-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    max-width: 240px;
    line-height: 1.4;
}

.ai-history-drawer-footer {
    padding: 0.75rem 1.15rem;
    border-top: 1px solid #f3d1e6;
    background: #faf6f9;
    display: flex;
    justify-content: center;
}

.ai-clear-all-history-btn {
    background: transparent;
    border: none;
    color: #dc2626;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 8px;
    transition: background 0.2s;
    outline: none;
}

.ai-clear-all-history-btn:hover {
    background: #fee2e2;
}
