/* Cuttalo AI25 - Chat Widget Styles */

.cuttalo-ai25-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    z-index: 9999;
}

/* Posizionamento floating */
.cuttalo-ai25-position-bottom-right {
    position: fixed;
    bottom: 20px;
    right: 20px;
}

.cuttalo-ai25-position-bottom-left {
    position: fixed;
    bottom: 20px;
    left: 20px;
}

/* Pulsante floating */
.cuttalo-ai25-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #FF6B35;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.cuttalo-ai25-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.cuttalo-ai25-button-icon {
    fill: white;
}

.cuttalo-ai25-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #FF3B30;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

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

.cuttalo-ai25-position-bottom-left .cuttalo-ai25-chat-window {
    right: auto;
    left: 0;
}

.cuttalo-ai25-position-inline .cuttalo-ai25-chat-window {
    position: relative;
    bottom: auto;
    right: auto;
    margin: 0 auto;
}

/* Header */
.cuttalo-ai25-chat-header {
    background: #FF6B35;
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cuttalo-ai25-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cuttalo-ai25-bot-avatar {
    font-size: 28px;
    line-height: 1;
}

.cuttalo-ai25-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.cuttalo-ai25-header-text p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

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

.cuttalo-ai25-close-button:hover {
    background: rgba(255,255,255,0.2);
}

/* Messages area */
.cuttalo-ai25-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cuttalo-ai25-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
    animation: messageSlide 0.3s ease-out;
}

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

.cuttalo-ai25-message-bot {
    background: #FF6B3515;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.cuttalo-ai25-message-user {
    background: #E9ECEF;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.cuttalo-ai25-message a {
    color: #FF6B35;
    text-decoration: underline;
}

/* Input area */
.cuttalo-ai25-input-area {
    padding: 16px 20px;
    border-top: 1px solid #E9ECEF;
    display: flex;
    gap: 8px;
    align-items: center;
}

.cuttalo-ai25-input {
    flex: 1;
    border: 1px solid #E9ECEF;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.cuttalo-ai25-input:focus {
    border-color: #FF6B35;
}

.cuttalo-ai25-send-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #FF6B35;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.cuttalo-ai25-send-button:hover:not(:disabled) {
    transform: scale(1.05);
}

.cuttalo-ai25-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Typing indicator - Enhanced */
.cuttalo-ai25-typing {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 18px;
    background: #FF6B3515;
    border-radius: 12px;
    align-self: flex-start;
    max-width: 250px;
    border-bottom-left-radius: 4px;
}

.cuttalo-ai25-typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.cuttalo-ai25-typing-dots span {
    width: 8px;
    height: 8px;
    background: #FF6B35;
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.cuttalo-ai25-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.cuttalo-ai25-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.cuttalo-ai25-typing-text {
    font-size: 11px;
    color: #666;
    font-style: italic;
    opacity: 0;
    animation: fadeInText 0.5s ease-in forwards;
    animation-delay: 1s;
}

.cuttalo-ai25-typing-progress {
    width: 100%;
    height: 3px;
    background: #E9ECEF;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.cuttalo-ai25-typing-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #FF6B35, #FF8C5A);
    border-radius: 2px;
    animation: progressGrow 12s ease-out forwards;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

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

@keyframes progressGrow {
    from {
        width: 0%;
    }
    to {
        width: 90%;
    }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .cuttalo-ai25-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        bottom: 10px;
        right: 10px;
    }

    .cuttalo-ai25-position-bottom-right,
    .cuttalo-ai25-position-bottom-left {
        right: 10px;
        left: auto;
    }
}
/* Header con avatar SVG */
.cuttalo-ai25-bot-avatar-wrapper {
    position: relative;
}

.cuttalo-ai25-bot-avatar {
    width: 40px;
    height: 40px;
    color: #FF6B35;
}

.cuttalo-ai25-status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #4caf50;
    border: 2px solid #fff;
    border-radius: 50%;
}

.cuttalo-ai25-status-text {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cuttalo-ai25-status-dot {
    width: 6px;
    height: 6px;
    background: #4caf50;
    border-radius: 50%;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Messaggi con avatar e timestamp */
.cuttalo-ai25-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.cuttalo-ai25-message-user {
    flex-direction: row-reverse;
}

.cuttalo-ai25-message-avatar {
    flex-shrink: 0;
    color: #666;
}

.cuttalo-ai25-message-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.cuttalo-ai25-message-text {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
}

.cuttalo-ai25-message-bot .cuttalo-ai25-message-text {
    background: #FF6B3515;
    border-bottom-left-radius: 4px;
}

.cuttalo-ai25-message-user .cuttalo-ai25-message-text {
    background: #E9ECEF;
    border-bottom-right-radius: 4px;
}

.cuttalo-ai25-message-time {
    font-size: 10px;
    color: #999;
    padding: 0 4px;
}

.cuttalo-ai25-message-user .cuttalo-ai25-message-time {
    text-align: right;
}

/* Input con textarea */
.cuttalo-ai25-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 6px;
}

.cuttalo-ai25-input {
    resize: none;
    min-height: 44px;
    max-height: 120px;
    line-height: 1.4;
    font-family: inherit;
}

.cuttalo-ai25-input-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.cuttalo-ai25-char-counter {
    font-size: 10px;
    color: #999;
    white-space: nowrap;
}

.cuttalo-ai25-char-counter.warning {
    color: #ff5722;
    font-weight: 600;
}

.cuttalo-ai25-send-button svg {
    fill: #fff;
}

.cuttalo-ai25-input-hint {
    font-size: 10px;
    color: #999;
    text-align: center;
    font-style: italic;
}

/* Typing dentro messages */
.cuttalo-ai25-typing .cuttalo-ai25-message-avatar {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.cuttalo-ai25-typing-wrapper {
    padding: 14px 18px;
    background: #FF6B3515;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 250px;
}
