/**
 * Frontend styles for AI Super Chatbot
 * Version: 1.0.0
 */
 
 /* Floating Bubble Styles */
.aisc-floating-bubble {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 9998;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Bubble Positions */
.aisc-floating-bubble[data-position="bottom-right"] {
    bottom: 20px;
    right: 20px;
}

.aisc-floating-bubble[data-position="bottom-left"] {
    bottom: 20px;
    left: 20px;
}

.aisc-floating-bubble[data-position="floating-right"] {
    bottom: 20px;
    right: 20px;
}

.aisc-floating-bubble[data-position="floating-left"] {
    bottom: 20px;
    left: 20px;
}

/* Bubble Avatar */
.aisc-bubble-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.aisc-bubble-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aisc-bubble-avatar i {
    font-size: 28px;
    color: #fff;
}

/* Bubble Badge (notification count) */
.aisc-bubble-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid #fff;
    display: none; /* Hidden by default */
}

.aisc-bubble-badge.show {
    display: flex;
}

/* Bubble Tooltip */
.aisc-bubble-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.aisc-bubble-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0,0,0,0.8);
}

/* Bubble Hover Effects */
.aisc-floating-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.aisc-floating-bubble:hover .aisc-bubble-tooltip {
    opacity: 1;
}

/* Bubble Animation */
@keyframes bubblePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

.aisc-floating-bubble.pulse {
    animation: bubblePulse 2s infinite;
}

/* Hide bubble when chatbox is open */
.aisc-floating-bubble.hidden {
    display: none;
}

/* Chatbot Container Updates */
.aisc-chatbot-container {
    position: fixed;
    width: 380px;
    height: 600px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 40px rgba(0,0,0,0.16);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Add entrance animation */
.aisc-chatbot-container.show {
    animation: slideInUp 0.3s ease;
}

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

/* Hide minimize button in header since we use bubble */
.aisc-btn-action.aisc-minimize {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .aisc-floating-bubble {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }
    
    .aisc-bubble-avatar i {
        font-size: 24px;
    }
    
    .aisc-chatbot-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 0;
        max-width: none;
    }
}
 
 
 
 
 
/* Icon Fixes and Font Awesome Support */
.aisc-chatbot-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Ensure Font Awesome icons display properly */
.aisc-chatbot-container i[class*="fa-"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    display: inline-block;
    font-weight: 900;
}

/* REMOVE ALL ::before content to prevent double icons */
.aisc-chatbot-container i[class*="fa-"]::before {
    /* Let Font Awesome handle this naturally */
}

/* Fix for icons that show text content */
.aisc-chatbot-container i[class*="fa-"]:not(:empty) {
    font-size: 0;
}

.aisc-chatbot-container i[class*="fa-"]:not(:empty)::before {
    font-size: inherit;
}

/* Icon specific sizes */
.aisc-ai-avatar i {
    font-size: 20px;
    color: #fff;
}

.aisc-message-avatar i {
    font-size: 16px;
}

.aisc-btn-action i {
    font-size: 14px;
    line-height: 1;
}

.aisc-send-button i {
    font-size: 16px;
}

/* Message Avatar specific fix */
.aisc-message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
}

.aisc-user-message .aisc-message-avatar {
    background: #667eea;
}

.aisc-user-message .aisc-message-avatar i {
    color: #fff;
}

/* Font Awesome Web Font Path Fix */
@font-face {
    font-family: "Font Awesome 6 Free";
    font-style: normal;
    font-weight: 900;
    font-display: block;
    src: url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-solid-900.woff2") format("woff2");
}

/* Ensure icons use correct font */
.aisc-chatbot-container .fas::before,
.aisc-chatbot-container .fa::before {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
}


