/* assets/css/m365-copilot.css */

.m365-chatbot {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #7a003c, #a41e54);
    color: white;
    border-radius: 8px 8px 0 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    opacity: 0.9;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffd700;
    transition: background-color 0.3s ease;
}

.status-indicator.connected {
    background: #00ff00;
    box-shadow: 0 0 4px rgba(0, 255, 0, 0.5);
}

.clear-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 300px;
    max-height: 600px;
}

.welcome-message {
    text-align: center;
    color: #666;
    padding: 20px;
}

.welcome-content h4 {
    color: #7a003c;
    margin-bottom: 10px;
    font-size: 18px;
}

.welcome-content p {
    margin-bottom: 20px;
    line-height: 1.5;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.conversation-starters h5 {
    color: #7a003c;
    margin-bottom: 12px;
    font-size: 14px;
}

.starter-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
    margin: 0 auto;
}

.starter-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #495057;
    transition: all 0.2s ease;
    text-align: left;
}

.starter-btn:hover {
    background: #e9ecef;
    border-color: #7a003c;
    color: #7a003c;
    transform: translateY(-1px);
}

.message {
    display: flex;
    max-width: 80%;
    animation: fadeIn 0.3s ease-in;
}

.message.user {
    align-self: flex-end;
}

.message.bot, .message.system {
    align-self: flex-start;
}

.message-content {
    background: #f3f2f1;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
}

.message.user .message-content {
    background: #7a003c;
    color: white;
}

.message.bot.error .message-content {
    background: #fde7e9;
    border: 1px solid #f1aeb5;
    color: #d13438;
}

.message.bot.system .message-content {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    color: #0066cc;
    font-style: italic;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-text code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.message.user .message-text code {
    background: rgba(255, 255, 255, 0.2);
}

.message-text a {
    color: inherit;
    text-decoration: underline;
}

.message.user .message-text a {
    color: #ffcc00;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.message.bot .message-time, .message.system .message-time {
    text-align: left;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #666;
    animation: typing 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; }

.loading-text {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.6;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.chat-input {
    padding: 16px 20px;
    border-top: 1px solid #e1e5e9;
    background: #fafafa;
    border-radius: 0 0 8px 8px;
}

.input-group {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d2d0ce;
    border-radius: 20px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
}

.message-input:focus {
    border-color: #7a003c;
}

.message-input:disabled {
    background: #f3f2f1;
    cursor: not-allowed;
}

.send-btn {
    background: #7a003c;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover:not(:disabled) {
    background: #a41e54;
    transform: translateY(-1px);
}

.send-btn:disabled {
    background: #d2d0ce;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.input-footer {
    margin-top: 8px;
    text-align: right;
}

.input-footer small {
    color: #666;
    font-size: 11px;
}

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

/* Scrollbar styling for webkit browsers */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Responsive design */
@media (max-width: 768px) {
    .m365-chatbot {
        height: 400px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chat-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .chat-header h3 {
        font-size: 14px;
    }
    
    .chat-status {
        font-size: 11px;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .chat-input {
        padding: 12px 16px;
    }
    
    .message-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .starter-buttons {
        max-width: 100%;
    }
    
    .starter-btn {
        font-size: 12px;
        padding: 10px 12px;
    }
    
    .welcome-content p {
        font-size: 14px;
    }
}