/* AI Assistant Widget CSS Stylesheet */

#ai-assistant-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    pointer-events: none; /* Let clicks pass through empty spaces */
    font-family: 'Inter', sans-serif;
}

#ai-assistant-widget * {
    pointer-events: auto; /* Enable clicks for actual widget children */
}

/* Three.js Canvas Container */
.assistant-canvas-container {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.15) 0%, rgba(147, 51, 234, 0.05) 70%, transparent 100%);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.2);
    position: relative;
    border: 1px solid rgba(6, 182, 212, 0.3);
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.assistant-canvas-container:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 10px 25px rgba(6, 182, 212, 0.4), 0 0 15px rgba(147, 51, 234, 0.3);
    border-color: rgba(147, 51, 234, 0.5);
}

#assistant-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Pulsing Outer Rings for Robot */
.assistant-pulse-ring {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    border: 1px solid rgba(6, 182, 212, 0.3);
    animation: assist-pulse 3s infinite linear;
    pointer-events: none;
    z-index: -1;
}

.assistant-pulse-ring:nth-child(2) {
    animation-delay: 1.5s;
}

@keyframes assist-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

/* Control Panel - Floats under/near canvas */
.assistant-controls {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.assistant-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.assistant-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.assistant-btn.active {
    color: #06b6d4;
    background: rgba(6, 182, 212, 0.15);
}

/* Mic button pulse when listening */
.assistant-btn.btn-mic.listening {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
    animation: mic-listening-pulse 1.5s infinite ease-in-out;
}

@keyframes mic-listening-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Speech Bubble Container */
.assistant-speech-container {
    margin-right: 15px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-width: 320px;
    transform: translateY(0);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.assistant-speech-container.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(-10px);
}

.assistant-speech-bubble {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(6, 182, 212, 0.1);
    position: relative;
    color: #f1f5f9;
}

/* Speech bubble arrow pointing to robot */
.assistant-speech-bubble::after {
    content: '';
    position: absolute;
    right: -10px;
    bottom: 30px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 10px solid rgba(15, 23, 42, 0.9);
    filter: drop-shadow(1px 0 0 rgba(6, 182, 212, 0.3));
}

.assistant-bubble-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.assistant-name {
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #06b6d4, #9333ea);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.assistant-close-bubble {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.assistant-close-bubble:hover {
    color: #f1f5f9;
}

.assistant-bubble-body {
    font-size: 14px;
    line-height: 1.5;
    color: #e2e8f0;
}

/* Speech Quick actions */
.assistant-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.assistant-action-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 11px;
    color: #06b6d4;
    cursor: pointer;
    transition: all 0.2s ease;
}

.assistant-action-chip:hover {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.4);
    transform: translateY(-1px);
}

/* Chat Input Bar in Bubble */
.assistant-bubble-input {
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 8px;
    display: flex;
    gap: 6px;
}

.assistant-bubble-input input {
    flex: 1;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    color: #ffffff;
    outline: none;
    transition: border-color 0.2s;
}

.assistant-bubble-input input:focus {
    border-color: rgba(6, 182, 212, 0.5);
}

.assistant-bubble-input button {
    background: linear-gradient(135deg, #06b6d4, #9333ea);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.assistant-bubble-input button:hover {
    transform: scale(1.05);
}

/* Tour Navigation Controls inside Speech Bubble */
.assistant-tour-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 8px;
    width: 100%;
}

.assistant-tour-step-info {
    font-size: 11px;
    color: #64748b;
}

.assistant-tour-buttons {
    display: flex;
    gap: 6px;
}

.assistant-tour-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 11px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2;
}

.assistant-tour-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.assistant-tour-btn.next-step {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(147, 51, 234, 0.3));
    border-color: rgba(6, 182, 212, 0.4);
    color: #06b6d4;
    font-weight: 600;
}

.assistant-tour-btn.next-step:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.5), rgba(147, 51, 234, 0.5));
}

/* Floating Tour Prompt Overlay in Hero */
.hero-assistant-prompt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 30px;
    padding: 8px 16px;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.15);
    animation: bounce-slow 3s infinite ease-in-out;
    cursor: pointer;
    transition: all 0.3s ease;
    
    /* Centered under the portrait image */
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translate(-50%, 0);
    margin-top: 0;
    z-index: 30;
}

.hero-assistant-prompt:hover {
    border-color: rgba(147, 51, 234, 0.5);
    box-shadow: 0 4px 20px rgba(147, 51, 234, 0.25);
    transform: translateY(-2px);
}

.hero-assistant-prompt .pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #06b6d4;
    border-radius: 50%;
    animation: dot-pulse 1.5s infinite;
}

.hero-assistant-prompt span {
    font-size: 13px;
    color: #e2e8f0;
    font-weight: 500;
}

@keyframes dot-pulse {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(6, 182, 212, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}

@keyframes bounce-slow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Typing Indicator Animation */
.assistant-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
}

.assistant-typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: #94a3b8;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.assistant-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.assistant-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #ai-assistant-widget {
        bottom: 15px;
        right: 15px;
        flex-direction: column-reverse;
        align-items: flex-end;
    }

    .assistant-speech-container {
        margin-right: 0;
        margin-bottom: 12px;
        max-width: 280px;
    }

    .assistant-speech-bubble::after {
        right: 25px;
        bottom: -10px;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-top: 10px solid rgba(15, 23, 42, 0.9);
        filter: drop-shadow(0 1px 0 rgba(6, 182, 212, 0.3));
    }

    .assistant-canvas-container {
        width: 100px;
        height: 100px;
    }
}
