/* AI Consigliere Frontend Styles */

.aic-wrap {
    border: 3px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    height: 100%;
}

#aic-chat-widget {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
	border-radius: 10px;
    border: 3px solid #e2e8f0;
    position: relative;
}

.aic-header {
    padding: 10px 12px;
    background: #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}

.aic-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

#aic-new-chat-btn {
    background: #fff;
    color: #333;
    border: 1px solid #cbd5e1;
    padding: 8px 16px;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s;
}

#aic-new-chat-btn:hover {
    background: #f8fafc;
}

#aic-messages {
    height: 400px;
    max-height: 520px;
    overflow-y: auto;
    padding: 14px;
    background: #fff;
}

.aic-message {
    display: flex;
    gap: 8px;
    margin: 12px 0;
    animation: fadeIn 0.3s;
    flex-direction: column;
}

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

.aic-user {
    margin-left: auto;
    max-width: 85%;
    background: #e6f0ff;
    border: 1px solid #cfe0ff;
    border-radius: 10px 10px 0 10px;
    padding: 10px;
    color: #333;
}

.aic-assistant {
    margin-right: auto;
    max-width: 85%;
    background: #f5f7fa;
    border: 1px solid #e6ecf3;
    border-radius: 10px 10px 10px 0;
    padding: 10px;
    color: #333;
}

.aic-assistant.aic-streaming {
    white-space: pre-wrap;
}

.aic-assistant p, .aic-user p {
    margin: 0 0 8px;
}

.aic-assistant p:last-child, .aic-user p:last-child {
    margin-bottom: 0;
}

.aic-thinking {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.aic-thinking span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.2s infinite;
}

.aic-thinking span:nth-child(1) { animation-delay: -0.32s; }
.aic-thinking span:nth-child(2) { animation-delay: -0.16s; }

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

.aic-product-skeleton {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid #eee;
    border-radius: 10px;
    background: #fafafa;
    vertical-align: middle;
    margin-top: 8px;
    margin-left: -2px;
}

.aic-skel-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #e9e9e9;
    display: inline-block;
}

.aic-skel-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.aic-skel-line {
    display: block;
    width: 160px;
    height: 10px;
    background: #e9e9e9;
    border-radius: 6px;
}

.aic-skel-line.short {
    width: 90px;
}

#aic-suggestions {
    padding: 12px 16px 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    background: #fff;
    position: absolute;
    width: 65%;
}

#aic-suggestions:empty {
    display: none;
}

.aic-suggestion-chip {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    background: #dde5ed;
    color: #2D3440;
    padding: 8px 8px 8px 25px;
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    text-transform: none !important;
    letter-spacing: 0 !important;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background .15s, border-color .15s;
    text-wrap-mode: wrap;
    text-align: left;
    position: relative;
    border: none;
}

.aic-suggestion-chip::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 13px;
    height: 13px;
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 0C12 0 11.5 6.5 9 9C6.5 11.5 0 12 0 12C0 12 6.5 12.5 9 15C11.5 17.5 12 24 12 24C12 24 12.5 17.5 15 15C17.5 12.5 24 12 24 12C24 12 17.5 11.5 15 9C12.5 6.5 12 0 12 0Z' fill='%23445060'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.aic-suggestion-chip:hover {
    background: #cbd5e1;
}

.aic-input-area {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: white;
    border: 3px solid transparent;
    background: linear-gradient(white, white) padding-box, 
                linear-gradient(to right, #b6c6db, #8f2bdb) border-box;
    border-radius: 10px;
    margin: 20px;
    margin-bottom: 20px !important;
}

#aic-input {
    flex: 1;
    padding: 10px;
    border: none;
    height: 45px;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
}

#aic-input::placeholder {
    opacity: 0.5;
}

#aic-send-btn {
    background: #4E0364;
    color: #fff;
    border: 1px solid #4E0364;
    padding: 10px 14px;
    height: 45px;
    border-radius: 100px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

#aic-send-btn:hover:not(:disabled) {
    background: #3a0249;
}

#aic-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Product Line */
.ai-product-preview {
    margin: 10px 0;
    padding: 12px;
    border: 1px solid #d6dbe2;
    border-radius: 6px;
    background-color: #fff;
    transition: box-shadow 0.2s;
}

.ai-product-preview:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ai-product-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.ai-product-link a {
    display: flex !important;
}

.ai-product-link img {
    max-width: 120px;
    width: 100px;
    height: auto;
    border-radius: 5px;
    object-fit: cover;
}

.ai-product-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 6px;
}

.ai-product-info br {
    display: none;
}

.ai-product-title {
    font-weight: bold;
    font-size: 16px;
    margin: 0;
}

.ai-product-title a {
    color: inherit;
    text-decoration: none;
}

.ai-product-price {
    color: #444;
    font-size: 14px;
    font-weight: 600;
}

.ai-product-price del .amount {
    color: #888;
    font-weight: normal;
}

.ai-product-price ins .amount {
    font-size: 16px;
    text-decoration: none;
}

.ai-product-desc {
    font-size: 13px;
    color: #555;
}

.ai-cta-button {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    font-weight: 600;
    font-size: 14px;
    background: #333;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    transition: background .2s ease;
    width: fit-content;
}

.ai-cta-button:hover {
    background: #111;
    color: #fff;
}

/* Floating Button */
#aic-floating-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: transform 0.2s;
}

#aic-floating-btn:hover {
    transform: scale(1.1);
}

#aic-floating-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
}

#aic-floating-widget {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 9999;
    display: none;
}

#aic-floating-widget.aic-open {
    display: block;
    animation: slideUp 0.3s;
}

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

/* Responsive */
@media (max-width: 768px) {
    #aic-chat-widget {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    #aic-floating-widget {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
    }
}

/* Error and Retry */
.aic-error {
    color: #c53030;
    font-style: italic;
    display: block;
    margin-bottom: 10px;
}

.aic-retry-btn {
    appearance: none;
    -webkit-appearance: none;
    background: #4E0364;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.aic-retry-btn::before {
    content: '↻';
    font-size: 16px;
}

.aic-retry-btn:hover {
    background: #3a0249;
}
