/**
 * CHATBOT & KUIS KILAT AI - STYLES
 * Faz Learning - Aplikasi Pembelajaran Interaktif
 * 
 * Dibuat oleh: Fazar Miftachul Fikri, S.Kom, Gr
 * Tahun: 2026
 */

/* ============================================
   CHATBOT FLOATING BUTTON & LABEL
   ============================================ */

.chatbot-floating-label {
    position: fixed;
    bottom: 100px;
    right: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 2rem;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
    z-index: 999;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: floatLabel 3s ease-in-out infinite;
}

.chatbot-floating-label.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.chatbot-floating-label:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.5);
}

.chatbot-floating-label::before {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #764ba2;
}

.chatbot-floating-label i {
    font-size: 0.75rem;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes floatLabel {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.chatbot-floating-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    z-index: 998;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-floating-btn:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
}

.chatbot-floating-btn.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}

.chatbot-floating-btn i {
    transition: transform 0.3s ease;
}

.chatbot-floating-btn:hover i {
    transform: scale(1.2);
}

/* ============================================
   CHATBOT CONTAINER
   ============================================ */

.chatbot-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-container.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
}

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

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.chatbot-info h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.chatbot-info span {
    font-size: 0.75rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.chatbot-info span i {
    font-size: 0.5rem;
    color: #4ade80;
}

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

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Chatbot Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8fafc;
}

/* Welcome Screen */
.chatbot-welcome {
    text-align: center;
    padding: 2rem 1rem;
    background: white;
    border-radius: 1rem;
    margin-bottom: 1rem;
}

.welcome-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.chatbot-welcome h5 {
    color: #1e293b;
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
}

.chatbot-welcome p {
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quick-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #475569;
    font-weight: 600;
    transition: all 0.2s ease;
    text-align: left;
}

.quick-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateX(4px);
}

.quick-btn i {
    font-size: 1rem;
}

/* Chat Messages */
.chatbot-message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    animation: fadeInUp 0.3s ease;
}

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

.chatbot-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.message-avatar.ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-avatar.user {
    background: #e2e8f0;
    color: #64748b;
}

.message-content {
    max-width: 75%;
}

.message-bubble {
    padding: 0.875rem 1rem;
    border-radius: 1rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message-bubble p {
    margin: 0 0 0.5rem 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble strong {
    color: #667eea;
}

.chatbot-message.ai .message-bubble {
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 0.25rem;
}

.chatbot-message.user .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.message-bubble.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.message-time {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.25rem;
    display: block;
}

.chatbot-message.user .message-time {
    text-align: right;
}

/* Typing Indicator */
.chatbot-typing {
    padding: 0.75rem 1rem;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.typing-indicator {
    display: flex;
    gap: 0.25rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-10px); opacity: 1; }
}

.typing-text {
    font-size: 0.8125rem;
    color: #64748b;
    font-weight: 600;
    font-style: italic;
}

/* Input Area */
.chatbot-input-area {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.chatbot-input-wrapper {
    display: flex;
    gap: 0.5rem;
    background: #f1f5f9;
    border-radius: 1rem;
    padding: 0.5rem;
}

.chatbot-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    color: #1e293b;
    outline: none;
}

.chatbot-input::placeholder {
    color: #94a3b8;
}

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

.chatbot-send:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.chatbot-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* ============================================
   KUIS KILAT AI STYLES
   ============================================ */

.kuis-kilat-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 1.5rem;
    padding: 2rem;
    text-align: center;
    color: white;
    margin: 2rem 0;
}

.kuis-kilat-intro {
    margin-bottom: 1.5rem;
}

.kuis-icon {
    position: relative;
    display: inline-block;
    margin-bottom: 1rem;
}

.kuis-icon i {
    font-size: 3rem;
    color: white;
}

