/* =========================================
   MARKETING AI - WIDGET FLOTANTE
   ========================================= */

#marketing-ai-widget,
#marketing-ai-widget * {
    box-sizing: border-box;
}

#marketing-ai-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: #024152;
    color: #faf9f2;
    cursor: pointer;
    z-index: 999998;

    display: flex;
    align-items: center;
    justify-content: center;

    font-family: "Sora", Arial, sans-serif;
    font-size: 25px;

    box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
    transition: transform .2s ease, box-shadow .2s ease;
}

#marketing-ai-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 34px rgba(0, 0, 0, .24);
}

#marketing-ai-launcher .ai-dot {
    position: absolute;
    right: 2px;
    top: 2px;

    width: 14px;
    height: 14px;

    border-radius: 50%;
    border: 2px solid #faf9f2;

    background: #cbd901;
}

/* PANEL */

#marketing-ai-panel {
    position: fixed;
    right: 24px;
    bottom: 96px;

    width: min(430px, calc(100vw - 32px));
    height: min(680px, calc(100vh - 125px));

    background: #faf9f2;

    border-radius: 18px;
    overflow: hidden;

    z-index: 999999;

    display: flex;
    flex-direction: column;

    font-family: "Sora", Arial, sans-serif;

    box-shadow: 0 18px 60px rgba(0, 0, 0, .22);

    opacity: 0;
    visibility: hidden;
    transform: translateY(15px) scale(.98);

    transition:
        opacity .2s ease,
        transform .2s ease,
        visibility .2s;
}

#marketing-ai-panel.ai-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* CABECERA */

.marketing-ai-header {
    background: #024152;
    color: #faf9f2;

    padding: 18px 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.marketing-ai-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.marketing-ai-logo {
    width: 38px;
    height: 38px;

    border-radius: 10px;

    background: #cbd901;
    color: #024152;

    display: flex;
    align-items: center;
    justify-content: center;

    font-weight: 700;
    font-size: 18px;
}

.marketing-ai-title {
    font-size: 14px;
    font-weight: 600;
}

.marketing-ai-status {
    margin-top: 3px;

    font-size: 11px;
    opacity: .75;
}

.marketing-ai-close {
    background: transparent;
    border: 0;

    color: #faf9f2;

    font-size: 23px;
    cursor: pointer;

    opacity: .75;
}

.marketing-ai-close:hover {
    opacity: 1;
}

/* CONTEXTO */

.marketing-ai-context {
    padding: 10px 16px;

    background: rgba(203, 217, 1, .12);
    border-bottom: 1px solid rgba(2, 65, 82, .08);

    font-size: 11px;
    color: #024152;

    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.marketing-ai-context strong {
    font-weight: 600;
}

.marketing-ai-refresh {
    border: 0;
    background: transparent;

    color: #024152;

    cursor: pointer;

    font-family: inherit;
    font-size: 11px;

    text-decoration: underline;
}

/* MENSAJES */

#marketing-ai-messages {
    flex: 1;

    padding: 18px;

    overflow-y: auto;

    display: flex;
    flex-direction: column;
    gap: 14px;
}

.marketing-ai-message {
    max-width: 88%;

    padding: 11px 14px;

    border-radius: 14px;

    font-size: 13px;
    line-height: 1.55;

    white-space: pre-wrap;
}

.marketing-ai-message.user {
    align-self: flex-end;

    background: #024152;
    color: #faf9f2;

    border-bottom-right-radius: 4px;
}

.marketing-ai-message.assistant {
    align-self: flex-start;

    background: #ffffff;
    color: #17343c;

    border: 1px solid rgba(2, 65, 82, .08);

    border-bottom-left-radius: 4px;
}

.marketing-ai-message.loading {
    opacity: .65;
}

/* ACCIONES */

.marketing-ai-actions {
    display: flex;
    gap: 7px;

    padding: 0 16px 12px;

    overflow-x: auto;
}

.marketing-ai-action {
    flex-shrink: 0;

    padding: 7px 10px;

    border-radius: 20px;
    border: 1px solid rgba(2, 65, 82, .15);

    background: transparent;
    color: #024152;

    font-family: inherit;
    font-size: 10px;

    cursor: pointer;
}

.marketing-ai-action:hover {
    background: #024152;
    color: #faf9f2;
}

/* INPUT */

.marketing-ai-input-area {
    padding: 12px 14px 14px;

    background: #ffffff;

    border-top: 1px solid rgba(2, 65, 82, .08);
}

.marketing-ai-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;

    padding: 8px 8px 8px 13px;

    border: 1px solid rgba(2, 65, 82, .18);
    border-radius: 14px;

    background: #faf9f2;
}

#marketing-ai-input {
    flex: 1;

    resize: none;

    border: 0;
    outline: none;

    background: transparent;

    min-height: 24px;
    max-height: 100px;

    font-family: inherit;
    font-size: 13px;

    color: #17343c;
}

#marketing-ai-send {
    width: 34px;
    height: 34px;

    flex-shrink: 0;

    border: 0;
    border-radius: 10px;

    background: #cbd901;
    color: #024152;

    cursor: pointer;

    font-size: 16px;
    font-weight: 700;
}

#marketing-ai-send:disabled {
    opacity: .45;
    cursor: default;
}

.marketing-ai-disclaimer {
    margin-top: 7px;

    text-align: center;

    color: #7b898d;

    font-size: 9px;
}

/* MÓVIL */

@media (max-width: 600px) {

    #marketing-ai-launcher {
        right: 16px;
        bottom: 16px;
    }

    #marketing-ai-panel {
        right: 8px;
        bottom: 84px;

        width: calc(100vw - 16px);
        height: calc(100vh - 100px);

        border-radius: 15px;
    }
}