/* WIA AI Modal - Academic Assistant Style */

/* Floating Button */
.wia-ai-btn {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}
.wia-ai-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* Modal Overlay */
.wia-ai-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    backdrop-filter: blur(5px);
}
.wia-ai-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Content */
.ai-modal-content {
    background: #fff;
    border-radius: 16px;
    width: 95%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* Header */
.ai-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ai-modal-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}
.ai-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* AI Selector Tabs */
.ai-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}
.ai-tab {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}
.ai-tab.active {
    background: white;
    border-bottom-color: #667eea;
    color: #667eea;
}
.ai-tab:hover:not(.active) {
    background: #e9ecef;
}

/* API Setup */
.ai-api-setup {
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 8px;
    align-items: center;
}
.ai-api-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}
.ai-api-save {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}
.ai-api-save:hover {
    background: #218838;
}
.ai-api-help {
    padding: 0 16px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}
.ai-api-help a {
    color: #667eea;
    font-size: 12px;
    text-decoration: none;
}
.ai-api-help a:hover {
    text-decoration: underline;
}

/* Quick Action Buttons */
.ai-quick-actions {
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.ai-action-btn {
    padding: 8px 14px;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    color: #444;
}
.ai-action-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-1px);
}
.ai-action-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* Chat Messages */
.ai-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: white;
    min-height: 200px;
    max-height: 300px;
}
.ai-message {
    margin-bottom: 12px;
    display: flex;
}
.ai-message.user {
    justify-content: flex-end;
}
.ai-message.assistant {
    justify-content: flex-start;
}
.ai-message-content {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
}
.ai-message.user .ai-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}
.ai-message.assistant .ai-message-content {
    background: #f1f3f5;
    color: #333;
    border-bottom-left-radius: 4px;
}

/* Input Area */
.ai-input-area {
    padding: 12px 16px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.ai-message-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    resize: none;
    max-height: 80px;
    outline: none;
    font-family: inherit;
}
.ai-message-input:focus {
    border-color: #667eea;
}
.ai-send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.3s;
}
.ai-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.ai-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Stats Context */
.ai-stats-context {
    padding: 10px 16px;
    background: #e8f4fd;
    border-bottom: 1px solid #bee5eb;
    font-size: 12px;
    color: #0c5460;
}

/* Loading Animation */
.ai-loading {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}
.ai-loading span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.ai-loading span:nth-child(1) { animation-delay: -0.32s; }
.ai-loading span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .wia-ai-btn {
        bottom: 90px;
        right: 15px;
        padding: 12px 18px;
        font-size: 14px;
    }
    .ai-modal-content {
        width: 98%;
        max-height: 90vh;
        margin: 10px;
    }
    .ai-tab {
        padding: 10px 6px;
        font-size: 11px;
    }
    .ai-quick-actions {
        padding: 10px 12px;
        gap: 6px;
    }
    .ai-action-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    .ai-messages {
        min-height: 150px;
        max-height: 250px;
    }
}
