/* ═══════════════════════════════════════════════════════════════════
   Visit Lido — AI Assistant (chat UI custom, no widget DocsBot)
   Stili coerenti con pannello esistente #ai_wrapper / #ai_panel
   ═══════════════════════════════════════════════════════════════════ */

/* ── Layout chat dentro #ai_content > .container ── */
.lido-ai-chat {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: 100%;
    color: var(--black);
    font-family: "Graphik", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}

/* ── Header chat (eventuale; minimal) ── */
.lido-ai-header {
    flex: 0 0 auto;
    padding: 0 0 20px;
}

.lido-ai-header h2 {
    margin: 0;
    font-weight: 500;
    font-size: min(max(20px, 2.24vw), 42px);
    line-height: 120%;
    color: var(--black);
}

/* ── Messaggi (scroll area) ── */
.lido-ai-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0;
    position: relative;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.lido-ai-messages::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

/* Gradient fade in alto */
.lido-ai-messages::before {
    content: "";
    position: sticky;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 30px;
    margin-bottom: -30px;
    background: linear-gradient(180deg, var(--sand), transparent);
    pointer-events: none;
    z-index: 2;
}

/* ── Turn ── */
.lido-ai-turn {
    display: flex;
    margin-bottom: 24px;
}

.lido-ai-turn--user {
    justify-content: flex-end;
}

.lido-ai-turn--bot {
    justify-content: flex-start;
}

.lido-ai-bubble {
    max-width: 100%;
    font-weight: 400;
    font-size: min(max(18px, 1.25vw), 24px);
    line-height: 140%;
    color: var(--black);
}

.lido-ai-turn--user .lido-ai-bubble {
    color: #444;
    font-style: italic;
}

.lido-ai-turn--bot .lido-ai-bubble {
    width: 100%;
}

/* ── Text inside bot bubble ── */
.lido-ai-text p {
    margin: 0 0 0.8em;
}

.lido-ai-text p:last-child {
    margin-bottom: 0;
}

.lido-ai-text strong {
    font-weight: 500;
    color: var(--black);
}

.lido-ai-text h2,
.lido-ai-text h3 {
    margin: 1em 0 0.4em;
    font-weight: 500;
    color: var(--black);
}

.lido-ai-text h2 { font-size: 1.15em; }
.lido-ai-text h3 { font-size: 1.05em; }

.lido-ai-text ul,
.lido-ai-text ol {
    padding-left: 1.2em;
    margin: 0.5em 0 0.8em;
}

.lido-ai-text li {
    margin-bottom: 0.6em;
}

.lido-ai-text code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.9em;
    padding: 0.1em 0.4em;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* ── Link ── */
.lido-ai-link {
    color: var(--main);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.lido-ai-link:hover {
    text-decoration-thickness: 2px;
}

/* ── Anteprima immagine ── */
.lido-ai-img {
    display: block;
    max-width: 320px;
    width: 100%;
    height: auto;
    margin: 0.6em 0;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.04);
}

/* ── Typing dots ── */
.lido-ai-dots {
    display: inline-flex;
    gap: 6px;
    padding: 8px 0;
}

.lido-ai-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--main);
    opacity: 0.5;
    animation: lidoAiBounce 1.2s infinite ease-in-out;
}

.lido-ai-dots span:nth-child(2) { animation-delay: 0.15s; }
.lido-ai-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes lidoAiBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40%           { transform: translateY(-6px); opacity: 1; }
}

/* ── Streaming cursor ── */
.lido-ai-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 2px;
    background: var(--main);
    vertical-align: text-bottom;
    animation: lidoAiBlink 1s infinite step-end;
}

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

/* ── Suggestion buttons (Approfondisci:) ── */
.lido-ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 1.2em;
}

.lido-ai-suggestion {
    margin: 0;
    padding: 10px 16px;
    font-family: inherit;
    font-weight: 400;
    font-size: 14px;
    line-height: 130%;
    color: var(--main);
    text-align: left;
    background-color: transparent;
    border: 1px solid var(--main);
    border-radius: 50px;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.lido-ai-suggestion:hover {
    color: var(--white);
    background-color: var(--main);
}

.lido-ai-suggestion:focus-visible {
    outline: 2px solid var(--main);
    outline-offset: 2px;
}

/* ── Error + retry ── */
.lido-ai-error {
    color: #b00020;
}

.lido-ai-retry {
    margin-top: 10px;
    padding: 10px 20px;
    font-weight: 500;
    font-size: 13px;
    line-height: 100%;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--main);
    background: transparent;
    border: 1px solid var(--main);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease-in;
}

.lido-ai-retry:hover {
    color: var(--white);
    background-color: var(--main);
}

/* ── Pills (suggested prompts) ── */
.lido-ai-pills {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0 16px;
    justify-content: center;
}

.lido-ai-pills--hidden {
    display: none;
}

.lido-ai-pill {
    margin: 0;
    padding: 12px 20px;
    font-weight: 400;
    font-size: 15px;
    line-height: 140%;
    color: #000;
    text-align: center;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    box-shadow: 2px 2px 15px rgba(199, 199, 199, 0.26);
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.lido-ai-pill:hover {
    color: var(--black);
    border-color: #ddd;
    background-color: #fafafa;
}

/* ── Input bar ── */
.lido-ai-inputbar {
    flex: 0 0 auto;
    position: relative;
    padding-top: 10px;
    background: linear-gradient(0deg, var(--sand) 0%, var(--sand) 70%, transparent 100%);
}

.lido-ai-input-row {
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    align-items: stretch;
    border-bottom: 1px solid var(--main);
}

.lido-ai-input {
    width: 100%;
    min-height: 20px;
    padding: 1em 0 0.5em;
    color: var(--main);
    font-family: inherit;
    font-size: min(max(18px, 1.25vw), 24px);
    line-height: 1.3;
    background: transparent;
    border: 0;
    outline: none;
    resize: none;
    overflow-y: auto;
}

.lido-ai-input::placeholder {
    color: var(--main);
    opacity: 0.5;
}

.lido-ai-input:focus-visible {
    outline: none;
}

.lido-ai-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin: 15px 0;
}

.lido-ai-send,
.lido-ai-clear {
    all: unset;
    cursor: pointer;
    padding: 15px 20px 14px;
    font-weight: 500;
    font-size: 12px;
    line-height: 100%;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--main);
    background-color: transparent;
    border: 1px solid var(--main);
    border-radius: 50px;
    transition: all 0.3s ease-in;
}

.lido-ai-send:hover:not(:disabled),
.lido-ai-clear:hover {
    color: var(--white);
    background-color: var(--main);
}

.lido-ai-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.lido-ai-clear {
    color: #888;
    border-color: #ccc;
}

.lido-ai-clear:hover {
    color: var(--white);
    background-color: #888;
    border-color: #888;
}

/* ── Container Lido (#ai_content > .container) — fix layout fluid ── */
#ai_content > .container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
}

/* ── Responsive ── */
@media screen and (max-width: 767px) {
    .lido-ai-pills {
        flex-direction: column;
    }

    .lido-ai-pill {
        width: 100%;
    }

    .lido-ai-img {
        max-width: 100%;
    }
}