/* AI Consulta — frontend styles */

.cai { font-family: 'Titillium Web', system-ui, sans-serif; color: #1a1a1a; margin: 1rem 0; }
.cai__eyebrow {
    font-size: .75rem; letter-spacing: .15em; text-transform: uppercase;
    color: #0b4f9c; margin: 0 0 .4rem 0; font-weight: 600;
}

/* Riassunto */
.cai--riassunto {
    background: #eef4fb; border-left: 4px solid #0b4f9c;
    border-radius: 0 8px 8px 0; padding: .9rem 1.2rem; margin: 0 0 1.5rem 0;
}
.cai--riassunto p { margin: 0; color: #0b1a33; font-style: italic; line-height: 1.5; }
.cai--riassunto p.cai__eyebrow { font-style: normal; }
.cai__loader { color: #94a3b8; }

/* Widget chiedi articolo */
.cai--chiedi {
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 1rem 1.2rem; margin: 2rem 0 1rem 0;
}
.cai__form { display: flex; gap: .5rem; margin-top: .5rem; }
.cai__input {
    flex: 1; padding: .7rem .9rem; border: 1px solid #cbd5e1;
    border-radius: 8px; font: inherit; background: #fff;
}
.cai__input:focus { outline: 2px solid #0b4f9c; outline-offset: 1px; }
.cai__send {
    background: #0b1a33; color: #fff; border: none;
    padding: 0 1.1rem; border-radius: 8px; cursor: pointer;
    font: inherit; font-size: 1.2rem; font-weight: 700;
}
.cai__send:hover { background: #0b4f9c; }

.cai__answer { margin-top: .8rem; }
.cai__answer p { margin: .3rem 0; line-height: 1.5; }
.cai__sources { font-size: .85rem; color: #64748b; margin-top: .5rem; }
.cai__sources a { color: #0b4f9c; }

/* Chat completo */
.cai--chat {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 0; max-height: 70vh; overflow-y: auto; display: flex; flex-direction: column;
}
.cai__chat-header {
    display: flex; align-items: center; gap: .8rem;
    padding: .8rem 1rem; border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #eef4fb, #fff);
    border-radius: 12px 12px 0 0;
}
.cai__avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: #f59e0b; color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
    flex: 0 0 auto;
}
.cai__chat-header strong { color: #0b1a33; font-size: 1.05rem; }
.cai__chat-header small { color: #64748b; font-size: .8rem; }
.cai__chat-header small a { color: #0b4f9c; }
.cai--chat .cai__msg, .cai--chat .cai__form, .cai--chat .cai__hint { margin-left: 1rem; margin-right: 1rem; }
.cai--chat .cai__form { margin-bottom: 1rem; }
.cai--chat .cai__hint { margin-bottom: .8rem; }
.cai--chat .cai__msg:first-of-type { margin-top: 1rem; }

/* ============================
   Eureka — chat full-page (web)
   ============================ */
.eureka-fullpage {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 500px;
    max-width: 820px;
    margin: 1rem auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(11,26,51,.05);
}
.eureka-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1.2rem 1.2rem 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
}
.eureka-empty {
    margin: auto;
    text-align: center;
    padding: 2rem 1rem;
    max-width: 480px;
}
.eureka-empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #fb923c);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem;
    box-shadow: 0 4px 16px rgba(245,158,11,.3);
}
.eureka-empty-title {
    font-family: 'Lora', Georgia, serif;
    font-size: 2rem;
    margin: 0 0 .5rem 0;
    background: linear-gradient(135deg, #0b4f9c, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.eureka-empty-sub {
    color: #64748b;
    font-size: .95rem;
    line-height: 1.5;
    margin: 0 0 1.5rem 0;
}
.eureka-suggestions {
    display: flex; flex-direction: column; gap: .5rem;
}
.eureka-suggestion {
    padding: .8rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font: inherit;
    font-size: .9rem;
    font-style: italic;
    color: #475569;
    text-align: left;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.eureka-suggestion:hover { background: #eef4fb; border-color: #0b4f9c; color: #0b1a33; }
.eureka-refresh {
    margin-top: 1rem;
    padding: .5rem 1.2rem;
    background: transparent;
    border: 1px dashed #cbd5e1;
    border-radius: 100px;
    color: #0b4f9c;
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}
.eureka-refresh:hover { background: #f8fafc; border-color: #0b4f9c; }

.eureka-msg { max-width: 85%; display: flex; }
.eureka-msg-user { align-self: flex-end; justify-content: flex-end; }
.eureka-msg-assistant { align-self: flex-start; }
.eureka-msg-content {
    padding: .7rem 1rem;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}
.eureka-msg-user .eureka-msg-content {
    background: #0b4f9c;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.eureka-msg-assistant .eureka-msg-content {
    background: #f8fafc;
    color: #1a1a1a;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}
.eureka-msg-assistant .eureka-msg-content h1,
.eureka-msg-assistant .eureka-msg-content h2,
.eureka-msg-assistant .eureka-msg-content h3 {
    font-family: 'Lora', Georgia, serif;
    color: #0b4f9c;
    margin: 12px 0 6px;
    font-size: 1.05rem;
}
.eureka-msg-assistant .eureka-msg-content h1:first-child,
.eureka-msg-assistant .eureka-msg-content h2:first-child,
.eureka-msg-assistant .eureka-msg-content h3:first-child { margin-top: 0; }
.eureka-msg-assistant .eureka-msg-content p { margin: 0 0 .5rem; }
.eureka-msg-assistant .eureka-msg-content p:last-child { margin-bottom: 0; }
.eureka-msg-assistant .eureka-msg-content ul { margin: .3rem 0 .5rem; padding-left: 1.2rem; }
.eureka-msg-assistant .eureka-msg-content a { color: #0b4f9c; }

.eureka-typing .eureka-msg-content { padding: 1rem 1.1rem; }
.eureka-dots { display: flex; gap: 4px; }
.eureka-dots span {
    width: 7px; height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: eureka-typing 1.4s infinite ease-in-out;
}
.eureka-dots span:nth-child(2) { animation-delay: .2s; }
.eureka-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes eureka-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: .4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.eureka-input-area {
    display: flex;
    gap: .6rem;
    padding: .8rem 1rem;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    align-items: flex-end;
}
.eureka-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 18px;
    padding: .7rem 1rem;
    font: inherit;
    font-size: 15px;
    resize: none;
    background: #f8fafc;
    color: #1a1a1a;
    min-height: 42px;
    max-height: 200px;
    line-height: 1.4;
}
.eureka-input:focus { outline: 2px solid #0b4f9c; outline-offset: 1px; background: #fff; }
.eureka-send {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0b4f9c, #f59e0b);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
    transition: opacity .15s;
}
.eureka-send:hover { opacity: .9; }
.eureka-send:disabled { background: #94a3b8; cursor: not-allowed; }
.eureka-disclaimer {
    padding: .5rem 1rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: .8rem;
    text-align: center;
    margin: 0;
}
.eureka-disclaimer a { color: #0b4f9c; }

@media (max-width: 640px) {
    .eureka-fullpage { margin: 0; border-radius: 0; border: 0; height: calc(100vh - 120px); }
}
.cai__msg {
    padding: .7rem 1rem; border-radius: 12px;
    max-width: 85%; margin-bottom: .6rem; line-height: 1.5;
}
.cai__msg--bot { background: #eef4fb; color: #0b1a33; align-self: flex-start; }
.cai__msg--user { background: #0b4f9c; color: #fff; align-self: flex-end; }
.cai--chat .cai__form { margin-top: auto; }
.cai__hint { font-size: .8rem; color: #64748b; margin: .5rem 0 0 0; }
