/* ============================================
   Global AI Assistant Styles
   ============================================ */

/* Floating AI Button */
.ai-assistant-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    animation: float 3s ease-in-out infinite, pulse 2s ease-in-out infinite;
}

.ai-assistant-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.ai-assistant-fab.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.ai-assistant-fab .notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ff4757;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    animation: bounce 0.5s ease-in-out;
}

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

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.8);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Chat Window */
.ai-assistant-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    max-width: calc(100vw - 60px);
    height: 600px;
    max-height: calc(100vh - 150px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    animation: slideInUp 0.3s ease-out;
    transition: all 0.3s ease;
}

.ai-assistant-window.closing {
    animation: slideOutDown 0.3s ease-out;
}

.ai-assistant-window.dark {
    background: #1a1a2e;
    color: #ffffff;
}

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

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

.ai-assistant-header .ai-info {
    flex: 1;
}

.ai-assistant-header .ai-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
}

.ai-assistant-header .ai-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-assistant-header .status-indicator {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.ai-assistant-header .ai-actions {
    display: flex;
    gap: 8px;
}

.ai-assistant-header .ai-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ai-assistant-header .ai-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Chat Area */
.ai-assistant-chat {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-assistant-window.dark .ai-assistant-chat {
    background: #16213e;
}

.ai-assistant-chat::-webkit-scrollbar {
    width: 8px;
}

.ai-assistant-chat::-webkit-scrollbar-track {
    background: transparent;
}

.ai-assistant-chat::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.ai-assistant-chat::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Messages */
.ai-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: fadeInMessage 0.3s ease-out;
}

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

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

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

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

.ai-message.user .message-avatar {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
}

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

.ai-message.assistant .message-content {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ai-assistant-window.dark .ai-message.assistant .message-content {
    background: #2d3748;
    color: #e2e8f0;
}

.ai-message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message .message-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    text-align: right;
}

.ai-message.user .message-time {
    text-align: left;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.ai-assistant-window.dark .typing-indicator {
    background: #2d3748;
}

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

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

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

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

/* Quick Actions */
.ai-quick-actions {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.ai-assistant-window.dark .ai-quick-actions {
    background: #1a1a2e;
    border-top-color: #2d3748;
}

.ai-quick-actions::-webkit-scrollbar {
    height: 4px;
}

.ai-quick-action {
    padding: 8px 16px;
    background: #f3f4f6;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-assistant-window.dark .ai-quick-action {
    background: #2d3748;
    color: #e2e8f0;
}

.ai-quick-action:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
}

.ai-assistant-window.dark .ai-quick-action:hover {
    background: #374151;
}

/* Input Area */
.ai-assistant-input {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    border-radius: 0 0 20px 20px;
}

.ai-assistant-window.dark .ai-assistant-input {
    background: #1a1a2e;
    border-top-color: #2d3748;
}

.ai-assistant-input textarea {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    background: #f9fafb;
    transition: all 0.2s;
}

.ai-assistant-window.dark .ai-assistant-input textarea {
    background: #2d3748;
    border-color: #374151;
    color: #e2e8f0;
}

.ai-assistant-input textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.ai-assistant-window.dark .ai-assistant-input textarea:focus {
    background: #374151;
}

.ai-assistant-input textarea::placeholder {
    color: #9ca3af;
}

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

.ai-assistant-input .send-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-assistant-input .send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Welcome Screen */
.ai-welcome {
    text-align: center;
    padding: 40px 20px;
}

.ai-welcome .welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.ai-welcome h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1f2937;
}

.ai-assistant-window.dark .ai-welcome h3 {
    color: #e2e8f0;
}

.ai-welcome p {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 24px;
}

.ai-assistant-window.dark .ai-welcome p {
    color: #94a3b8;
}

.ai-welcome .welcome-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-welcome .suggestion-btn {
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.ai-assistant-window.dark .ai-welcome .suggestion-btn {
    background: #2d3748;
    border-color: #374151;
    color: #e2e8f0;
}

.ai-welcome .suggestion-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateX(4px);
}

.ai-assistant-window.dark .ai-welcome .suggestion-btn:hover {
    background: #374151;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-assistant-fab {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .ai-assistant-window {
        bottom: 86px;
        right: 20px;
        left: 20px;
        width: auto;
        max-width: none;
        height: 500px;
    }

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

/* Dark Mode Toggle */
.theme-switch {
    position: relative;
    width: 50px;
    height: 24px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: 0.4s;
    border-radius: 24px;
}

.theme-slider:before {
    position: absolute;
    content: "🌙";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.theme-switch input:checked + .theme-slider:before {
    transform: translateX(26px);
    content: "☀️";
}

/* Loading Shimmer Effect */
.loading-shimmer {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 50%,
        #f0f0f0 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

.ai-assistant-window.dark .loading-shimmer {
    background: linear-gradient(
        90deg,
        #2d3748 0%,
        #374151 50%,
        #2d3748 100%
    );
}

/* Code Blocks in Messages */
.ai-message .message-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.ai-assistant-window.dark .ai-message .message-content code {
    background: #1a1a2e;
}

.ai-message .message-content pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.ai-message .message-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* Notification Dot Animation */
@keyframes notificationPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}
