/* DkR AI Chat Widget */
.dkr-ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    z-index: 9999;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

/* Fullscreen mode */
.dkr-ai-chat-widget.dkr-ai-fullscreen {
    width: 90vw;
    height: 90vh;
    max-width: 1200px;
    max-height: 800px;
    bottom: 5vh;
    right: 5vw;
}

.dkr-ai-chat-header {
    background: #000;
    /* DkR Black */
    color: #fff;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
}

.dkr-ai-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.dkr-ai-header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.dkr-ai-header-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dkr-ai-header-btn:hover {
    opacity: 1;
}

.dkr-ai-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dkr-ai-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.dkr-ai-message.user {
    align-self: flex-end;
    background: #000;
    color: #fff;
    border-bottom-right-radius: 2px;
}

.dkr-ai-message.assistant {
    align-self: flex-start;
    background: #e9ecef;
    color: #333;
    border-bottom-left-radius: 2px;
}

/* Typewriter cursor effect */
.dkr-ai-message.assistant.typing::after {
    content: '|';
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.dkr-ai-chat-input-area {
    padding: 15px;
    border-top: 1px solid #ddd;
    background: #fff;
    display: flex;
    gap: 10px;
}

.dkr-ai-chat-input-area input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.dkr-ai-chat-input-area input:focus {
    border-color: #000;
}

.dkr-ai-chat-input-area button {
    background: #000;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.dkr-ai-chat-input-area button:hover {
    background: #333;
}

.dkr-ai-chat-input-area button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Enhanced Loading Indicators */
.dkr-ai-loading-container {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f0f0f0;
    border-radius: 12px;
    margin: 10px 0;
}

.dkr-ai-loading-avatar {
    width: 32px;
    height: 32px;
    background: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
}

.dkr-ai-loading-content {
    flex: 1;
}

.dkr-ai-loading-text {
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.dkr-ai-loading-dots {
    display: flex;
    gap: 5px;
}

.dkr-ai-loading-dots span {
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
    animation: pulse 1.4s infinite ease-in-out;
}

.dkr-ai-loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.dkr-ai-loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes pulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Typing Indicator (classic bouncing dots) */
.dkr-ai-typing {
    display: flex;
    gap: 5px;
    padding: 5px 0;
}

.dkr-ai-typing span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.dkr-ai-typing span:nth-child(1) {
    animation-delay: -0.32s;
}

.dkr-ai-typing span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Progress bar indicator */
.dkr-ai-progress-bar {
    width: 100%;
    height: 3px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.dkr-ai-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #000 0%, #333 100%);
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% {
        width: 0%;
        margin-left: 0;
    }
    50% {
        width: 60%;
        margin-left: 20%;
    }
    100% {
        width: 0%;
        margin-left: 100%;
    }
}

/* Toggle Button */
#dkr-ai-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #0073aa;
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 9999;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

#dkr-ai-bubble:hover {
    transform: scale(1.1);
}

.dkr-ai-chat-widget.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .dkr-ai-chat-widget {
        width: calc(100vw - 40px);
        height: 60vh;
        bottom: 10px;
        right: 10px;
    }

    .dkr-ai-chat-widget.dkr-ai-fullscreen {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .dkr-ai-message {
        max-width: 90%;
    }
}
