/**
 * AI Assistant Styles
 * Holographic orb with animations and tooltips
 */

.ai-assistant-orb {
    position: fixed;
    width: 60px;
    height: 60px;
    z-index: 9999;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
}

.ai-assistant-orb:hover {
    transform: scale(1.1) !important;
}

.orb-core {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6),
                0 0 40px rgba(102, 126, 234, 0.4),
                inset 0 0 20px rgba(255, 255, 255, 0.3);
    animation: float 3s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orb-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid rgba(102, 126, 234, 0.4);
    animation: pulse-ring 2s ease-out infinite;
}

.orb-ring:nth-child(1) {
    width: 70px;
    height: 70px;
    animation-delay: 0s;
}

.orb-ring:nth-child(2) {
    width: 90px;
    height: 90px;
    animation-delay: 0.5s;
}

.orb-ring:nth-child(3) {
    width: 110px;
    height: 110px;
    animation-delay: 1s;
}

.orb-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.4) 0%, transparent 70%);
    animation: glow-pulse 2s ease-in-out infinite;
}

.orb-face {
    position: relative;
    z-index: 2;
    width: 40px;
    height: 40px;
}

.orb-eye {
    position: absolute;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    animation: blink 4s infinite;
}

.orb-eye.left {
    left: 10px;
    top: 15px;
}

.orb-eye.right {
    right: 10px;
    top: 15px;
}

/* Animations */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0;
    }
}

@keyframes glow-pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

@keyframes blink {
    0%, 90%, 100% {
        opacity: 1;
    }
    95% {
        opacity: 0;
    }
}

/* Emotion Reactions */
.ai-assistant-orb.happy .orb-core {
    animation: bounce 0.5s ease-in-out;
}

.ai-assistant-orb.excited .orb-core {
    animation: shake 0.5s ease-in-out;
}

.ai-assistant-orb.thinking .orb-core {
    animation: rotate 2s linear infinite;
}

.ai-assistant-orb.interested .orb-core {
    transform: scale(1.05);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-15px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-7px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px) rotate(-5deg); }
    75% { transform: translateX(5px) rotate(5deg); }
}

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

/* Tooltip */
.ai-assistant-tooltip {
    position: fixed;
    background: rgba(0, 28, 85, 0.95);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    max-width: 250px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease-out;
    backdrop-filter: blur(10px);
}

.ai-assistant-tooltip::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 28, 85, 0.95);
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Message Bubble */
.ai-assistant-bubble {
    position: fixed;
    background: white;
    color: var(--text-color, #212529);
    padding: 15px 20px;
    border-radius: 20px;
    font-size: 15px;
    max-width: 250px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    transform: scale(0.8) translateX(20px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid #667eea;
}

.ai-assistant-bubble.show {
    opacity: 1;
    transform: scale(1) translateX(0);
}

.ai-assistant-bubble::before {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid #667eea;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
}

.ai-assistant-bubble::after {
    content: '';
    position: absolute;
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid white;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

/* Dark mode support */
[data-theme="dark"] .ai-assistant-bubble {
    background: #1A1F2E;
    color: #E8E9EB;
    border-color: #667eea;
}

[data-theme="dark"] .ai-assistant-bubble::after {
    border-left-color: #1A1F2E;
}

[data-theme="dark"] .ai-assistant-tooltip {
    background: rgba(26, 31, 46, 0.95);
}

[data-theme="dark"] .ai-assistant-tooltip::before {
    border-top-color: rgba(26, 31, 46, 0.95);
}

/* Responsive */
@media (max-width: 768px) {
    .ai-assistant-orb {
        width: 50px;
        height: 50px;
    }

    .orb-face {
        width: 35px;
        height: 35px;
    }

    .ai-assistant-tooltip {
        font-size: 13px;
        max-width: 200px;
    }

    .ai-assistant-bubble {
        font-size: 14px;
        max-width: 220px;
    }
}

/* Chat Window */
.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    border: 2px solid #667eea;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ai-chat-window.open {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 14px 14px 0 0;
}

.ai-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.ai-chat-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-chat-title p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.ai-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
}

.ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-chat-message {
    display: flex;
    gap: 10px;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-chat-message.user {
    flex-direction: row-reverse;
}

.ai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.ai-message-avatar.bot {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-message-avatar.user {
    background: #e9ecef;
}

.ai-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.ai-chat-message.bot .ai-message-content {
    background: white;
    color: #212529;
    border-bottom-left-radius: 4px;
}

.ai-chat-message.user .ai-message-content {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message-content a {
    color: #667eea;
    text-decoration: underline;
    font-weight: 500;
}

.ai-chat-message.user .ai-message-content a {
    color: white;
    text-decoration: underline;
}

.ai-typing-indicator {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.ai-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typingDot 1.4s infinite;
}

.ai-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.ai-chat-input-wrapper {
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: end;
}

.ai-chat-input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    transition: border-color 0.2s;
}

.ai-chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.ai-chat-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.ai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Quick suggestions */
.ai-quick-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 10px;
}

.ai-suggestion-chip {
    background: white;
    border: 2px solid #e9ecef;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.ai-suggestion-chip:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

/* Dark mode */
[data-theme="dark"] .ai-chat-window {
    background: #1A1F2E;
    border-color: #667eea;
}

[data-theme="dark"] .ai-chat-messages {
    background: #0F1419;
}

[data-theme="dark"] .ai-chat-message.bot .ai-message-content {
    background: #252c3d;
    color: #E8E9EB;
}

[data-theme="dark"] .ai-message-content a {
    color: #8b9dff;
}

[data-theme="dark"] .ai-message-avatar.user {
    background: #374151;
}

[data-theme="dark"] .ai-typing-indicator {
    background: #252c3d;
}

[data-theme="dark"] .ai-chat-input-wrapper {
    background: #1A1F2E;
    border-top-color: #374151;
}

[data-theme="dark"] .ai-chat-input {
    background: #252c3d;
    border-color: #374151;
    color: #E8E9EB;
}

[data-theme="dark"] .ai-suggestion-chip {
    background: #252c3d;
    border-color: #374151;
    color: #E8E9EB;
}

[data-theme="dark"] .ai-suggestion-chip:hover {
    border-color: #667eea;
    background: #2a3348;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .ai-chat-window {
        bottom: 80px;
        right: 10px;
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
    }

    .ai-message-content {
        max-width: 80%;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .orb-core,
    .orb-ring,
    .orb-glow,
    .orb-eye {
        animation: none !important;
    }

    .ai-assistant-orb {
        transition: none;
    }

    .ai-chat-window,
    .ai-chat-message,
    .ai-typing-dot {
        animation: none !important;
    }
}
