/* 🤖 AI Assistant Styles - Enhanced Design */

/* Container */
.ai-assistant-container {
    position: fixed;
    top: 220px;
    right: 20px;
    z-index: 8000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Toggle Button */
.ai-toggle-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(145deg, #8B0000, #ff4444);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 
        0 10px 25px rgba(139, 0, 0, 0.4),
        0 0 20px rgba(255, 68, 68, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.ai-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 
        0 15px 35px rgba(139, 0, 0, 0.6),
        0 0 30px rgba(255, 68, 68, 0.5);
    background: linear-gradient(145deg, #ff4444, #8B0000);
}

.ai-toggle-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: ai-scan 3s linear infinite;
}

@keyframes ai-scan {
    0% { transform: translate(-100%, -100%) rotate(0deg); }
    100% { transform: translate(100%, 100%) rotate(360deg); }
}

.ai-icon {
    font-size: 24px;
    z-index: 1;
    position: relative;
    animation: ai-pulse 2s ease-in-out infinite;
}

@keyframes ai-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* AI Panel */
.ai-panel {
    position: absolute;
    top: 80px;
    right: 0;
    width: 400px;
    max-height: 600px;
    background: linear-gradient(145deg, rgba(10, 10, 10, 0.95), rgba(26, 26, 26, 0.95));
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 2px solid rgba(139, 0, 0, 0.3);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(139, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
    animation: ai-panel-appear 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ai-panel-appear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* AI Header */
.ai-header {
    background: linear-gradient(145deg, rgba(139, 0, 0, 0.2), rgba(255, 68, 68, 0.1));
    padding: 15px 20px;
    border-bottom: 1px solid rgba(139, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-header h3 {
    color: #ff4444;
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
}

.ai-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ai-close:hover {
    background: rgba(255, 68, 68, 0.2);
    color: #ff4444;
}

/* Messages Area */
.ai-messages {
    height: 300px;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.ai-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(145deg, #8B0000, #ff4444);
    border-radius: 3px;
}

.ai-message {
    padding: 12px 15px;
    border-radius: 15px;
    max-width: 85%;
    word-wrap: break-word;
    white-space: pre-line;
    animation: ai-message-appear 0.3s ease-out;
}

@keyframes ai-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message.user {
    background: linear-gradient(145deg, #2c2c54, #40407a);
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.ai-message.assistant {
    background: linear-gradient(145deg, rgba(139, 0, 0, 0.2), rgba(255, 68, 68, 0.1));
    color: #ffffff;
    align-self: flex-start;
    border: 1px solid rgba(139, 0, 0, 0.3);
    border-bottom-left-radius: 5px;
    position: relative;
}

.ai-message.assistant::before {
    content: '🤖';
    position: absolute;
    top: -5px;
    left: -5px;
    background: linear-gradient(145deg, #8B0000, #ff4444);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid rgba(0, 0, 0, 0.8);
}

/* Input Area */
.ai-input-area {
    padding: 15px;
    border-top: 1px solid rgba(139, 0, 0, 0.3);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
}

#aiInput {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(139, 0, 0, 0.3);
    border-radius: 25px;
    padding: 12px 15px;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

#aiInput:focus {
    border-color: #ff4444;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

#aiInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#aiSend {
    background: linear-gradient(145deg, #8B0000, #ff4444);
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

#aiSend:hover {
    background: linear-gradient(145deg, #ff4444, #8B0000);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 0, 0, 0.4);
}

/* Quick Buttons */
.ai-quick-buttons {
    padding: 15px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(139, 0, 0, 0.2);
}

.ai-quick-buttons button {
    background: rgba(139, 0, 0, 0.2);
    border: 1px solid rgba(139, 0, 0, 0.4);
    border-radius: 15px;
    padding: 8px 12px;
    color: #ff4444;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 90px;
}

.ai-quick-buttons button:hover {
    background: rgba(139, 0, 0, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(139, 0, 0, 0.3);
    color: #ffffff;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ai-panel {
        width: 350px;
        max-height: 500px;
    }
    
    .ai-messages {
        height: 250px;
    }
    
    .ai-quick-buttons {
        flex-direction: column;
    }
    
    .ai-quick-buttons button {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .ai-panel {
        width: 300px;
        bottom: 70px;
        right: 10px;
    }
    
    .ai-toggle-btn {
        width: 50px;
        height: 50px;
        bottom: 10px;
        right: 10px;
    }
    
    .ai-icon {
        font-size: 20px;
    }
}

/* Special Effects */
.ai-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 0, 0, 0.1), transparent);
    animation: ai-panel-scan 4s linear infinite;
    pointer-events: none;
}

@keyframes ai-panel-scan {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Glow effects */
.ai-panel {
    animation: ai-glow 3s ease-in-out infinite alternate;
}

@keyframes ai-glow {
    from {
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.8),
            0 0 30px rgba(139, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    to {
        box-shadow: 
            0 25px 50px rgba(0, 0, 0, 0.8),
            0 0 40px rgba(139, 0, 0, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }
}

/* 3D Avatar - Redesigned */
.ai-avatar-3d {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #8B0000, #ff4444, #8B0000);
    border: 4px solid rgba(255, 68, 68, 0.6);
    box-shadow: 
        0 0 25px rgba(255, 68, 68, 0.8),
        inset 0 0 25px rgba(255, 255, 255, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    animation: avatarPulse 2.5s ease-in-out infinite;
    backdrop-filter: blur(10px);
}

.ai-avatar-3d::before {
    content: '🤖';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    z-index: 2;
    animation: robotBounce 2s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(255, 68, 68, 0.8));
}

.ai-avatar-3d::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 68, 68, 0.3),
        transparent
    );
    animation: rotate 3s linear infinite;
    opacity: 0.7;
}

@keyframes avatarPulse {
    0%, 100% {
        box-shadow: 
            0 0 25px rgba(255, 68, 68, 0.8),
            inset 0 0 25px rgba(255, 255, 255, 0.15),
            0 8px 32px rgba(0, 0, 0, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 
            0 0 40px rgba(255, 68, 68, 1),
            inset 0 0 40px rgba(255, 255, 255, 0.25),
            0 12px 48px rgba(0, 0, 0, 0.6);
        transform: scale(1.02);
    }
}

@keyframes robotBounce {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Canvas inside avatar */
#aiCanvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

/* Chat Bubble - Redesigned */
.ai-chat-bubble {
    position: absolute;
    top: 0;
    left: -300px;
    min-width: 280px;
    max-width: 350px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(20, 20, 20, 0.95));
    backdrop-filter: blur(25px);
    border: 2px solid rgba(255, 68, 68, 0.6);
    border-radius: 18px;
    padding: 18px;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.7),
        0 0 25px rgba(255, 68, 68, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.ai-chat-bubble::after {
    content: '';
    position: absolute;
    top: 20px;
    right: -12px;
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 12px solid rgba(255, 68, 68, 0.6);
    filter: drop-shadow(2px 0 4px rgba(0, 0, 0, 0.3));
}

.ai-assistant-container.active .ai-chat-bubble {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Message Styles */
.ai-message {
    color: #ffffff;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
    animation: typewriter 0.5s steps(40) forwards;
}

.ai-typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.ai-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #00ffff;
    border-radius: 50%;
    animation: typingDots 1.4s ease-in-out infinite;
}

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

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

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

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

/* Control Buttons - Redesigned */
.ai-controls {
    position: absolute;
    top: -12px;
    right: -12px;
    display: flex;
    gap: 6px;
    flex-direction: column;
}

.ai-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8B0000, #ff4444);
    border: 2px solid rgba(255, 68, 68, 0.4);
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
    backdrop-filter: blur(10px);
}

.ai-btn:hover {
    transform: scale(1.15) rotate(8deg);
    box-shadow: 0 6px 20px rgba(255, 68, 68, 0.6);
    background: linear-gradient(135deg, #ff4444, #ff6666);
    border-color: rgba(255, 255, 255, 0.6);
}

.ai-btn:active {
    transform: scale(0.95);
}

/* Speaking Animation */
.ai-speaking {
    animation: speaking 0.5s ease-in-out infinite alternate;
}

@keyframes speaking {
    from {
        border-color: rgba(0, 255, 255, 0.5);
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    }
    to {
        border-color: rgba(255, 0, 255, 0.8);
        box-shadow: 0 0 30px rgba(255, 0, 255, 0.5);
    }
}

/* Chat Interface Modal */
.ai-chat-interface {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 600px;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(0, 255, 255, 0.5);
    border-radius: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(0, 255, 255, 0.3);
    animation: modalSlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.1), rgba(0, 128, 255, 0.1));
}

.chat-header h3 {
    color: #00ffff;
    margin: 0;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.chat-header button {
    background: none;
    border: none;
    color: #ff4444;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.chat-header button:hover {
    background: rgba(255, 68, 68, 0.2);
    transform: rotate(90deg);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    animation: messageSlideIn 0.3s ease;
}

.chat-message.user {
    background: linear-gradient(135deg, #0080ff, #00ffff);
    color: #ffffff;
    align-self: flex-end;
    margin-left: auto;
}

.chat-message.ai {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(0, 255, 255, 0.3);
}

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

.chat-input {
    padding: 20px;
    border-top: 1px solid rgba(0, 255, 255, 0.3);
    display: flex;
    gap: 10px;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.05), rgba(0, 128, 255, 0.05));
}

.chat-input input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 25px;
    padding: 12px 20px;
    color: #ffffff;
    font-size: 14px;
    transition: all 0.3s ease;
}

.chat-input input:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.chat-input input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.chat-input button {
    background: linear-gradient(135deg, #00ffff, #0080ff);
    border: none;
    border-radius: 25px;
    padding: 12px 24px;
    color: #ffffff;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.chat-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.4);
}

/* Settings Modal */
.ai-settings-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid rgba(0, 255, 255, 0.5);
    border-radius: 15px;
    padding: 30px;
    z-index: 10002;
    min-width: 300px;
    animation: modalSlideIn 0.5s ease;
}

.modal-content h3 {
    color: #00ffff;
    margin-bottom: 20px;
    text-align: center;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: #ffffff;
}

.setting-item label {
    margin-right: 10px;
}

.setting-item input,
.setting-item select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 5px;
    padding: 5px 10px;
    color: #ffffff;
}

.modal-actions {
    text-align: center;
    margin-top: 20px;
}

.modal-actions button {
    background: linear-gradient(135deg, #00ffff, #0080ff);
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-actions button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.4);
}

/* Language Toggle removed - now handled in main CSS */

/* Responsive Design */
@media (max-width: 768px) {
    .ai-assistant-container {
        bottom: 20px;
        left: 20px;
    }
    
    .ai-avatar-3d {
        width: 80px;
        height: 80px;
    }
    
    .ai-chat-bubble {
        min-width: 250px;
        max-width: 300px;
        bottom: 90px;
    }
    
    .ai-chat-interface {
        width: 90vw;
        height: 80vh;
    }
    
    .language-toggle {
        top: 10px;
        left: 10px;
        padding: 5px;
    }
    
    .lang-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* Special Effects */
.ai-glitch {
    animation: glitchEffect 0.3s linear infinite;
}

@keyframes glitchEffect {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

.ai-hologram {
    position: relative;
    overflow: hidden;
}

.ai-hologram::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 255, 255, 0.4),
        transparent
    );
    animation: hologramScan 2s ease-in-out infinite;
}

@keyframes hologramScan {
    0% { left: -100%; }
    100% { left: 100%; }
} 