/* AI Agent Widget Styles */

/* Agent Bubble */
.agent-bubble {
    position: fixed;
    top: 80px;
    right: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 9999;
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.agent-bubble:hover {
    transform: translateX(-5px);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.agent-bubble.chat-open {
    opacity: 0.7;
    transform: translateX(10px);
}

.bubble-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.bubble-text {
    color: white;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.bubble-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 20px;
    height: 20px;
    background: #ff6b6b;
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    padding: 0 6px;
    animation: bounce 1s infinite;
    border: 2px solid white;
}

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

/* Agent Chat Window */
.agent-chat {
    position: fixed;
    width: 380px;
    height: 600px;
    background: rgba(10, 14, 39, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    border: 1px solid rgba(255, 255, 255, 0.15);
    animation: fadeInScale 0.3s ease-out;
}

.agent-chat.draggable {
    user-select: none;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.agent-chat.minimized {
    height: 60px;
}

.agent-chat.minimized .chat-messages,
.agent-chat.minimized .suggested-actions,
.agent-chat.minimized .typing-indicator,
.agent-chat.minimized .chat-input-container {
    display: none;
}

/* Chat Header */
.chat-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px 20px 0 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agent-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-info {
    display: flex;
    flex-direction: column;
}

.agent-name {
    font-weight: 600;
    color: white;
    font-size: 14px;
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

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

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

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

.user-message {
    justify-content: flex-end;
}

.assistant-message {
    justify-content: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-content {
    max-width: 70%;
}

.message-text {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

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

.assistant-message .message-text {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border-bottom-left-radius: 4px;
}

.message-text strong {
    font-weight: 600;
}

.message-text em {
    font-style: italic;
}

.message-text code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.message-text a {
    color: #667eea;
    text-decoration: underline;
}

.message-text a:hover {
    color: #764ba2;
}

.message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    padding: 0 4px;
}

.user-message .message-time {
    text-align: right;
}

/* Suggested Actions */
.suggested-actions {
    padding: 0 20px;
    max-height: 100px;
    overflow-y: auto;
}

.suggestions-wrapper {
    margin-bottom: 15px;
}

.suggestions-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
}

.suggestions-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-chip {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.suggestion-chip:hover {
    background: rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
}

/* Typing Indicator */
.typing-indicator {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

.typing-dots 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;
    }
}

.typing-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* Chat Input */
.chat-input-container {
    padding: 15px 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0 0 20px 20px;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 10px 14px;
    color: white;
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.5;
    transition: all 0.2s ease;
}

#chat-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(102, 126, 234, 0.5);
}

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

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

.send-button:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding: 0 4px;
}

.char-count,
.privacy-note {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

/* Responsive Design */
@media (max-width: 480px) {
    .agent-chat {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        left: 10px !important;
        top: 60px !important;
        transform: none !important;
        border-radius: 15px;
    }

    .agent-bubble {
        top: 70px;
        right: 20px;
        padding: 10px 16px;
    }

    .bubble-text {
        display: none;
    }

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

/* Dark Mode Adjustments */
@media (prefers-color-scheme: light) {
    .agent-chat {
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    }

    .chat-header {
        background: rgba(0, 0, 0, 0.03);
    }

    .agent-name {
        color: #1a1a1a;
    }

    .agent-status {
        color: #666;
    }

    .action-btn {
        background: rgba(0, 0, 0, 0.05);
        color: #666;
    }

    .action-btn:hover {
        background: rgba(0, 0, 0, 0.1);
        color: #1a1a1a;
    }

    .assistant-message .message-text {
        background: rgba(0, 0, 0, 0.05);
        color: #1a1a1a;
    }

    #chat-input {
        background: rgba(0, 0, 0, 0.05);
        border-color: rgba(0, 0, 0, 0.1);
        color: #1a1a1a;
    }

    #chat-input::placeholder {
        color: rgba(0, 0, 0, 0.4);
    }

    .suggestion-chip {
        background: rgba(0, 0, 0, 0.05);
        border-color: rgba(0, 0, 0, 0.1);
        color: #1a1a1a;
    }

    .char-count,
    .privacy-note {
        color: rgba(0, 0, 0, 0.4);
    }
}