.kuis-icon .sparkle {
    position: absolute;
    top: -5px;
    right: -10px;
    font-size: 1.5rem;
    animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.kuis-kilat-intro h3 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.kuis-kilat-intro p {
    font-size: 1rem;
    opacity: 0.95;
    line-height: 1.6;
}

.kuis-kilat-btn {
    background: white;
    color: #667eea;
    border: none;
    padding: 1rem 2rem;
    border-radius: 2rem;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.kuis-kilat-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.kuis-kilat-btn i {
    font-size: 1.25rem;
    animation: flash 1s ease-in-out infinite;
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.kuis-kilat-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: white;
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Kuis Box */
.kuis-kilat-box {
    background: white;
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 2px solid #e2e8f0;
}

.kuis-kilat-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f1f5f9;
}

.kuis-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.kuis-kilat-header h4 {
    color: #1e293b;
    font-size: 1.375rem;
    margin: 0;
}

.kuis-soal {
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid #667eea;
}

.kuis-soal p {
    color: #1e293b;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.6;
    margin: 0;
}

/* Opsi Jawaban */
.kuis-opsi {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.kuis-opsi-btn {
    background: white;
    border: 2px solid #e2e8f0;
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    text-align: left;
}

.kuis-opsi-btn:hover:not(:disabled) {
    border-color: #667eea;
    background: #f8fafc;
    transform: translateX(4px);
}

.kuis-opsi-btn:disabled {
    cursor: default;
}

.kuis-opsi-btn.correct {
    border-color: #22c55e;
    background: #f0fdf4;
}

.kuis-opsi-btn.wrong {
    border-color: #ef4444;
    background: #fef2f2;
}

.opsi-label {
    width: 36px;
    height: 36px;
    background: #e2e8f0;
    color: #475569;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.kuis-opsi-btn:hover:not(:disabled) .opsi-label {
    background: #667eea;
    color: white;
}

.kuis-opsi-btn.correct .opsi-label {
    background: #22c55e;
    color: white;
}

.kuis-opsi-btn.wrong .opsi-label {
    background: #ef4444;
    color: white;
}

.opsi-text {
    color: #1e293b;
    font-size: 1rem;
    font-weight: 500;
}

/* Feedback */
.kuis-feedback {
    background: #f0fdf4;
    border: 2px solid #22c55e;
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    animation: slideIn 0.3s ease;
}

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

.feedback-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.125rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #bbf7d0;
}

.feedback-header.correct {
    color: #16a34a;
}

.feedback-header.wrong {
    color: #dc2626;
    border-bottom-color: #fecaca;
}

.feedback-content p {
    color: #1e293b;
    margin-bottom: 1rem;
}

.penjelasan-box {
    background: white;
    padding: 1rem;
    border-radius: 0.75rem;
    border-left: 4px solid #667eea;
}

.penjelasan-box h5 {
    color: #667eea;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.penjelasan-box p {
    color: #475569;
    font-size: 0.9375rem;
    line-height: 1.6;
    margin: 0;
}

/* Kuis Actions */
.kuis-actions {
    text-align: center;
}

.kuis-next-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.kuis-next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

/* Error */
.kuis-error {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 0.75rem;
    margin-top: 1rem;
}

/* ============================================
   AI INTERACTIVE EXAMPLES
   ============================================ */

.ai-example-box {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #7dd3fc;
    border-radius: 1rem;
    overflow: hidden;
    margin: 1.5rem 0;
}

.ai-example-header {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
}

.ai-example-header i {
    font-size: 1.25rem;
}

.ai-example-content {
    padding: 1.25rem;
}

.ai-example-btn {
    background: white;
    border: 2px solid #0ea5e9;
    color: #0284c7;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.ai-example-btn:hover {
    background: #0ea5e9;
    color: white;
}

.ai-example-response {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

.ai-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #64748b;
}

.typing-dots {
    display: inline-block;
    position: relative;
    width: 20px;
    height: 4px;
}

.typing-dots::before,
.typing-dots::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: #64748b;
    border-radius: 50%;
    animation: dots 1.4s ease-in-out infinite;
}

.typing-dots::before {
    left: 0;
}

.typing-dots::after {
    left: 8px;
    animation-delay: 0.2s;
}

@keyframes dots {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

.ai-response-content {
    color: #1e293b;
    line-height: 1.7;
}

.ai-response-salam {
    font-weight: 700;
    color: #0ea5e9;
    margin-bottom: 0.75rem;
}

.ai-response-source {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.8125rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-error {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #dc2626;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

@media (max-width: 640px) {
    .chatbot-floating-label {
        bottom: 90px;
        right: 1rem;
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
    
    .chatbot-floating-btn {
        width: 50px;
        height: 50px;
        right: 1rem;
        bottom: 1.5rem;
        font-size: 1.25rem;
    }
    
    .chatbot-container {
        width: calc(100% - 2rem);
        height: 70vh;
        right: 1rem;
        bottom: 1.5rem;
    }
    
    .kuis-kilat-section,
    .kuis-kilat-box {
        margin: 1.5rem 0;
        padding: 1.25rem;
    }
    
    .kuis-kilat-intro h3 {
        font-size: 1.375rem;
    }
    
    .kuis-soal p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .chatbot-floating-label {
        display: none;
    }
    
    .kuis-opsi-btn {
        padding: 0.875rem 1rem;
    }
    
    .opsi-label {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
    
    .opsi-text {
        font-size: 0.9375rem;
    }
}

/* Hide chatbot when printing */
@media print {
    .chatbot-floating-label,
    .chatbot-floating-btn,
    .chatbot-container {
        display: none !important;
    }
}
