/**
 * Coursebot styles
 *
 * @package    local_coursebot
 * @copyright  2026 MOS München
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

/* Floating Icon */
.coursebot-floating-icon {
    position: fixed;
    top: 80px;
    left: 80px;
    z-index: 9999;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.coursebot-floating-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.coursebot-floating-icon svg {
    width: 24px;
    height: 24px;
}

/* Modal Overlay */
.coursebot-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.coursebot-modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal Content */
.coursebot-modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dark mode support */
.dark .coursebot-modal-content,
[data-bs-theme="dark"] .coursebot-modal-content {
    background: #1a1a2e;
    color: #e0e0e0;
}

/* Header */
.coursebot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.coursebot-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.coursebot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.coursebot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Body */
.coursebot-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Welcome Screen */
.coursebot-welcome p {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
}

.dark .coursebot-welcome p,
[data-bs-theme="dark"] .coursebot-welcome p {
    color: #aaa;
}

.coursebot-mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.coursebot-mode-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.coursebot-mode-btn:hover {
    border-color: #667eea;
    background: #f0f3ff;
}

.dark .coursebot-mode-btn,
[data-bs-theme="dark"] .coursebot-mode-btn {
    background: #2a2a3e;
    border-color: #3a3a4e;
}

.dark .coursebot-mode-btn:hover,
[data-bs-theme="dark"] .coursebot-mode-btn:hover {
    border-color: #667eea;
    background: #3a3a5e;
}

.coursebot-mode-btn .mode-icon {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.coursebot-mode-btn .mode-desc {
    display: block;
    font-size: 0.85rem;
    color: #888;
}

/* Warning */
.coursebot-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.coursebot-warning p {
    margin: 0;
    color: #856404;
    text-align: left;
}

/* Topics */
.coursebot-topics {
    padding: 0;
}

.coursebot-topic-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.coursebot-topic-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.coursebot-topic-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.dark .coursebot-topic-btn,
[data-bs-theme="dark"] .coursebot-topic-btn {
    background: #2a2a3e;
    border-color: #3a3a4e;
}

.coursebot-topic-btn .topic-name {
    display: block;
    font-weight: 500;
}

.coursebot-topic-btn .topic-desc {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
}

.coursebot-back-btn {
    background: transparent;
    border: none;
    color: #667eea;
    cursor: pointer;
    padding: 8px 0;
    font-size: 0.9rem;
}

.coursebot-back-btn:hover {
    text-decoration: underline;
}

/* Chat Messages */
.coursebot-chat {
    padding: 0;
}

.coursebot-messages {
    max-height: 350px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 8px;
}

.coursebot-message {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
    animation: messageIn 0.2s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.coursebot-message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.coursebot-message.assistant {
    background: #f1f3f5;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.dark .coursebot-message.assistant,
[data-bs-theme="dark"] .coursebot-message.assistant {
    background: #2a2a3e;
    color: #e0e0e0;
}

.coursebot-message.error {
    background: #fee2e2;
    color: #dc2626;
    margin-right: auto;
}

.coursebot-message .message-content {
    line-height: 1.5;
}

.coursebot-message .message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.coursebot-message .message-content pre {
    background: rgba(0, 0, 0, 0.1);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.coursebot-message .message-content pre code {
    background: none;
    padding: 0;
}

/* Thinking Animation */
.coursebot-message.thinking {
    background: #f1f3f5;
}

.thinking-dots {
    display: inline-flex;
    gap: 4px;
    margin-right: 8px;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

.thinking-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Input Area */
.coursebot-input-area {
    padding: 16px 20px;
    border-top: 1px solid #e9ecef;
    background: #fafafa;
}

.dark .coursebot-input-area,
[data-bs-theme="dark"] .coursebot-input-area {
    background: #1a1a28;
    border-top-color: #2a2a3e;
}

.coursebot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#coursebot-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 10px 14px;
    resize: none;
    font-size: 0.95rem;
    line-height: 1.4;
    min-height: 42px;
    max-height: 120px;
    font-family: inherit;
}

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

.dark #coursebot-input,
[data-bs-theme="dark"] #coursebot-input {
    background: #2a2a3e;
    border-color: #3a3a4e;
    color: #e0e0e0;
}

.coursebot-send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.coursebot-send-btn:hover {
    transform: scale(1.05);
}

.coursebot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.coursebot-difficult-btn {
    margin-top: 12px;
    width: 100%;
    background: transparent;
    border: 1px dashed #adb5bd;
    border-radius: 8px;
    padding: 10px;
    color: #6c757d;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.coursebot-difficult-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

/* Dialog Overlay */
.coursebot-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coursebot-dialog {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.dark .coursebot-dialog,
[data-bs-theme="dark"] .coursebot-dialog {
    background: #1a1a2e;
    color: #e0e0e0;
}

.coursebot-dialog h4 {
    margin: 0 0 12px;
}

.coursebot-dialog p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.coursebot-notif-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.coursebot-notif-options button {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.coursebot-notif-options button:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.coursebot-dialog-cancel {
    background: transparent;
    border: none;
    color: #6c757d;
    cursor: pointer;
    font-size: 0.9rem;
}

.coursebot-dialog-cancel:hover {
    color: #dc3545;
}

/* Responsive */
@media (max-width: 576px) {
    .coursebot-floating-icon {
        width: 44px;
        height: 44px;
        top: 70px;
        left: 10px;
    }

    .coursebot-modal-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 12px;
    }

    .coursebot-messages {
        max-height: 280px;
    }
}