/* Chatbot Widget Styles */
.cpc-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Toggle Button */
.cpc-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 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    color: white;
    position: relative;
}

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

.cpc-chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

/* Chatbot Container */
.cpc-chatbot-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.cpc-chatbot-container.active {
    display: flex;
}

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

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

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

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

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

.cpc-chatbot-status {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.cpc-chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.cpc-chatbot-close:hover {
    opacity: 1;
}

/* Messages Area */
.cpc-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f7fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

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

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

.cpc-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.cpc-chatbot-welcome {
    text-align: center;
    color: #666;
    font-size: 14px;
    padding: 20px;
}

.cpc-chatbot-message {
    display: flex;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

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

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

.cpc-chatbot-message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.cpc-chatbot-message.user .cpc-chatbot-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.cpc-chatbot-message.support .cpc-chatbot-message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cpc-chatbot-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

.cpc-chatbot-message.user .cpc-chatbot-message-time {
    text-align: right;
}

.cpc-chatbot-message-order {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.cpc-chatbot-message.user .cpc-chatbot-message-order {
    background: rgba(255, 255, 255, 0.15);
}

.cpc-chatbot-message.support .cpc-chatbot-message-order {
    background: #f0f0f0;
}

.cpc-chatbot-message-order strong {
    display: block;
    margin-bottom: 6px;
    color: inherit;
}

.cpc-chatbot-message-order-details {
    display: flex;
    gap: 12px;
    font-size: 12px;
    opacity: 0.9;
}

/* Input Area */
.cpc-chatbot-input-area {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 16px;
}

.cpc-chatbot-user-info {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.cpc-chatbot-user-info input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

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

/* Order Selector */
.cpc-chatbot-order-selector {
    margin-bottom: 12px;
    position: relative;
}

.cpc-chatbot-order-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #e8eaf6;
    border: 1px solid #667eea;
    border-radius: 8px;
    margin-bottom: 8px;
}

.cpc-chatbot-order-info {
    font-size: 13px;
    color: #333;
    flex: 1;
}

.cpc-chatbot-order-remove {
    background: none;
    border: none;
    color: #667eea;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.cpc-chatbot-order-remove:hover {
    background: rgba(102, 126, 234, 0.1);
}

.cpc-chatbot-order-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f5f7fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.cpc-chatbot-order-btn:hover {
    background: #e8eaf6;
    border-color: #667eea;
}

.cpc-chatbot-order-btn svg {
    flex-shrink: 0;
}

.cpc-chatbot-order-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
    z-index: 10;
}

.cpc-chatbot-order-search {
    position: relative;
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.cpc-chatbot-order-search input {
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

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

.cpc-chatbot-order-search svg {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.cpc-chatbot-order-list {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.cpc-chatbot-order-item {
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.cpc-chatbot-order-item:hover {
    background: #f5f7fa;
    border-color: #667eea;
}

.cpc-chatbot-order-item:last-child {
    margin-bottom: 0;
}

.cpc-chatbot-order-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.cpc-chatbot-order-item-id {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.cpc-chatbot-order-item-amount {
    font-size: 13px;
    color: #667eea;
    font-weight: 600;
}

.cpc-chatbot-order-item-meta {
    font-size: 11px;
    color: #999;
    display: flex;
    gap: 8px;
}

.cpc-chatbot-order-loading {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

.cpc-chatbot-order-empty {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

.cpc-chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cpc-chatbot-input-wrapper input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

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

.cpc-chatbot-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.cpc-chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.cpc-chatbot-send-btn:active {
    transform: scale(0.95);
}

.cpc-chatbot-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading indicator */
.cpc-chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.cpc-chatbot-typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* Responsive */
@media (max-width: 480px) {
    .cpc-chatbot-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        right: 10px;
        bottom: 80px;
        border-radius: 12px;
    }
    
    .cpc-chatbot-toggle {
        width: 56px;
        height: 56px;
        right: 10px;
        bottom: 10px;
    }
}

