/* Ocean Partners AI Agent — Modal CSS v3.0
   Centrado, sin avatar, Instrument Serif, disclaimer footer */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap');

/* ── BACKDROP + WRAPPER ────────────────────────────────────── */
.opaia-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.opaia-modal[hidden] { display: none; }

.opaia-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.opaia-modal.is-open {
    pointer-events: auto;
}
.opaia-modal.is-open .opaia-modal__backdrop {
    opacity: 1;
}

/* ── PANEL ─────────────────────────────────────────────────── */
.opaia-modal__panel {
    position: relative;
    z-index: 1;
    background: #fff;
    width: min(640px, 92vw);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.96) translateY(8px);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
    overflow: hidden;
    border-radius: 2px;
}
.opaia-modal.is-open .opaia-modal__panel {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ── CLOSE BUTTON ──────────────────────────────────────────── */
.opaia-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background 0.15s;
    z-index: 2;
    padding: 0;
}
.opaia-modal__close:hover { background: #e0e0e0; }

/* ── TITLE ─────────────────────────────────────────────────── */
.opaia-modal__title {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-size: clamp(22px, 4vw, 30px);
    color: #1a1a1a;
    text-align: center;
    margin: 36px 48px 24px;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

/* ── MESSAGES ──────────────────────────────────────────────── */
.opaia-modal__messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 32px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Bubbles — solo del agente visible, usuario más sutil */
.opaia-msg--assistant .opaia-msg__bubble {
    background: #f2f2f2;
    color: #1a1a1a;
    font-size: 15px;
    line-height: 1.6;
    padding: 14px 18px;
    border-radius: 4px;
    text-align: center;
    max-width: 100%;
}
.opaia-msg--user .opaia-msg__bubble {
    background: #1a1a1a;
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    padding: 10px 14px;
    border-radius: 4px;
    align-self: flex-end;
    max-width: 85%;
    margin-left: auto;
}

/* ── TYPING ─────────────────────────────────────────────────── */
.opaia-modal__typing {
    display: flex;
    padding: 4px 32px 12px;
    gap: 5px;
    align-items: center;
    justify-content: center;
}
.opaia-modal__typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #bbb;
    animation: opaia-dot 1.2s infinite ease-in-out;
}
.opaia-modal__typing span:nth-child(2) { animation-delay: 0.2s; }
.opaia-modal__typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes opaia-dot {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40%            { transform: scale(1);   opacity: 1; }
}

/* ── LEAD FORM ─────────────────────────────────────────────── */
.opaia-modal__lead-form {
    margin: 0 32px 12px;
    background: #f8f9ff;
    border: 1px solid #dce4ff;
    border-radius: 6px;
    padding: 16px;
}
.opaia-lead-form__title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 10px;
}
.opaia-lead-form__fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.opaia-lead-form__fields input {
    padding: 9px 12px;
    font-size: 13px;
    border: 1.5px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}
.opaia-lead-form__fields input:focus { border-color: #1a1a1a; outline: none; }
.opaia-lead-form__error {
    color: #dc2626;
    font-size: 12px;
    min-height: 16px;
    margin: 4px 0;
}
.opaia-lead-form__consent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 10px 0 2px;
    font-size: 12px;
    line-height: 1.45;
    color: #555;
    cursor: pointer;
}
.opaia-lead-form__consent input[type="checkbox"] {
    margin-top: 2px;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: #1a1a1a;
    cursor: pointer;
}
.opaia-lead-form__consent a { color: #1a1a1a; text-decoration: underline; }
.opaia-lead-form__submit {
    margin-top: 8px;
    width: 100%;
    padding: 10px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}
.opaia-lead-form__submit:hover    { background: #333; }
.opaia-lead-form__submit:disabled { background: #999; cursor: default; }
.opaia-lead-form__skip {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: #888;
    text-decoration: underline;
    cursor: pointer;
}
.opaia-lead-form__skip:hover { color: #555; }

/* ── INPUT AREA ─────────────────────────────────────────────── */
.opaia-modal__form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 32px 8px;
    border-top: 1px solid #ebebeb;
    flex-shrink: 0;
}
.opaia-modal__input {
    flex: 1;
    resize: none;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    padding: 10px 13px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    max-height: 100px;
    overflow-y: auto;
    transition: border-color 0.15s;
}
.opaia-modal__input:focus { border-color: #1a1a1a; outline: none; }
.opaia-modal__send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #8a7b4e;
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}
.opaia-modal__send:hover    { background: #7a6b3e; }
.opaia-modal__send:disabled { background: #ccc; cursor: default; }

/* ── DISCLAIMER ─────────────────────────────────────────────── */
.opaia-modal__disclaimer {
    text-align: center;
    font-size: 11px;
    color: #aaa;
    padding: 8px 32px 14px;
    flex-shrink: 0;
    line-height: 1.4;
}
.opaia-modal__disclaimer a {
    color: #888;
    text-decoration: underline;
}
.opaia-modal__disclaimer a:hover { color: #555; }

/* ── MOBILE ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .opaia-modal__panel {
        width: 100vw;
        max-height: 90vh;
        border-radius: 12px 12px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        transform: translateY(20px);
    }
    .opaia-modal.is-open .opaia-modal__panel {
        transform: translateY(0);
    }
    .opaia-modal__title  { font-size: 22px; margin: 28px 40px 18px; }
    .opaia-modal__messages,
    .opaia-modal__form,
    .opaia-modal__disclaimer { padding-left: 20px; padding-right: 20px; }
}
