/**
 * Stili per il chatbot DSD OpenAI Assistant
 */
 
:root {
    --dsd-theme-color: #e07b39;
}

.dsd-assistant-container {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    background-color: #fff;
    height: 100%;
}

.dsd-assistant-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: var(--dsd-theme-color);
    color: white;
}

.dsd-assistant-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 10px;
}

.dsd-assistant-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dsd-assistant-default-avatar {
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.dsd-assistant-header-info {
    display: flex;
    flex-direction: column;
}

.dsd-assistant-name {
    font-weight: bold;
    font-size: 16px;
}

.dsd-assistant-status {
    font-size: 12px;
    opacity: 0.8;
}

.dsd-assistant-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.dsd-assistant-message {
    max-width: 80%;
    padding: 12px 15px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
}

.dsd-assistant-message.user {
    align-self: flex-end;
    background-color: var(--dsd-theme-color);
    color: white;
    border-bottom-right-radius: 5px;
}

.dsd-assistant-message.assistant {
    align-self: flex-start;
    background-color: #f1f1f1;
    color: #333;
    border-bottom-left-radius: 5px;
}

/* Messaggi di stato/errore più eleganti */
.dsd-assistant-message.status {
    background-color: #f8f9fa;
    border-left: 3px solid #4a90e2;
    padding-left: 12px;
    font-style: italic;
    color: #555;
    align-self: center;
    max-width: 90%;
    border-radius: 5px;
}

.dsd-assistant-message.error {
    background-color: #fff9f9;
    border-left: 3px solid #e74c3c;
    padding-left: 12px;
    color: #e74c3c;
    align-self: center;
    max-width: 90%;
    border-radius: 5px;
}

.dsd-assistant-input-container {
    display: flex;
    padding: 10px;
    border-top: 1px solid #e0e0e0;
    background-color: #f9f9f9;
}

.dsd-assistant-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    width: calc(100% - 60px);
}

.dsd-assistant-send {
    margin-left: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: var(--dsd-theme-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.dsd-assistant-send:hover {
    background-color: #d06a29;
}

.dsd-assistant-send:disabled {
    background-color: #e0e0e0;
    cursor: not-allowed;
}

/* Stili per la chat bubble e container */
.dsd-assistant-bubble {
    position: fixed;
    bottom: 20px;
    right: 80px;
    z-index: 9999;
    width: auto;
    height: auto;
    border-radius: 30px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}


.dsd-assistant-bubble:hover {
    transform: scale(1.1);
}

.dsd-assistant-bubble-text {
    color: white;
    font-weight: bold;
    font-size: 16px;
    margin-right: 8px;
    white-space: nowrap;
}

/* Adattiamo l'icona per il nuovo layout */
.dsd-assistant-bubble-icon,
.dsd-assistant-close-icon {
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dsd-assistant-chat-container {
    position: fixed;
    bottom: 90px;
    width: 350px;
    height: 500px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
    background-color: #fff;
    z-index: 9998;
    display: flex;
    flex-direction: column;
}

.dsd-assistant-close {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.dsd-assistant-close:hover {
    opacity: 1;
}

/* Stili migliorati per l'indicatore di digitazione */
.dsd-assistant-typing-indicator {
    display: inline-flex;
    align-items: center;
}

.dsd-assistant-typing-info {
    margin-left: 10px;
    font-size: 13px;
    color: #666;
}

/* Animazione migliorata per l'indicatore di digitazione */
.dsd-assistant-typing-indicator span {
    width: 8px;
    height: 8px;
    margin: 0 2px;
    background-color: #999;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite both;
}

.dsd-assistant-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.dsd-assistant-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}
/* Stili per l'indicatore di digitazione migliorato */
.dsd-assistant-typing-indicator {
    display: inline-flex;
    align-items: center;
}

.dsd-assistant-typing-info {
    margin-left: 8px;
    font-size: 13px;
    color: #666;
}

.dsd-assistant-typing-detail {
    margin-top: 4px;
    font-size: 12px;
    font-style: italic;
    color: #888;
}

/* Messaggi di stato/errore più eleganti */
.dsd-assistant-message.status {
    background-color: #f8f9fa;
    border-left: 3px solid #4a90e2;
    padding-left: 12px;
    font-style: italic;
    color: #555;
    align-self: center;
    max-width: 90%;
    border-radius: 5px;
}

.dsd-assistant-message.error {
    background-color: #fff9f9;
    border-left: 3px solid #e74c3c;
    padding-left: 12px;
    color: #e74c3c;
    align-self: center;
    max-width: 90%;
    border-radius: 5px;
}

/* Animazione migliorata per l'indicatore di digitazione */
.dsd-assistant-typing-indicator span {
    width: 8px;
    height: 8px;
    margin: 0 2px;
    background-color: #999;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite both;
}

.dsd-assistant-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.dsd-assistant-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0% {
        opacity: 0.4;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-5px);
    }
    100% {
        opacity: 0.4;
        transform: translateY(0);
    }
}

/* Posizionamento dell'icona fluttuante */
.dsd-assistant-bubble.bottom-right,
.dsd-assistant-floating.bottom-right {
    right: 100px;
}

.dsd-assistant-bubble.bottom-left,
.dsd-assistant-floating.bottom-left {
    left: 20px;
}

.dsd-assistant-chat-container.bottom-right,
.dsd-assistant-popup.bottom-right {
    right: 20px;
}

.dsd-assistant-chat-container.bottom-left,
.dsd-assistant-popup.bottom-left {
    left: 20px;
}

/* Stile per il modulo di contatto */
.dsd-assistant-contact-form {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
}

.dsd-assistant-contact-form input,
.dsd-assistant-contact-form textarea {
    margin-bottom: 8px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.dsd-assistant-contact-form textarea {
    min-height: 80px;
    resize: vertical;
}

.dsd-assistant-contact-submit {
    padding: 10px;
    border: none;
    border-radius: 5px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}

.dsd-assistant-contact-submit:hover {
    opacity: 0.9;
}

.dsd-assistant-contact-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Link più visibili nei messaggi dell'assistente */
.dsd-assistant-message.assistant a {
    color: #0066cc;
    text-decoration: underline;
    font-weight: 500;
}

.dsd-assistant-message.assistant a:hover {
    text-decoration: none;
    color: #004499;
}

/* Messaggio di timeout con azione chiara */
.dsd-assistant-timeout-message {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dsd-assistant-timeout-action {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 13px;
    text-align: center;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.dsd-assistant-timeout-action:hover {
    background-color: #e9ecef;
    color: #333;
}

/* Responsive */
@media (max-width: 480px) {
    .dsd-assistant-chat-container,
    .dsd-assistant-popup {
        width: calc(100% - 40px);
        bottom: 80px;
    }
     .dsd-assistant-bubble {
        width: auto;
        height: auto;
        bottom: 20px;
        right: 50%;
        transform: translateX(50%);
        padding: 10px 16px;
    }
    
    .dsd-assistant-bubble-text {
        font-size: 14px;
    }
}