.eni-ai-widget {
    --eni-ai-primary: #193c62;
    --eni-ai-muted: #64748b;
    --eni-ai-border: #dce5ef;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9990;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}

.eni-ai-widget *,
.eni-ai-widget *::before,
.eni-ai-widget *::after {
    box-sizing: border-box;
}

.eni-ai-widget [hidden] {
    display: none !important;
}

.eni-ai-widget button {
    font: inherit;
    cursor: pointer;
}

.eni-ai-launcher {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-left: auto;
    border: 0;
    border-radius: 40px;
    padding: 16px 21px;
    background: var(--eni-ai-primary);
    color: #fff;
    box-shadow: 0 8px 26px #193c6240;
    font-weight: 600 !important;
}

.eni-ai-launcher svg {
    width: 25px;
    height: 25px;
}

.eni-ai-panel {
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100dvh - 110px);
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--eni-ai-border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 16px 55px #0f172a30;
}

.eni-ai-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    background: var(--eni-ai-primary);
    color: #fff;
}

.eni-ai-avatar {
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    border-radius: 50%;
    background: #ffffff19;
}

.eni-ai-avatar svg {
    width: 26px;
    height: 26px;
}

.eni-ai-heading {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.eni-ai-heading strong {
    font-size: 17px;
}

.eni-ai-heading small {
    color: #dbeafe;
    font-size: 11px;
}

.eni-ai-close {
    border: 0;
    background: transparent;
    color: white;
    font-size: 28px !important;
    padding: 0 8px;
}

.eni-ai-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-bottom: 1px solid var(--eni-ai-border);
}

.eni-ai-preview {
    font-size: 9px;
    font-weight: 700;
    color: #925300;
}

.eni-ai-languages {
    display: flex;
    gap: 4px;
    background: #edf2f7;
    border-radius: 8px;
    padding: 3px;
}

.eni-ai-languages button {
    border: 0;
    background: transparent;
    padding: 5px 9px;
    border-radius: 6px;
    color: var(--eni-ai-muted);
    font-size: 11px;
    font-weight: 700;
}

.eni-ai-languages button[aria-pressed="true"] {
    background: #fff;
    color: var(--eni-ai-primary);
    box-shadow: 0 1px 5px #0001;
}

.eni-ai-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.eni-ai-message {
    padding: 13px 15px;
    border-radius: 14px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 13px;
}

.eni-ai-message.assistant {
    background: #eef3f8;
    color: #193c62;
    align-self: flex-start;
}

.eni-ai-message.user {
    background: var(--eni-ai-primary);
    color: #fff;
    align-self: flex-end;
    max-width: 90%;
}

.eni-ai-suggestions {
    display: grid;
    gap: 8px;
}

.eni-ai-suggestions button {
    width: 100%;
    padding: 11px 12px;
    text-align: left;
    background: #fff;
    border: 1px solid var(--eni-ai-border);
    border-radius: 10px;
    color: var(--eni-ai-primary);
    font-size: 12px;
}

.eni-ai-suggestions button:hover {
    background: #f0f5fa;
    border-color: #9fb5ca;
}

.eni-ai-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 0 12px;
    padding: 8px;
    border: 1px solid var(--eni-ai-border);
    border-radius: 13px;
}

.eni-ai-form textarea {
    flex: 1;
    min-width: 0;
    min-height: 38px;
    max-height: 100px;
    padding: 9px;
    border: 0;
    background: #fff;
    resize: none;
    outline: none;
    font: inherit;
    font-size: 13px;
    color: #193c62;
}

.eni-ai-send {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: var(--eni-ai-primary);
}

.eni-ai-send svg {
    width: 19px;
    height: 19px;
}

.eni-ai-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 12px;
    color: var(--eni-ai-muted);
    font-size: 10px;
}

.eni-ai-links {
    display: flex;
    justify-content: center;
    gap: 17px;
    margin-bottom: 3px;
}

.eni-ai-footer a {
    color: var(--eni-ai-primary);
    text-decoration: none;
}

.eni-ai-links a {
    font-size: 12px;
    font-weight: 600;
}

.eni-ai-widget button:focus-visible,
.eni-ai-widget a:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
}

.eni-ai-form:focus-within {
    border-color: #2563eb;
}

@media (max-width: 600px) {
    .eni-ai-widget {
        right: 12px;
        bottom: max(12px, env(safe-area-inset-bottom));
    }

    .eni-ai-panel {
        width: calc(100vw - 24px);
        max-width: none;
        max-height: calc(100dvh - 95px);
        height: 620px;
    }

    .eni-ai-launcher {
        padding: 14px;
        width: 58px;
        height: 58px;
    }

    .eni-ai-launcher span {
        display: none;
    }
}

/* Controles conversation */

.eni-ai-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--eni-ai-border);
    font-size: 10px;
    color: var(--eni-ai-muted);
}

.eni-ai-controls button {
    border: 0;
    border-radius: 6px;
    padding: 6px 8px;
    background: #edf2f7;
    color: var(--eni-ai-primary);
    font-size: 11px;
    font-weight: 600;
}

