/* Hailey Chatbot Styles */

.hailey-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease;
}

.hailey-chat-widget.visible {
    opacity: 1;
    visibility: visible;
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.notification-badge.pop-in {
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-bubble {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #2e3192, #393191, #54308d, #423090, #303192, #52308e, #bc2c81, #4c308e, #b62c82);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(74, 144, 226, 0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    padding: 5px;
}

.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(74, 144, 226, 0.6);
}

.chat-bubble model-viewer {
    width: 100%;
    height: 100%;
    --poster-color: transparent;
    background: transparent;
}

.chat-bubble model-viewer::part(default-progress-bar) {
    display: none;
}

.chat-bubble svg {
    width: 30px;
    height: 30px;
    fill: white;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

.notification-badge.visible {
    opacity: 1;
    transform: scale(1);
}

.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-window.active {
    display: flex;
}

.chat-header {
    background: linear-gradient(135deg, #2e3192, #393191, #54308d, #423090, #303192, #52308e, #bc2c81, #4c308e, #b62c82);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #4A90E2;
    position: relative;
    overflow: visible;
}

.avatar-container {
    position: relative;
    width: 50px;
    height: 50px;
}

.avatar-image {
    width: 100%;
    height: 100%;
    border-radius: 70%;
    object-fit: cover;
    border: 40px solid white;
}

.avatar-speaking {
    animation: avatarPulse 0.8s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

@keyframes avatarPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(255, 255, 255, 1);
    }
}

.voice-indicator {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #4CAF50;
    border: 2px solid white;
    border-radius: 50%;
    display: none;
}

.voice-indicator.active {
    display: block;
    animation: voicePulse 1s ease-in-out infinite;
}

@keyframes voicePulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

.chat-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header-text p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.chat-header-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.voice-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.voice-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.voice-toggle.active {
    background: white;
    color: #4A90E2;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 24px;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.chat-close:hover {
    opacity: 0.8;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-items: flex-start;
}

.message.user {
    align-items: flex-end;
}

.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.message.bot .message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #2e3192, #393191, #54308d, #bc2c81, #b62c82);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.quick-actions {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-action-btn {
    padding: 8px 16px;
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action-btn:hover {
    background: linear-gradient(135deg, #2e3192, #393191, #54308d, #bc2c81, #b62c82);
    color: white;
    border-color: transparent;
}

.chat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #4A90E2;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #2e3192, #393191, #54308d, #423090, #303192, #52308e, #bc2c81, #4c308e, #b62c82);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-send-btn:hover {
    transform: scale(1.1);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-mic-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #2e3192, #393191, #54308d, #423090, #303192, #52308e, #bc2c81, #4c308e, #b62c82);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-mic-btn:hover {
    transform: scale(1.1);
}

.chat-mic-btn.recording {
    background: #ff4444;
    animation: recordingPulse 1s ease-in-out infinite;
}

@keyframes recordingPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 68, 68, 1);
    }
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    width: fit-content;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.cta-button {
    padding: 10px 16px;
    background: linear-gradient(135deg, #2e3192, #393191, #54308d, #423090, #303192, #52308e, #bc2c81, #4c308e, #b62c82);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

@media (max-width: 768px) {
    .chat-window {
        width: 100vw;
        height: 100vh;
        right: 0;
        bottom: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .hailey-chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-bubble {
        width: 60px;
        height: 60px;
    }
    
    .chat-header {
        padding: 15px;
    }
    
    .chat-header-text h3 {
        font-size: 14px;
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .message-bubble {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .quick-actions {
        padding: 10px 15px;
        gap: 6px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .quick-action-btn {
        padding: 6px 12px;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .chat-input-container {
        padding: 12px 15px;
        gap: 8px;
    }
    
    .chat-input {
        padding: 10px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .chat-send-btn,
    .chat-mic-btn {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 480px) {
    .chat-bubble {
        width: 55px;
        height: 55px;
    }
    
    .hailey-chat-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .notification-badge {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
}

/* Page context indicator */
.page-context-badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    margin-top: 4px;
    display: inline-block;
}

/* Click tracking notification */
.hailey-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2e3192, #393191, #54308d, #bc2c81, #b62c82);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 13px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
}

.hailey-toast.visible {
    opacity: 1;
}
