/* Chatbot Widget Styles */
#chatbot-widget {
    position: fixed;
    top: 200px;
    right: 15px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    background: linear-gradient(135deg, #F7E1BE 0%, #D98C11 100%);
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
}

.chatbot-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.chatbot-button:hover .chatbot-tooltip {
    opacity: 1;
    visibility: visible;
}

.chatbot-button svg {
    width: 32px;
    height: 32px;
}

/* Tooltip */
.chatbot-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: #2d3748;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chatbot-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 6px;
    border-color: transparent transparent transparent #2d3748;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.chatbot-container {
    position: fixed;
    bottom: 10px;
    right: 24px;
    width: 600px;
    max-width: calc(100vw - 48px);
    height: calc(100vh - 200px);
    height: 620px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: robotPulse 3s ease-in-out infinite;
}

@keyframes robotPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.chatbot-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.status-online {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-online::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ecc71;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: #e0e0e0;
    color: #666;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.bot-message .message-content {
    background: white;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.message-content p {
    margin: 0 0 8px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
}

.document-item {
    background: #f8f9fa;
    border-left: 3px solid #667eea;
    padding: 12px;
    margin: 8px 0;
    border-radius: 8px;
    transition: all 0.2s;
}

.document-item:hover {
    background: #e9ecef;
    transform: translateX(4px);
}

.document-title {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 4px;
    display: block;
    text-decoration: none;
}

.document-title:hover {
    text-decoration: underline;
}

.document-type {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.document-excerpt {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.document-tentang {
    font-size: 13px;
    color: #495057;
    margin: 6px 0;
    padding: 8px;
    background: #fff;
    border-radius: 4px;
}

.document-meta {
    font-size: 12px;
    color: #6c757d;
    margin: 6px 0;
    font-style: italic;
}

.document-meta::before {
    content: '📅 ';
}

/* Statistik Styles */
.statistik-container {
    margin-top: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
}

.statistik-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.statistik-item:last-child {
    margin-bottom: 0;
}

.statistik-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.statistik-label {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

.statistik-value {
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.document-source {
    font-size: 11px;
    color: #6c757d;
    margin: 4px 0;
    font-style: italic;
}

.document-source::before {
    content: '🔗 ';
}

.chatbot-input-container {
    border-top: 1px solid #e9ecef;
    background: white;
    padding: 16px 20px;
}

.chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.chatbot-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chatbot-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-send:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-footer-text {
    text-align: center;
    font-size: 11px;
    color: #adb5bd;
    margin-top: 8px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e0;
    animation: typing 1.4s infinite;
}

.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.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    #chatbot-widget {
        top: auto;
        bottom: 16px;
        right: 16px;
    }
    
    .chatbot-container {
        top: auto;
        bottom: 84px;
        right: 16px;
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        max-height: none;
    }
    
    .chatbot-button {
        width: 56px;
        height: 56px;
    }
    
    .chatbot-tooltip {
        display: none;
    }
}

@media (max-width: 480px) {
    .chatbot-container {
        width: calc(100vw - 24px);
        right: 12px;
    }
    
    .message-content {
        max-width: 80%;
    }
}