/* Bot Popup Widget Styles */
.bot-popup-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.bot-popup-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: transparent;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    position: relative;
    padding: 0;
}

.bot-popup-button:hover {
    transform: scale(1.1);
    opacity: 0.9;
}

.bot-popup-button img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.bot-popup-button svg {
    width: 28px;
    height: 28px;
}

.bot-popup-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.bot-popup-window.active {
    display: flex;
}

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

.bot-popup-header {
    background: #007bff;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.bot-popup-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.bot-popup-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-popup-new-chat {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    white-space: nowrap;
}

.bot-popup-new-chat:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

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

.bot-popup-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.bot-popup-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-left: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bot-popup-message.bot .bot-popup-product-list {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.bot-popup-message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.bot-popup-message.user {
    align-self: flex-end;
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-popup-message.bot {
    align-self: flex-start;
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.bot-popup-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 75%;
}

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

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

.bot-popup-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;
    }
}

.bot-popup-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 8px;
}

.bot-popup-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #dee2e6;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    color: #333 !important;
    background-color: #ffffff !important;
}

.bot-popup-input::placeholder {
    color: #999 !important;
}

.bot-popup-input:focus {
    border-color: #007bff;
}

.bot-popup-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.bot-popup-send:hover:not(:disabled) {
    background: #0056b3;
}

.bot-popup-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bot-popup-send svg {
    width: 20px;
    height: 20px;
}

.bot-popup-error {
    padding: 12px 16px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 8px;
    margin: 8px 20px;
    font-size: 14px;
    border: 1px solid #f5c6cb;
}

.bot-popup-product-list {
    list-style: none;
    padding: 0;
    margin: 0;
    margin-left: 0;
    padding-left: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bot-popup-product-item {
    margin: 0;
    padding: 0;
    list-style: none;
}

.bot-popup-product-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    gap: 12px;
}

.bot-popup-product-link:hover {
    background: #f8f9fa;
    border-color: #007bff;
    text-decoration: none;
    color: #007bff;
    transform: translateX(4px);
}

.bot-popup-product-name {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
}

.bot-popup-product-price {
    font-weight: 600;
    color: #007bff;
    font-size: 14px;
    white-space: nowrap;
}

.bot-popup-product-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bot-popup-product-card-name {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.bot-popup-product-card-description {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.bot-popup-product-card-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.bot-popup-product-card-price {
    font-weight: 600;
    color: #007bff;
    font-size: 16px;
    white-space: nowrap;
}

.bot-popup-product-card-availability {
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.bot-popup-product-card-availability.available {
    background: #d4edda;
    color: #155724;
}

.bot-popup-product-card-availability.unavailable {
    background: #f8d7da;
    color: #721c24;
}

.bot-popup-product-card-link {
    display: inline-block;
    padding: 8px 16px;
    background: #007bff;
    color: white !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.bot-popup-product-card-link:hover {
    background: #0056b3;
    text-decoration: none;
    color: white;
}

.bot-popup-message-content {
    flex: 1;
}

/* Markdown styles for bot messages */
.bot-popup-message.bot .bot-popup-message-content {
    line-height: 1.6;
}

.bot-popup-message.bot .bot-popup-message-content p {
    margin: 0 0 8px 0;
}

.bot-popup-message.bot .bot-popup-message-content p:last-child {
    margin-bottom: 0;
}

.bot-popup-message.bot .bot-popup-message-content strong {
    font-weight: 600;
    color: #333;
}

.bot-popup-message.bot .bot-popup-message-content em {
    font-style: italic;
}

.bot-popup-message.bot .bot-popup-message-content .bot-popup-product-item a {
    color: #007bff !important;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 123, 255, 0.3);
    transition: all 0.2s;
}

.bot-popup-message.bot .bot-popup-message-content .bot-popup-product-itema:hover {
    color: #0056b3;
    border-bottom-color: #0056b3;
}

.bot-popup-message.bot .bot-popup-message-content code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.bot-popup-message.bot .bot-popup-message-content pre {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.4;
}

.bot-popup-message.bot .bot-popup-message-content pre code {
    background: none;
    padding: 0;
}

.bot-popup-message.bot .bot-popup-message-content ul,
.bot-popup-message.bot .bot-popup-message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.bot-popup-message.bot .bot-popup-message-content li {
    margin: 4px 0;
}

.bot-popup-message.bot .bot-popup-message-content h1,
.bot-popup-message.bot .bot-popup-message-content h2,
.bot-popup-message.bot .bot-popup-message-content h3,
.bot-popup-message.bot .bot-popup-message-content h4,
.bot-popup-message.bot .bot-popup-message-content h5,
.bot-popup-message.bot .bot-popup-message-content h6 {
    margin: 12px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
}

.bot-popup-message.bot .bot-popup-message-content h1 {
    font-size: 1.5em;
}

.bot-popup-message.bot .bot-popup-message-content h2 {
    font-size: 1.3em;
}

.bot-popup-message.bot .bot-popup-message-content h3 {
    font-size: 1.1em;
}

.bot-popup-message.bot .bot-popup-message-content blockquote {
    border-left: 3px solid #007bff;
    padding-left: 12px;
    margin: 8px 0;
    color: #666;
    font-style: italic;
}

.bot-popup-message.bot .bot-popup-message-content hr {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin: 12px 0;
}

.bot-popup-feedback {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.bot-popup-feedback-btn {
    background: transparent;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 28px;
}

.bot-popup-feedback-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
    transform: scale(1.1);
}

.bot-popup-feedback-btn.active {
    background: #e7f3ff;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.bot-popup-message.user .bot-popup-feedback {
    display: none;
}

/* Responsive Design */
@media (max-width: 480px) {
    .bot-popup-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 2px;
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
    }
    
    .bot-popup-container {
        bottom: 10px;
        right: 10px;
    }
}

