/* Kindroid Chat Widget - Professional Design with Flexible Sizing */

#kindroid-chat-widget {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    
    /* Default size - can be overridden with inline styles or data attributes */
    width: 100%;
    max-width: 500px;
    height: 600px;
}

/* Allow full-width/full-height mode via data attribute */
#kindroid-chat-widget.fullscreen {
    max-width: none;
    height: 100vh;
}

#kindroid-chat-widget.wide {
    max-width: none;
    width: 100%;
}

#kindroid-chat-widget.tall {
    height: 100vh;
}

/* Header with AI name and avatar */
#kindroid-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

#kindroid-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    object-fit: cover;
    border: 2px solid white;
}

#kindroid-chat-header-text {
    flex: 1;
}

#kindroid-chat-header-name {
    font-weight: 600;
    font-size: 16px;
    margin: 0;
}

#kindroid-chat-header-status {
    font-size: 12px;
    opacity: 0.9;
    margin: 0;
}

/* Messages container */
#kindroid-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scrollbar styling */
#kindroid-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#kindroid-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#kindroid-chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#kindroid-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Individual messages */
.kindroid-message {
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.4;
    animation: fadeIn 0.3s ease-in;
}

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

/* User message */
.kindroid-message.user {
    background-color: #667eea;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* AI message */
.kindroid-message.ai {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #e0e0e0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* Error message */
.kindroid-message.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef5350;
}

/* Loading indicator */
.kindroid-message.loading {
    background-color: #ffffff;
    color: #666;
    border: 1px solid #e0e0e0;
    align-self: flex-start;
}

.kindroid-loading-dots {
    display: inline-flex;
    gap: 4px;
}

.kindroid-loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #667eea;
    animation: bounce 1.4s infinite;
}

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

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

@keyframes bounce {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* Input container */
#kindroid-chat-input-container {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e0e0e0;
    background-color: #ffffff;
    flex-shrink: 0;
}

#kindroid-chat-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    color: #333333;
    background-color: #ffffff;
}

#kindroid-chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#kindroid-chat-input::placeholder {
    color: #999999;
}

/* Send button */
#kindroid-chat-send-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
}

#kindroid-chat-send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#kindroid-chat-send-button:active {
    transform: translateY(0);
}

#kindroid-chat-send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Responsive design */
@media (max-width: 768px) {
    #kindroid-chat-widget {
        max-width: 100%;
        height: 70vh;
    }
    
    .kindroid-message {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    #kindroid-chat-widget {
        height: 80vh;
        border-radius: 0;
    }
    
    #kindroid-chat-header {
        padding: 12px;
    }
    
    #kindroid-chat-messages {
        padding: 12px;
    }
    
    #kindroid-chat-input-container {
        padding: 8px;
    }
}
