/**
 * Cytracon ChatBox Styles
 *
 * @category  Cytracon
 * @package   Cytracon_ChatBox
 * @author    Cytracon
 * @copyright Copyright (c) 2025 Cytracon
 */

.chatbox-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Toggle Button */
.chatbox-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.chatbox-icon,
.chatbox-close-icon {
    width: 28px;
    height: 28px;
    color: white;
}

.chatbox-close-icon {
    display: none;
}

.chatbox-open .chatbox-icon {
    display: none;
}

.chatbox-open .chatbox-close-icon {
    display: block;
}

/* Chat Window */
.chatbox-window {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chatbox-open .chatbox-window {
    display: flex;
}

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

.chatbox-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chatbox-minimize {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbox-minimize:hover {
    opacity: 0.8;
}

.chatbox-minimize svg {
    width: 20px;
    height: 20px;
}

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

.chatbox-message {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

.chatbox-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.4;
    word-wrap: break-word;
    font-size: 12px;
}

.chatbox-message-user {
    justify-content: flex-end;
}

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

.chatbox-message-assistant {
    justify-content: flex-start;
}

.chatbox-message-assistant .chatbox-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    font-size: 12px;
}

.chatbox-message-error .chatbox-message-content {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
    font-size: 12px;
}

/* Markdown Formatting */
.chatbox-message-content h1,
.chatbox-message-content h2,
.chatbox-message-content h3 {
    margin: 8px 0 6px 0;
    font-weight: 600;
    line-height: 1.3;
}

.chatbox-message-content h1 {
    font-size: 14px;
}

.chatbox-message-content h2 {
    font-size: 13px;
}

.chatbox-message-content h3 {
    font-size: 12px;
}

.chatbox-message-content a {
    color: #667eea;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.chatbox-message-content a:hover {
    color: #764ba2;
}

.chatbox-message-content strong {
    font-weight: 600;
}

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

.chatbox-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

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

.chatbox-message-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 12px 0;
}

/* Product Suggestions */
.chatbox-products {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
    padding: 8px 0;
}

.chatbox-product {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.chatbox-product:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.chatbox-product-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    gap: 12px;
    padding: 12px;
}

.chatbox-product-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    background: #f9fafb;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbox-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbox-product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.chatbox-product-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chatbox-product-description {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chatbox-product-price-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

.chatbox-product-price {
    color: #667eea;
    font-weight: 700;
    font-size: 16px;
}

.chatbox-product-price-special {
    color: #dc2626;
    font-weight: 700;
    font-size: 16px;
}

.chatbox-product-price-old {
    color: #9ca3af;
    font-size: 13px;
    text-decoration: line-through;
    font-weight: 500;
}

/* Feedback Buttons */
.chatbox-feedback-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
}

.chatbox-feedback-btn {
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbox-feedback-btn svg {
    width: 16px;
    height: 16px;
    color: #6b7280;
}

.chatbox-feedback-btn:hover {
    border-color: #667eea;
    background: #f9fafb;
}

.chatbox-feedback-btn:hover svg {
    color: #667eea;
}

.chatbox-feedback-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbox-feedback-submitted {
    background: #667eea !important;
    border-color: #667eea !important;
}

.chatbox-feedback-submitted svg {
    color: white !important;
}

.chatbox-feedback-thanks {
    font-size: 12px;
    color: #10b981;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

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

/* Quick Actions */
.chatbox-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding: 0 4px;
}

.chatbox-quick-action-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.chatbox-quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.chatbox-quick-action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

/* Customer Quick Action Buttons */
.chatbox-quick-action-customer {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbox-quick-action-customer .customer-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Quick Actions Separator */
.chatbox-quick-actions-separator {
    width: 100%;
    height: 1px;
    background: rgba(102, 126, 234, 0.2);
    margin: 4px 0;
}

/* Loading Indicator */
.chatbox-loading {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.chatbox-loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: bounce 1.4s infinite ease-in-out both;
}

.chatbox-loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.chatbox-loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Input */
.chatbox-input-wrapper {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.chatbox-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    max-height: 120px;
    overflow-y: auto;
}

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

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

.chatbox-send:hover {
    transform: scale(1.05);
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbox-container {
        bottom: 10px;
        left: 10px;
    }

    .chatbox-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
    }

    .chatbox-toggle {
        width: 56px;
        height: 56px;
    }
}
