/**
 * AI Tutor Component Styles
 */

.ai-tutor-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

/* Toggle Button */
.ai-tutor-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--accent-color, #0066cc);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
    transition: all 0.3s ease;
}

.ai-tutor-toggle:hover:not(:disabled) {
    background: var(--accent-color-hover, #0052a3);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 102, 204, 0.4);
}

.ai-tutor-toggle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-tutor-toggle svg {
    width: 24px;
    height: 24px;
}

/* Modal */
.ai-tutor-modal {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: var(--bg-primary, #ffffff);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color, #e0e0e0);
}

.ai-tutor-modal.show {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

.ai-tutor-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

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

/* Header */
.ai-tutor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-secondary, #f5f5f5);
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    flex-shrink: 0;
}

.ai-tutor-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-tutor-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #000);
}

.ai-tutor-title svg {
    color: var(--accent-color, #0066cc);
}

.ai-tutor-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--accent-color, #0066cc);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
}

.ai-tutor-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.ai-tutor-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary, #000);
}

/* Messages */
.ai-tutor-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-primary, #fff);
}

.tutor-message,
.user-message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease-out;
}

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

.user-message {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.tutor-message-avatar,
.user-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tutor-message-avatar {
    background: var(--accent-color, #0066cc);
    color: white;
}

.user-message-avatar {
    background: var(--bg-tertiary, #e8e8e8);
    color: var(--text-primary, #000);
}

.tutor-message-content,
.user-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
}

.tutor-message-content {
    background: var(--bg-secondary, #f5f5f5);
    color: var(--text-primary, #000);
    border-top-left-radius: 4px;
}

.user-message-content {
    background: var(--accent-color, #0066cc);
    color: white;
    border-top-right-radius: 4px;
    text-align: left;
    max-width: 60%;
}

.tutor-message-content p,
.user-message-content p {
    margin: 0;
}

.tutor-message-content p:not(:last-child),
.user-message-content p:not(:last-child) {
    margin-bottom: 8px;
}

/* Loading indicator */
.tutor-message-loading {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.tutor-message-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color, #0066cc);
    animation: pulse 1.4s infinite ease-in-out;
}

.tutor-message-loading span:nth-child(2) {
    animation-delay: 0.2s;
}

.tutor-message-loading span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Input Container */
.ai-tutor-input-container {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: var(--bg-secondary, #f5f5f5);
    border-top: 1px solid var(--border-color, #e0e0e0);
    flex-shrink: 0;
}

.ai-tutor-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #d0d0d0);
    border-radius: 8px;
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #000);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    transition: border-color 0.2s ease;
}

.ai-tutor-input:focus {
    outline: none;
    border-color: var(--accent-color, #0066cc);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.ai-tutor-input::placeholder {
    color: var(--text-secondary, #999);
}

.ai-tutor-send {
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--accent-color, #0066cc);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.ai-tutor-send:hover:not(:disabled) {
    background: var(--accent-color-hover, #0052a3);
}

.ai-tutor-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Scrollbar styling */
.ai-tutor-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-tutor-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-tutor-messages::-webkit-scrollbar-thumb {
    background: var(--border-color, #d0d0d0);
    border-radius: 3px;
}

.ai-tutor-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary, #999);
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-tutor-container {
        bottom: 16px;
        right: 16px;
    }

    .ai-tutor-modal {
        bottom: 76px;
        right: 16px;
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
    }

    .ai-tutor-toggle span {
        display: none;
    }

    .ai-tutor-toggle {
        width: 56px;
        height: 56px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }
}