/* Chatbot Container */
.aisc-chatbot-container {
    position: fixed;
    width: 380px;
    height: 600px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 40px rgba(0,0,0,0.16);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Position Variants */
.aisc-chatbot-container[data-position="floating-right"] {
    bottom: 20px;
    right: 20px;
}

.aisc-chatbot-container[data-position="floating-left"] {
    bottom: 20px;
    left: 20px;
}

.aisc-chatbot-container[data-position="bottom-right"] {
    bottom: 0;
    right: 20px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.aisc-chatbot-container[data-position="bottom-left"] {
    bottom: 0;
    left: 20px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Inline Mode for Shortcode */
.aisc-chatbot-container.aisc-inline-mode {
    position: relative;
    width: 100%;
    height: 100%;
    bottom: auto;
    right: auto;
    left: auto;
}

/* Minimized State */
.aisc-chatbot-container.minimized {
    height: 60px;
    overflow: hidden;
}

.aisc-chatbot-container.minimized .aisc-chat-body,
.aisc-chatbot-container.minimized .aisc-chat-footer {
    display: none;
}

/* Chat Header */
.aisc-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 15px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
}

.aisc-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aisc-ai-avatar {
    position: relative;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.aisc-ai-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aisc-ai-avatar i {
    font-size: 20px;
    color: #fff;
}

.aisc-status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #4ade80;
    border: 2px solid #fff;
    border-radius: 50%;
}

.aisc-ai-details h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.aisc-status-text {
    font-size: 12px;
    opacity: 0.9;
}

.aisc-header-actions {
    display: flex;
    gap: 8px;
}

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

.aisc-btn-action:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* Chat Body */
.aisc-chat-body {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
    position: relative;
}

.aisc-messages-container {
    padding: 20px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

/* Messages */
.aisc-message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeInUp 0.3s ease;
}

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

.aisc-message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
}

.aisc-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aisc-message-avatar i {
    font-size: 16px;
    color: #6c757d;
}

.aisc-user-message .aisc-message-avatar {
    background: #667eea;
}

.aisc-user-message .aisc-message-avatar i {
    color: #fff;
}

.aisc-message-content {
    max-width: 70%;
    margin: 0 12px;
}

.aisc-message-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 12px;
    color: #6c757d;
}

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

.aisc-message-name {
    font-weight: 500;
}

.aisc-message-time {
    opacity: 0.7;
}

.aisc-message-bubble {
    background: #fff;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: relative;
    word-wrap: break-word;
    line-height: 1.5;
}

.aisc-user-message .aisc-message-bubble {
    background: #667eea;
    color: #fff;
}

/* FAQ Section */
.aisc-faq-section {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.aisc-faq-section h5 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #495057;
    font-weight: 600;
}

.aisc-faq-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.aisc-faq-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    font-size: 13px;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
}

.aisc-faq-button:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

.aisc-faq-icon {
    font-size: 14px;
}

.aisc-faq-icon svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Suggested FAQs */
.aisc-suggested-faqs {
    background: #e3f2fd;
    border-radius: 12px;
    padding: 12px;
    margin-top: 10px;
}

.aisc-suggestion-text {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #1976d2;
    font-weight: 500;
}

.aisc-suggestion-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.aisc-faq-suggestion {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    font-size: 13px;
    color: #1976d2;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.aisc-faq-suggestion:hover {
    background: #1976d2;
    color: #fff;
    border-color: #1976d2;
}

/* Typing Indicator */
.aisc-typing-indicator {
    padding: 0 20px;
}

.aisc-typing-bubble {
    padding: 12px 16px;
    min-height: 40px;
}

