/* Our Books Chatbot Styles */

.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: 'Inter', sans-serif;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.chatbot-toggle.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    transform: scale(1.1);
}

.chatbot-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #1f2937;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10001;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.chatbot-back {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-back:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.chatbot-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #6b7280;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.chatbot-message {
    max-width: 85%;
    animation: fadeInMessage 0.3s ease-in-out;
}

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

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

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    font-size: 14px;
    line-height: 1.4;
}

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

.bot-message .message-content {
    background: #374151;
    color: #e5e7eb;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid #4b5563;
}

.message-content strong {
    color: #fbbf24;
    font-weight: 600;
}

.message-content em {
    color: #a78bfa;
    font-style: italic;
}

.chatbot-input-container {
    padding: 16px 20px;
    background: #111827;
    border-top: 1px solid #374151;
    display: flex;
    gap: 12px;
    align-items: center;
}

#chatbot-input {
    flex: 1;
    background: #374151;
    border: 1px solid #4b5563;
    border-radius: 24px;
    padding: 12px 16px;
    color: #e5e7eb;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

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

#chatbot-input::placeholder {
    color: #9ca3af;
}

#chatbot-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 24px;
    padding: 12px 20px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#chatbot-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#chatbot-send:active {
    transform: translateY(0);
}

.chatbot-status {
    padding: 8px 20px;
    background: #111827;
    border-top: 1px solid #374151;
    text-align: center;
}

#chatbot-status-text {
    font-size: 12px;
    color: #9ca3af;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

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

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

/* Responsive design */
@media (max-width: 768px) {
    .chatbot-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-container {
        width: 100vw;
        height: 100vh;
    }
    
    .chatbot-toggle {
        width: 55px;
        height: 55px;
    }
    
    .chatbot-messages {
        padding: 15px;
    }
    
    .chatbot-input-container {
        padding: 12px 15px;
    }
    
    #chatbot-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    .chatbot-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .chatbot-container {
        width: 100vw;
        height: 100vh;
    }
    
    .chatbot-toggle {
        width: 50px;
        height: 50px;
    }
    
    .chatbot-header {
        padding: 12px 15px;
    }
    
    .chatbot-header h3 {
        font-size: 16px;
    }
    
    .chatbot-messages {
        padding: 12px;
        gap: 8px;
    }
    
    .chatbot-input-container {
        padding: 10px 12px;
        gap: 8px;
    }
    
    #chatbot-input {
        padding: 10px 12px;
        font-size: 16px;
    }
    
    #chatbot-send {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .user-message .message-content,
    .bot-message .message-content {
        font-size: 14px;
        padding: 10px 12px;
    }
}

/* Dark mode compatibility */
@media (prefers-color-scheme: dark) {
    .chatbot-container {
        background: #0f172a;
        border-color: #1e293b;
    }
    
    .bot-message .message-content {
        background: #1e293b;
        border-color: #334155;
    }
    
    .chatbot-input-container {
        background: #020617;
        border-color: #1e293b;
    }
    
    .chatbot-status {
        background: #020617;
        border-color: #1e293b;
    }
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* LaTeX rendering styles */
.MathJax {
    font-size: 1.1em !important;
}

/* Custom scrollbar for webkit browsers */
.chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(55, 65, 81, 0.3);
    border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, 0.6);
    border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.8);
}