.eni-ai-widget button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.eni-ai-messages {
    scrollbar-width: thin;
    scrollbar-color: #b7c8da transparent;
}

.eni-ai-loading {
    color: var(--eni-ai-muted);
    font-style: italic;
}

.eni-ai-loading::after {
    content: ' ...';
    animation: eni-ai-pulse 1.2s ease-in-out infinite;
}

@keyframes eni-ai-pulse {
    0%, 100% { opacity: .25; }
    50% { opacity: 1; }
}

.eni-ai-message.eni-ai-error {
    background: #fff3e5;
    color: #854d0e;
}

@media (prefers-reduced-motion: reduce) {
    .eni-ai-loading::after {
        animation: none;
    }
}

/* Presentation des reponses commerciales */

.eni-ai-message.assistant {
    max-width: 100%;
    min-width: 0;
    white-space: normal;
}

.eni-ai-message.assistant[data-ai-welcome] {
    white-space: pre-wrap;
}

.eni-ai-message p {
    margin: 0 0 9px;
}

.eni-ai-message p:last-child {
    margin-bottom: 0;
}

.eni-ai-message strong {
    font-weight: 700;
}

.eni-ai-message ul,
.eni-ai-message ol {
    margin: 8px 0 12px;
    padding-left: 20px;
}

.eni-ai-message li {
    margin-bottom: 6px;
}

.eni-ai-message a {
    color: #174b85;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

.eni-ai-answer-heading {
    display: block;
    margin: 12px 0 8px;
    font-size: 14px;
}

.eni-ai-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid #d5e0eb;
    border-radius: 8px;
    background: #fff;
}

.eni-ai-table-wrap table {
    border-collapse: collapse;
    width: 100%;
    font-size: 11px;
    line-height: 1.5;
}

.eni-ai-table-wrap th {
    padding: 8px;
    text-align: left;
    background: #193c62;
    color: #fff;
    font-weight: 600;
}

.eni-ai-table-wrap td {
    padding: 8px;
    vertical-align: top;
    border-bottom: 1px solid #e2e8f0;
}

.eni-ai-table-wrap tr:last-child td {
    border-bottom: 0;
}

.eni-ai-table-wrap tbody tr:nth-child(even) {
    background: #f3f6fa;
}


/* ENI MISPRO - Interface finale */

#eni-ai-widget {
    --eni-navy: #142e49;
    --eni-blue: #2167aa;
    --eni-border: #dce5ef;
    --eni-muted: #64748b;
    font-family: inherit;
}

#eni-ai-panel {
    border: 1px solid var(--eni-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 65px rgba(15,35,60,.23);
    overflow: hidden;
    max-width: calc(100vw - 28px);
    max-height: calc(100dvh - 100px);
}

#eni-ai-panel[hidden] {
    display: none !important;
}

#eni-ai-widget button {
    transition: background-color .18s ease,
                box-shadow .18s ease;
}

#eni-ai-widget button:focus-visible,
#eni-ai-widget a:focus-visible,
#eni-ai-widget textarea:focus-visible {
    outline: 2px solid #2876bd;
    outline-offset: 3px;
}

#eni-ai-panel textarea {
    border: 1px solid #cbd9e8;
    border-radius: 12px;
    padding: 12px;
    font-size: 15px;
    line-height: 1.5;
}

#eni-ai-panel textarea:focus {
    border-color: #2167aa;
}

#eni-ai-panel a {
    color: #155b9c;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

#eni-ai-panel table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin: 12px 0;
    background: #fff;
}

#eni-ai-panel th {
    background: #eaf1f8;
    color: #142e49;
    text-align: left;
}

#eni-ai-panel th,
#eni-ai-panel td {
    border: 1px solid #dce5ef;
    padding: 8px;
    overflow-wrap: anywhere;
}

#eni-ai-panel tbody tr:nth-child(even) {
    background: #f7f9fc;
}

#eni-ai-panel p {
    line-height: 1.6;
}

#eni-ai-widget .eni-ai-launcher {
    box-shadow: 0 8px 26px rgba(20,46,73,.25);
    border-radius: 50px;
}

#eni-ai-widget .eni-ai-message {
    line-height: 1.55;
    overflow-wrap: anywhere;
}

@media (min-width: 769px) {

    #eni-ai-panel {
        width: 440px;
        max-width: calc(100vw - 40px);
    }

}

@media (max-width: 768px) {

    #eni-ai-panel {
        position: fixed;
        right: 12px;
        bottom: 80px;
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        max-height: calc(100dvh - 100px);
        border-radius: 16px;
    }

    #eni-ai-panel textarea {
        font-size: 16px;
    }

    #eni-ai-panel th,
    #eni-ai-panel td {
        padding: 6px;
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {

    #eni-ai-widget *,
    #eni-ai-widget *::before,
    #eni-ai-widget *::after {
        animation: none !important;
        transition: none !important;
    }

}


/* Masquer le mode preview en production */
#eni-ai-widget[data-preview="0"] [data-ai-preview] {
    display: none !important;
}
