/* EmpatiBot Public Styles */

:root {
    --empatibot-color: #0066cc;
    --empatibot-width: 400px;
    --empatibot-height: 600px;
}

/* Toggle Button */
.empatibot-toggle {
    position: fixed;
    bottom: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--empatibot-color);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 999999;
}

.empatibot-position-right .empatibot-toggle {
    right: 20px;
}

.empatibot-position-left .empatibot-toggle {
    left: 20px;
}

.empatibot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.empatibot-toggle svg {
    width: 30px;
    height: 30px;
    color: white;
}

/* Chatbox */
.empatibot-chatbox {
    position: fixed;
    bottom: 90px;
    width: var(--empatibot-width);
    height: var(--empatibot-height);
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: none;
    flex-direction: column;
    z-index: 999998;
    overflow: hidden;
}

.empatibot-position-right .empatibot-chatbox {
    right: 20px;
}

.empatibot-position-left .empatibot-chatbox {
    left: 20px;
}

.empatibot-chatbox.empatibot-visible {
    display: flex;
}

.empatibot-shortcode .empatibot-chatbox {
    position: relative;
    bottom: auto;
    right: auto;
    left: auto;
    margin: 20px auto;
}

/* Header */
.empatibot-header {
    background-color: var(--empatibot-color);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.empatibot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.empatibot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
}

.empatibot-bot-name {
    font-weight: 600;
    font-size: 16px;
}

.empatibot-header-actions {
    display: flex;
    gap: 8px;
}

.empatibot-header-actions button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.empatibot-header-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.empatibot-header-actions svg {
    width: 18px;
    height: 18px;
    color: white;
}

/* Messages Area */
.empatibot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
}

.empatibot-message {
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.empatibot-message.bot {
    text-align: left;
}

.empatibot-message.user {
    text-align: right;
}

.empatibot-message-content {
    display: inline-block;
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
}

.empatibot-message.bot .empatibot-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
}

.empatibot-message.bot .empatibot-message-content.empatibot-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    border-bottom-left-radius: 4px;
}

.empatibot-message.user .empatibot-message-content {
    background: var(--empatibot-color);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Package Cards */
.empatibot-package-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-top: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.empatibot-package-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.empatibot-package-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.empatibot-package-name {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.empatibot-package-description {
    margin: 10px 0;
    padding: 10px;
    background: #f9f9f9;
    border-left: 3px solid var(--empatibot-color);
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.empatibot-package-products {
    margin-top: 10px;
}

.empatibot-product-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.empatibot-product-item:last-child {
    border-bottom: none;
}

.empatibot-product-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.empatibot-product-info {
    flex: 1;
}

.empatibot-product-name {
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.empatibot-product-price {
    font-size: 13px;
    color: #77a464;
    font-weight: 600;
}

.empatibot-package-total {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid #eee;
    text-align: right;
    font-weight: 600;
    color: var(--empatibot-color);
}

.empatibot-package-actions {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
}

.empatibot-add-package-to-cart {
    background-color: var(--empatibot-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.empatibot-add-package-to-cart:hover {
    background-color: var(--empatibot-color);
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.empatibot-add-package-to-cart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Product Cards */
.empatibot-product-card {
    background: white;
    border-radius: 8px;
    padding: 10px;
    margin-top: 8px;
    display: flex;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s;
    position: relative;
}

.empatibot-product-card:hover {
    transform: translateX(5px);
}

/* Product card wrapper for add-to-cart layout */
.empatibot-product-card-wrapper {
    margin-top: 8px;
}

.empatibot-product-card-wrapper .empatibot-product-card {
    margin-top: 0;
}

.empatibot-product-actions {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

.empatibot-add-product-to-cart {
    background-color: var(--empatibot-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.empatibot-add-product-to-cart:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.empatibot-add-product-to-cart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.empatibot-product-card.best-match {
    border: 2px solid #ffd700;
    background: linear-gradient(135deg, #fffef9 0%, #ffffff 100%);
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.2);
}

.empatibot-best-match-badge {
    position: absolute;
    top: -8px;
    right: 10px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #333;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Input Area */
.empatibot-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#empatibot-user-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    max-height: 100px;
    outline: none;
}

#empatibot-user-input:focus {
    border-color: var(--empatibot-color);
}

.empatibot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--empatibot-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.empatibot-send-btn:hover {
    background-color: var(--empatibot-color);
    opacity: 0.9;
}

.empatibot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.empatibot-send-btn svg {
    width: 20px;
    height: 20px;
    color: white;
}

/* Typing Indicator */
.empatibot-typing {
    display: inline-flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.empatibot-typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.empatibot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.empatibot-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;
    }
}

/* Scrollbar */
.empatibot-messages::-webkit-scrollbar {
    width: 6px;
}

.empatibot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.empatibot-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.empatibot-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 768px) {
    .empatibot-chatbox {
        width: var(--empatibot-width-mobile, calc(100vw - 20px)) !important;
        height: var(--empatibot-height-mobile, calc(100vh - 20px)) !important;
        bottom: 10px;
        max-width: 100vw;
        max-height: calc(100vh - 20px);
    }

    .empatibot-position-right .empatibot-chatbox {
        right: 10px;
        left: auto;
    }

    .empatibot-position-left .empatibot-chatbox {
        left: 10px;
        right: auto;
    }
    
    .empatibot-toggle {
        bottom: 10px;
    }

    .empatibot-position-right .empatibot-toggle {
        right: 10px;
        left: auto;
    }

    .empatibot-position-left .empatibot-toggle {
        left: 10px;
        right: auto;
    }
}
