/* AI Product Tour - Position-based Floating Mode */
#ai-overlay {
    position: fixed;
    width: 240px; /* Giảm từ 280px xuống 240px */
    height: auto;
    background: transparent;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    z-index: 9999; /* Tăng lên rất cao để hiển thị trên tất cả elements */
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Position variants */
#ai-overlay.position-top-right {
    top: 20px;
    right: 20px;
}

#ai-overlay.position-top-left {
    top: 20px;
    left: 20px;
}

#ai-overlay.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

#ai-overlay.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

#ai-overlay.position-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#ai-overlay.show {
    opacity: 1;
    pointer-events: auto; /* Cho phép tương tác với AI tour */
}

/* AI Guide Window - Compact Floating Notification */
#ai-guide {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 10px; /* Giảm từ 12px xuống 10px */
    max-width: 220px; /* Giảm từ 260px xuống 220px */
    width: auto;
    text-align: left;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
    animation: slideInRight 0.6s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    pointer-events: auto; /* Cho phép tương tác với AI guide */
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* AI Guide Header - Minimized */
#ai-guide-header {
    display: none; /* Hide header for cleaner look */
}

#ai-guide-header .ai-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 20px;
    color: white;
}

#ai-guide-header .ai-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

/* AI Text Content - Compact Mode */
#ai-text {
    min-height: 30px;
    margin-bottom: 0;
    font-size: 12px; /* Giảm từ 13px xuống 12px */
    line-height: 1.4;
    color: #333;
    padding: 6px; /* Giảm từ 8px xuống 6px */
    background: rgba(248, 249, 250, 0.8);
    border-radius: 4px;
    border-left: 3px solid #007bff;
}

#ai-text.typing::after {
    content: '|';
    animation: blink 1s infinite;
    color: #667eea;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Progress Indicator - Hidden for compact mode */
#ai-progress {
    display: none;
}

/* Buttons - Hidden for auto-advance mode */
#ai-buttons {
    display: none;
}

.ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.ai-btn.next {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-btn.next:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.ai-btn.skip {
    background: #6c757d;
    color: white;
}

.ai-btn.skip:hover {
    background: #5a6268;
}

.ai-btn.prev {
    background: #e9ecef;
    color: #495057;
}

.ai-btn.prev:hover {
    background: #dee2e6;
}

/* Loading State */
.ai-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ai-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Highlight Elements - Non-intrusive */
.ai-highlight {
    outline: 2px solid #667eea !important;
    outline-offset: 1px;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.3) !important;
    animation: pulse 2s infinite;
    /* Không thay đổi z-index để không can thiệp vào layout */
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.8);
    }
    100% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
    }
}

/* Responsive Design - Ultra Compact */
@media (max-width: 768px) {
    #ai-overlay {
        top: 15px;
        right: 15px;
        width: 240px;
    }
    
    #ai-guide {
        max-width: 220px;
        padding: 10px;
    }
    
    #ai-text {
        font-size: 12px;
        min-height: 25px;
        padding: 6px;
    }
}

/* Position-based overlay styles */
#ai-overlay.top-left {
    top: 20px;
    left: 20px;
    right: auto;
}

#ai-overlay.top-center {
    top: 20px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

#ai-overlay.top-right {
    top: 20px;
    right: 20px;
    left: auto;
}

#ai-overlay.bottom-left {
    bottom: 20px;
    left: 20px;
    top: auto;
    right: auto;
}

#ai-overlay.bottom-center {
    bottom: 20px;
    left: 50%;
    top: auto;
    right: auto;
    transform: translateX(-50%);
}

#ai-overlay.bottom-right {
    bottom: 20px;
    right: 20px;
    top: auto;
    left: auto;
}

#ai-overlay.center {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
}