.aisc-typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.aisc-typing-dots span {
    width: 8px;
    height: 8px;
    background: #adb5bd;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

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

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

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

/* Chat Footer */
.aisc-chat-footer {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 12px 12px;
}

.aisc-chat-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aisc-input-group {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.aisc-message-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #dee2e6;
    border-radius: 24px;
    resize: none;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    transition: all 0.3s ease;
    max-height: 120px;
    font-family: inherit;
}

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

.aisc-send-button {
    width: 40px;
    height: 40px;
    border: none;
    background: #667eea;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.aisc-send-button:hover {
    background: #5a67d8;
    transform: scale(1.05);
}

.aisc-send-button:active {
    transform: scale(0.95);
}

.aisc-send-button:disabled {
    background: #adb5bd;
    cursor: not-allowed;
}

.aisc-char-counter {
    font-size: 11px;
    color: #6c757d;
    text-align: right;
    padding: 0 16px;
}

/* Highlighted Keywords */
.aisc-highlighted {
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

/* Code Blocks */
.aisc-message-bubble pre {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
}

.aisc-message-bubble code {
    background: #f6f8fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    font-family: Consolas, Monaco, 'Courier New', monospace;
}

.aisc-user-message .aisc-message-bubble pre {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

.aisc-user-message .aisc-message-bubble code {
    background: rgba(255,255,255,0.2);
}

/* Lists in Messages */
.aisc-message-bubble ul {
    margin: 8px 0;
    padding-left: 20px;
}

.aisc-message-bubble li {
    margin: 4px 0;
}

/* Loading Spinner */
.aisc-spinner {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.aisc-spinner-circle {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: spinnerPulse 1.5s ease-in-out infinite;
}

.aisc-spinner-circle2 {
    animation-delay: 0.2s;
}

.aisc-spinner-circle3 {
    animation-delay: 0.4s;
}

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

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar Styling */
.aisc-chat-body::-webkit-scrollbar {
    width: 6px;
}

.aisc-chat-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.aisc-chat-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.aisc-chat-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Error Messages */
.aisc-error-message {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    margin: 10px 0;
}

/* Screen Reader Only */
.aisc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Responsive Design */
@media (max-width: 480px) {
    .aisc-chatbot-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 0;
        max-width: none;
    }
    
    .aisc-chat-header {
        border-radius: 0;
    }
    
    .aisc-chat-footer {
        border-radius: 0;
    }
    
    .aisc-message-content {
        max-width: 80%;
    }
    
    .aisc-faq-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .aisc-faq-button {
        width: 100%;
        justify-content: center;
    }
	/* Fix untuk floating bubble tidak tertutup mobile footer */
@media (max-width: 480px) {
    .aisc-floating-bubble {
        bottom: 75px !important; /* Naikkan posisi bubble di atas mobile footer */
        z-index: 99999999; /* Pastikan z-index lebih tinggi dari footer */
    }
    
    /* Jika website memiliki mobile footer dengan class tertentu */
    body.has-mobile-footer .aisc-floating-bubble {
        bottom: 85px !important; /* Sesuaikan dengan tinggi footer */
    }
}

/* Untuk tablet/iPad */
@media (max-width: 768px) {
    .aisc-floating-bubble {
        bottom: 70px !important;
    }
}

/* Optional: Animasi saat scroll untuk menghindari overlap */
.aisc-floating-bubble.scroll-up {
    transition: bottom 0.3s ease;
    bottom: 20px !important;
}

.aisc-floating-bubble.scroll-down {
    transition: bottom 0.3s ease;
    bottom: 80px !important;
}
.aisc-floating-bubble.near-footer {
    bottom: 90px !important;
    transition: bottom 0.3s ease;
}
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .aisc-chatbot-container {
        background: #1e1e1e;
        color: #e0e0e0;
    }
    
    .aisc-chat-body {
        background: #121212;
    }
    
    .aisc-message-bubble {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .aisc-faq-section {
        background: #2d2d2d;
    }
    
    .aisc-faq-button {
        background: #1e1e1e;
        border-color: #3d3d3d;
        color: #e0e0e0;
    }
    
    .aisc-message-input {
        background: #2d2d2d;
        border-color: #3d3d3d;
        color: #e0e0e0;
    }
    
    .aisc-chat-footer {
        background: #1e1e1e;
        border-color: #3d3d3d;
    }
}

/* Print Styles */
@media print {
    .aisc-chatbot-container {
        display: none;
    }
}

/* Shortcode Wrapper */
.aisc-shortcode-wrapper {
    position: relative;
    overflow: hidden;
    border: 1px solid #dee2e6;
    border-radius: 12px;
}