/* ============================================
   ChatGPT Chatbot Widget Styles
   ============================================ */

/* Container for entire chatbot */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 
                 "Helvetica Neue", Arial, sans-serif;
}

/* Fullscreen mode */
.chatbot-window.chatbot-fullscreen {
    top: 20px !important;
    bottom: 20px !important;
    left: 20px !important;
    right: 20px !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
}

/* Fullscreen mode */
.chatbot-window.chatbot-fullscreen {
    top: 20px !important;
    bottom: 20px !important;
    left: 20px !important;
    right: 20px !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
}

/* Toggle button - floating button */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* Chat window */
.chatbot-window {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.chatbot-window.active {
    display: flex;
}

/* Slide up animation */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.chatbot-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-title p {
    margin: 2px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

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

.chatbot-maximize {
    font-size: 16px;
}

.chatbot-close {
    font-size: 24px;
}

.chatbot-maximize:hover,
.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chatbot-maximize .glyphicon {
    font-size: 14px;
}

/* Messages container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7f9fc;
}

/* Individual message */
.chatbot-message {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    animation: fadeIn 0.3s ease-out;
}

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

/* User message - align right */
.chatbot-message.user {
    flex-direction: row-reverse;
}

/* Message avatar */
.chatbot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.chatbot-message.user .chatbot-message-avatar {
    background: #10b981;
}

/* Message content bubble */
.chatbot-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
}

.chatbot-message.user .chatbot-message-content {
    background: #667eea;
    color: white;
}

/* Typing indicator */
.chatbot-typing {
    display: none;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    width: fit-content;
    margin-left: 40px;
}

.chatbot-typing.active {
    display: block;
}

.chatbot-typing span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

.chatbot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Input container */
.chatbot-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
}

/* Input field */
.chatbot-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: #667eea;
}

.chatbot-input:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

/* Send button */
.chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #667eea;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chatbot-send .glyphicon {
    font-size: 16px;
    color: white;
}

.chatbot-send:hover:not(:disabled) {
    background: #5568d3;
}

.chatbot-send:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}


/* Error message */
.chatbot-error {
    padding: 12px;
    margin: 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 13px;
}

/* Sources/References */
.chatbot-sources {
    padding: 12px;
    margin: 8px 16px 16px 16px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    font-size: 13px;
}

.chatbot-sources-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #0369a1;
}

.chatbot-source-link {
    display: block;
    padding: 4px 8px;
    margin: 4px 0;
    color: #0284c7;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s;
}

.chatbot-source-link:hover {
    background: #e0f2fe;
    text-decoration: underline;
}

/* ============================================
   Mobile Responsive
   ============================================ */

@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .chatbot-toggle {
        bottom: 15px;
        right: 15px;
    }
}

/* ============================================
   Dark mode support (optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .chatbot-window {
        background: #1f2937;
    }
    
    .chatbot-messages {
        background: #111827;
    }
    
    .chatbot-message-content {
        background: #374151;
        color: #f3f4f6;
    }
    
    .chatbot-input-container {
        background: #1f2937;
        border-top-color: #374151;
    }
    
    .chatbot-input {
        background: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }
}

/* ============================================
   Scrollbar styling
   ============================================ */

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

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

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

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
