/* Widget chat benessere (pagina prenota) — cartella dedicata prenota-chatbot */

#wellness-chat-open-btn {
    position: fixed;
    right: 1rem;
    bottom: 5.5rem;
    z-index: 1030;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #fff;
    box-shadow: 0 8px 24px rgba(5, 150, 105, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: grab;
    /* Niente pan/scroll del browser sul pulsante: il drag funziona su iOS/Android */
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

#wellness-chat-open-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 28px rgba(5, 150, 105, 0.45);
    color: #fff;
}

#wellness-chat-open-btn.wellness-chat-fab--dragging {
    cursor: grabbing;
    transform: none;
    transition: none;
    touch-action: none;
}

/* Touch: bersaglio più comodo e meno errori tap vs drag */
@media (max-width: 767.98px), (pointer: coarse) {
    #wellness-chat-open-btn {
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1.5rem;
    }
}

/* --- Modale --- */
.wellness-chat-modal-shell {
    border-radius: 22px;
    overflow: hidden;
    background: linear-gradient(180deg, #fafbfc 0%, #ffffff 120px);
}

.wellness-chat-modal-header {
    background: linear-gradient(135deg, rgba(236, 253, 245, 0.9) 0%, rgba(255, 255, 255, 0.5) 100%);
    border-bottom: 1px solid rgba(16, 185, 129, 0.15);
}

.wellness-chat-modal-body {
    padding-top: 0.25rem;
}

/* Blocco informativo sotto il titolo (non consulenza medica + abbonamento + sede) */
.wellness-chat-intro-box {
    padding: 0.65rem 0.85rem;
    background: rgba(79, 70, 229, 0.06);
    border: 1px solid rgba(79, 70, 229, 0.12);
    border-radius: 12px;
    line-height: 1.45;
    color: #334155;
}

.wellness-chat-intro-line {
    line-height: 1.5;
}

.wellness-chat-intro-line strong {
    font-weight: 700;
    color: #1e293b;
}

/* «Prima di scrivere» */
.wellness-chat-lead {
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #4f46e5;
    line-height: 1.5;
}

.wellness-chat-lead__kicker {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #4f46e5;
    margin-bottom: 0.35rem;
}

.wellness-chat-lead__text {
    font-size: 0.9rem;
    color: #334155;
    margin: 0;
}

/* Barra compatta quando accesso + età sono ok: più spazio alla chat */
.wellness-chat-compact-strip-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: 10px;
    font-size: 0.8rem;
    color: #065f46;
}

.wellness-chat-compact-text {
    min-width: 0;
    flex: 1;
}

#wellness-chat-modal.wellness-chat-modal--chat-focus .wellness-chat-intro-box {
    display: none;
}

.wellness-chat-modal-body--ready #wellness-chat-messages {
    min-height: 240px;
    max-height: min(58vh, 520px);
}

/* Passaggi */
.wellness-chat-step {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.85rem 1rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.wellness-chat-step-label {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 0.65rem;
}

.wellness-chat-step-badge {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.wellness-chat-step-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
    display: block;
}

.wellness-chat-step-hint {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.4;
    margin-top: 0.15rem;
}

.wellness-chat-panel {
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.45;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.wellness-chat-panel--ok {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.wellness-chat-panel--warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #78350f;
    display: block;
}

.wellness-chat-panel--warn .small {
    color: #92400e;
}

/* Età */
.wellness-chat-age-card {
    border-radius: 12px;
    padding: 0.85rem 1rem;
    background: linear-gradient(145deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid #86efac;
}

.wellness-chat-age-card.wellness-chat-age-card--locked {
    opacity: 0.55;
    pointer-events: none;
    background: #f8fafc;
    border-color: #e2e8f0;
}

.wellness-chat-form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #14532d;
    margin-bottom: 0.35rem;
}

.wellness-chat-age-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
}

.wellness-chat-age-field {
    max-width: 7rem;
    min-height: 42px;
    border-radius: 10px;
    border: 1px solid #bbf7d0;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
}

.wellness-chat-age-btn {
    border-radius: 10px;
    font-weight: 600;
    padding-left: 1rem;
    padding-right: 1rem;
    min-height: 42px;
}

.wellness-chat-chat-section {
    margin-top: 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
}

.wellness-chat-chat-label {
    margin-bottom: 0.5rem;
}

.wellness-chat-chat-label__text {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #475569;
}

body.prenota-kinetic .wellness-chat-chat-label__text {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}

#wellness-chat-modal.wellness-chat-modal--chat-focus .wellness-chat-chat-section {
    border-top-color: transparent;
    padding-top: 0.35rem;
}

#wellness-chat-messages {
    min-height: 200px;
    max-height: min(42vh, 320px);
    overflow-y: auto;
    padding: 0.65rem;
    background: #f8fafc;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.75rem;
    scroll-behavior: smooth;
}

.wellness-chat-compose .form-control {
    border-radius: 14px;
}

.wellness-chat-send-btn {
    border-radius: 12px;
    min-width: 3rem;
    min-height: 3rem;
}

.wellness-chat-bubble {
    display: flex;
    margin-bottom: 0.65rem;
}

.wellness-chat-bubble--user {
    justify-content: flex-end;
}

.wellness-chat-bubble-inner {
    max-width: 88%;
    padding: 0.55rem 0.85rem;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.wellness-chat-bubble--user .wellness-chat-bubble-inner {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.wellness-chat-bubble--model .wellness-chat-bubble-inner {
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

/* Caricamento risposta AI */
.wellness-chat-loading-inner {
    display: flex;
    align-items: center;
    min-height: 2.5rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.wellness-chat-loading-dots {
    display: inline-flex;
    gap: 7px;
    align-items: center;
}

.wellness-chat-loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748b;
    animation: wellness-chat-dot 1.15s infinite ease-in-out both;
}

.wellness-chat-loading-dots span:nth-child(1) {
    animation-delay: 0ms;
}

.wellness-chat-loading-dots span:nth-child(2) {
    animation-delay: 140ms;
}

.wellness-chat-loading-dots span:nth-child(3) {
    animation-delay: 280ms;
}

@keyframes wellness-chat-dot {
    0%,
    70%,
    100% {
        transform: translateY(0);
        opacity: 0.35;
    }
    35% {
        transform: translateY(-5px);
        opacity: 1;
    }
}
