/* Castells AI Assistant - Frontend Styles */

.cai-chatbot-container {
    max-width: 700px;
    margin: 20px auto;
}

.chat-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #C8102E 0%, #1A1A1A 100%);
    color: white;
    padding: 20px;
    text-align: center;
    flex-shrink: 0;
}

.chat-header h1 {
    font-size: 24px;
    margin: 0 0 5px 0;
    font-weight: 600;
}

.chat-header p {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
    min-height: 200px;
}

.message {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease-in;
}

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

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

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

.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 15px;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
}

.message.assistant .message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.message.user .message-bubble {
    background: #C8102E;
    color: white;
    border-bottom-right-radius: 5px;
}

.typing-indicator {
    display: none;
    padding: 12px 16px;
    background: white;
    border-radius: 15px;
    width: fit-content;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin: 0 20px 20px 20px;
}

.typing-indicator.active {
    display: block;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background: #C8102E;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.4s infinite ease-in-out;
}

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

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

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

.chat-input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e5e5e5;
    flex-shrink: 0;
}

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

#userInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e5e5;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
    resize: none;
    min-height: 45px;
}

#userInput:focus {
    border-color: #C8102E;
}

#sendBtn {
    background: linear-gradient(135deg, #C8102E 0%, #1A1A1A 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    white-space: nowrap;
}

#sendBtn:hover:not(:disabled) {
    transform: scale(1.05);
}

#sendBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 8px;
    margin: 10px 20px;
    text-align: center;
    font-size: 14px;
}

/* Message styles */
.cai-message {
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.cai-message.cai-error {
    background: #fee;
    border-left: 4px solid #c33;
}

.cai-message.cai-info {
    background: #e7f3ff;
    border-left: 4px solid #0066cc;
}

.cai-message h3 {
    margin-top: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .cai-chatbot-container {
        margin: 10px;
    }
    
    .chat-container {
        border-radius: 10px;
    }
    
    .chat-header h1 {
        font-size: 20px;
    }
    
    .message-bubble {
        max-width: 85%;
    }
}
