/*
   Corporate -- structured support desk with guided options (PayPal / Bank of America style)
   A solid brand header, cards with an accent edge for the bot's messages and full-width option rows.
   Works with novichat.js (same ids and classes as novichatbot.css). Colors follow data-background-color
   (--main-color); everything else is a --novi-* variable below, so the look is easy to tweak.
   Full screen at 800px and narrower, like the other styles.
*/
:root {
    --preset-top: 96px;
    --preset-left: 96px;
    --main-color: #0b5cab;

    /* font sizes: scale down smoothly with the window */
    --novi-fs-base: clamp(13px, 0.35vw + 11px, 15px);
    --novi-fs-lg: clamp(16px, 0.9vw + 11px, 22px);
    --novi-fs-sm: clamp(11px, 0.2vw + 10px, 12px);
}

/* Colors and shapes of the style. They are declared on #novi-chat-bot as well as :root, because the colors refer to
   --main-color, which novichat.js sets on #novi-chat-bot from data-background-color; declared on :root only they
   would be fixed to the default color of the style. novichat.js also sets any of them there from the plugin's
   data-color-* settings, which then win over the values below. */
:root,
#novi-chat-bot {
    --novi-font: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;

    /* launcher icon */
    --novi-icon-size: 60px;
    --novi-icon-radius: 8px;
    --novi-icon-bg: var(--main-color);
    --novi-icon-color: #fff;
    --novi-icon-shadow: 0 3px 12px rgba(0,0,0,.28);

    /* welcome prompt */
    --novi-prompt-bg: #fff;
    --novi-prompt-color: #1d2733;
    --novi-prompt-border: 1px solid #cfd8e3;
    --novi-prompt-radius: 6px;
    --novi-prompt-shadow: 0 4px 16px rgba(16,24,40,.15);

    /* dialog */
    --novi-dialog-bg: #f4f6f9;
    --novi-dialog-radius: 8px;
    --novi-dialog-border: 1px solid #cfd8e3;
    --novi-dialog-shadow: 0 10px 36px rgba(16,24,40,.25);
    --novi-header-bg: var(--main-color);
    --novi-header-color: #fff;
    --novi-header-padding: 14px 16px;
    --novi-header-border: 0;
    --novi-body-bg: #f4f6f9;
    --novi-footer-bg: #fff;
    --novi-footer-border: 1px solid #cfd8e3;

    /* messages */
    --novi-bot-bg: #fff;
    --novi-bot-color: #1d2733;
    --novi-bot-radius: 6px;
    --novi-bot-border: 1px solid #dde3ec;
    --novi-bot-shadow: 0 1px 2px rgba(16,24,40,.06);
    --novi-user-bg: var(--main-color);
    --novi-user-color: #fff;
    --novi-user-radius: 6px;
    --novi-user-shadow: none;
    --novi-pic-bg: var(--main-color);

    /* reply buttons */
    --novi-btn-bg: #fff;
    --novi-btn-color: var(--main-color);
    --novi-btn-border: 1px solid;
    --novi-btn-border-color: color-mix(in srgb, var(--main-color) 45%, white);
    --novi-btn-radius: 6px;
    --novi-btn-hover-bg: color-mix(in srgb, var(--main-color) 10%, white);
    --novi-btn-hover-color: var(--main-color);

    /* text input and send button */
    --novi-input-bg: #fff;
    --novi-input-color: #1d2733;
    --novi-input-border: 1px solid #b8c4d3;
    --novi-input-radius: 6px;
    --novi-send-bg: var(--main-color);
    --novi-send-color: #fff;
    --novi-send-radius: 6px;
}

/* ---------- launcher icon ---------- */
#novi-chat-bot-icon {
    position: fixed;
    bottom: calc(var(--preset-top) - 64px);
    right: calc(var(--preset-left) - 64px);
    height: var(--novi-icon-size);
    width: var(--novi-icon-size);
    border-radius: var(--novi-icon-radius);
    background: var(--novi-icon-bg);
    color: var(--novi-icon-color);
    box-shadow: var(--novi-icon-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2147483647;
    transition: transform .18s ease, box-shadow .18s ease;
}

    #novi-chat-bot-icon:hover {
        transform: scale(1.06);
    }

    #novi-chat-bot-icon svg {
        padding: 16px;
        width: 100%;
        height: 100%;
    }

/* ---------- welcome prompt ---------- */
#novi-chat-bot-welcome-prompt {
    position: fixed;
    bottom: calc(var(--preset-top) - 18px);
    right: calc(var(--preset-left) - 32px);
    background: var(--novi-prompt-bg);
    color: var(--novi-prompt-color);
    border: var(--novi-prompt-border);
    border-radius: var(--novi-prompt-radius);
    box-shadow: var(--novi-prompt-shadow);
    padding: 12px 14px;
    width: 260px;
    max-width: calc(100vw - var(--preset-left) + 32px - 16px);
    box-sizing: border-box;
    font-family: var(--novi-font);
    font-size: var(--novi-fs-base);
    line-height: 1.4;
    z-index: 2147483646;
}

#novi-chat-bot-welcome-prompt-dismiss-button {
    position: absolute;
    height: 24px;
    width: 24px;
    top: -10px;
    right: -10px;
    background: var(--novi-prompt-bg);
    color: var(--novi-prompt-color);
    border: var(--novi-prompt-border);
    border-radius: 50%;
    cursor: pointer;
    font-size: var(--novi-fs-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.18);
}

    #novi-chat-bot-welcome-prompt-dismiss-button:hover {
        background: var(--main-color);
        color: #fff;
    }

/* optional input in the welcome prompt (data-welcome-input="true") */
.novi-chat-bot-welcome-input {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

    .novi-chat-bot-welcome-input input {
        flex: 1;
        min-width: 0;
        box-sizing: border-box;
        height: 40px;
        padding: 0 14px;
        background: var(--novi-input-bg);
        color: var(--novi-input-color);
        border: var(--novi-input-border);
        border-radius: var(--novi-input-radius);
        font-family: var(--novi-font);
        font-size: 16px; /* 16px: iOS does not zoom in on focus */
        outline: none;
    }

        .novi-chat-bot-welcome-input input:focus {
            border-color: var(--main-color);
        }

#novi-chat-bot-welcome-send {
    flex: 0 0 auto;
    height: 40px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--novi-send-bg);
    color: var(--novi-send-color);
    border-radius: var(--novi-send-radius);
    cursor: pointer;
    transition: transform .15s ease, filter .15s ease;
}

    #novi-chat-bot-welcome-send:hover {
        transform: scale(1.08);
        filter: brightness(1.08);
    }

    #novi-chat-bot-welcome-send svg {
        height: 18px;
        width: 18px;
    }

/* ---------- dialog ---------- */
#novi-chat-bot-dialog {
    display: none;
    position: fixed;
    bottom: calc(var(--preset-top) - 64px);
    right: calc(var(--preset-left) - 64px);
    height: 65%;
    width: 25%;
    flex-direction: column;
    background: var(--novi-dialog-bg);
    border-radius: var(--novi-dialog-radius);
    border: var(--novi-dialog-border);
    box-shadow: var(--novi-dialog-shadow);
    overflow: hidden;
    font-family: var(--novi-font);
    z-index: 2147483646;
}

/* The header is a row: the title takes the room that is left and wraps inside it, the buttons (information, close)
   keep their place on the right whatever the length of the title. */
#novi-chat-bot-dialog-header {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--novi-header-bg);
    color: var(--novi-header-color);
    padding: var(--novi-header-padding);
    border-bottom: var(--novi-header-border);
    font-size: var(--novi-fs-lg);
    font-family: var(--novi-font);
}

    #novi-chat-bot-dialog-header > div:first-child {
        flex: 1 1 auto;
        min-width: 0;
        overflow-wrap: anywhere;
        line-height: 1.25;
        font-family: var(--novi-font);
    }

    /* the buttons come after the title in the page: close is last on the right, information is left of it */
    #novi-chat-bot-dialog-header > .novi-chat-bot-dialog-header-button:nth-child(2) { order: 3; }
    #novi-chat-bot-dialog-header > .novi-chat-bot-dialog-header-button:nth-child(3) { order: 2; }

    /* long titles: a little smaller (novichat.js sets the class from the length of the title) */
    #novi-chat-bot-dialog-header.novi-chat-bot-title-medium > div:first-child { font-size: .9em; }
    #novi-chat-bot-dialog-header.novi-chat-bot-title-long > div:first-child { font-size: .8em; }

.novi-chat-bot-dialog-header-button {
    flex: 0 0 auto;
    cursor: pointer;
    text-align: center;
    width: 30px;
    height: 30px;
    line-height: 30px;
    border-radius: 50%;
    color: inherit;
    transition: background .15s ease;
}

    .novi-chat-bot-dialog-header-button > svg {
        height: 13px;
        width: 13px;
    }

    .novi-chat-bot-dialog-header-button:hover {
        background: rgba(127,127,127,.25);
    }

    .novi-chat-bot-dialog-header-button svg path {
        stroke: currentColor;
    }

    .novi-chat-bot-dialog-header-button svg[data-icon="info"] path {
        fill: currentColor;
    }

#novi-chat-bot-dialog-disclaimer {
    font-family: var(--novi-font);
    font-size: var(--novi-fs-base);
    background: var(--novi-dialog-bg);
    color: var(--novi-bot-color);
    padding: 0;
    overflow: hidden;
    overflow-y: scroll;
    height: 0;
}

#novi-chat-bot-dismiss-disclaimer-button {
    margin: 12px 2px 2px 2px;
    background: var(--novi-btn-bg);
    border: var(--novi-btn-border) var(--novi-btn-border-color);
    color: var(--novi-btn-color);
    padding: 8px 14px;
    border-radius: var(--novi-btn-radius);
    font-size: var(--novi-fs-base);
    cursor: pointer;
    float: right;
}

    #novi-chat-bot-dismiss-disclaimer-button:hover {
        background: var(--novi-btn-hover-bg);
        color: var(--novi-btn-hover-color);
    }

#novi-chat-bot-dialog-body {
    flex: 1;
    background: var(--novi-body-bg);
    overflow-y: auto;
    padding: 6px 0;
}

    #novi-chat-bot-dialog-body::-webkit-scrollbar {
        width: 8px;
    }

    #novi-chat-bot-dialog-body::-webkit-scrollbar-thumb {
        background-color: rgba(127,127,127,.45);
        border-radius: 8px;
    }

/* ---------- waiting dots ---------- */
#novi-chat-bot-dialog-waiting {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 10px;
    background: var(--novi-body-bg);
}

.loading-dots {
    display: flex;
    gap: 8px;
}

    .loading-dots div {
        width: 8px;
        height: 8px;
        background-color: var(--main-color);
        border-radius: 50%;
        animation: bounce 1.4s infinite ease-in-out both;
    }

    .loading-dots .dot1 { animation-delay: -0.32s; }
    .loading-dots .dot2 { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ---------- footer: text input + send ---------- */
#novi-chat-bot-dialog-footer {
    display: flex;
    align-items: center;
    height: 72px;
    padding: 0 12px;
    background: var(--novi-footer-bg);
    border-top: var(--novi-footer-border);
}

    #novi-chat-bot-dialog-footer > div {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        height: 42px;
        width: 42px;
        margin-left: 8px;
        cursor: pointer;
        color: var(--novi-send-color);
        background: var(--novi-send-bg);
        border-radius: var(--novi-send-radius);
        transition: transform .15s ease, filter .15s ease;
    }

        #novi-chat-bot-dialog-footer > div:hover {
            transform: scale(1.06);
            filter: brightness(1.08);
        }

    #novi-chat-bot-dialog-footer svg {
        height: 18px;
        width: 18px;
        padding: 0;
    }

#novi-chat-bot-text-input {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    height: 46px;
    padding: 0 16px;
    background: var(--novi-input-bg);
    color: var(--novi-input-color);
    border: var(--novi-input-border);
    border-radius: var(--novi-input-radius);
    font-family: var(--novi-font);
    font-size: var(--novi-fs-base);
    outline: none;
}

    #novi-chat-bot-text-input:focus,
    #novi-chat-bot-text-input:hover {
        border-color: var(--main-color);
    }

/* ---------- messages ---------- */
.novi-chat-bot-message-bot {
    margin: 8px 10px;
    visibility: hidden;
}

    .novi-chat-bot-message-bot > div:first-child {
        display: flex;
        padding: 10px 12px;
        background: var(--novi-bot-bg);
        color: var(--novi-bot-color);
        border: var(--novi-bot-border);
        border-radius: var(--novi-bot-radius);
        box-shadow: var(--novi-bot-shadow);
    }

.novi-chat-bot-message-bot-pic {
    flex: 0 0 auto;
    height: 32px;
    width: 32px;
    border-radius: 50%;
    margin: auto 10px 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--novi-pic-bg);
}

    .novi-chat-bot-message-bot-pic svg {
        height: 18px;
        width: 18px;
        color: #fff;
    }

.novi-chat-bot-message-bot-text {
    flex: 1;
    font-family: var(--novi-font);
    font-size: var(--novi-fs-base);
    line-height: 1.45;
    color: var(--novi-bot-color);
}

.novi-chat-bot-message-bot-button-wrapper {
    margin: 8px 0 0 0;
}

.novi-chat-bot-message-bot-button {
    margin: 3px 3px 3px 0;
    background: var(--novi-btn-bg);
    color: var(--novi-btn-color);
    border: var(--novi-btn-border) var(--novi-btn-border-color);
    border-radius: var(--novi-btn-radius);
    padding: 8px 14px;
    font-family: var(--novi-font);
    font-size: var(--novi-fs-base);
    text-align: left;
    cursor: pointer;
    outline: none;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}

    .novi-chat-bot-message-bot-button:hover {
        background: var(--novi-btn-hover-bg);
        color: var(--novi-btn-hover-color);
    }

.novi-chat-bot-message-user {
    display: flex;
    flex-direction: row-reverse;
}

.novi-chat-bot-message-user-text {
    margin: 8px 12px 8px 8px;
    padding: 10px 14px;
    max-width: 85%;
    background: var(--novi-user-bg);
    color: var(--novi-user-color);
    border-radius: var(--novi-user-radius);
    box-shadow: var(--novi-user-shadow);
    font-family: var(--novi-font);
    font-size: var(--novi-fs-base);
    line-height: 1.4;
    position: relative;
}

/* ---------- optional launcher looks (data-launcher-label, data-avatar-url) ---------- */
#novi-chat-bot-icon.novi-chat-bot-icon-labelled {
    width: auto;
    min-width: var(--novi-icon-size);
    padding: 0 22px 0 4px;
    border-radius: 999px;
    gap: 4px;
}

    #novi-chat-bot-icon.novi-chat-bot-icon-labelled svg,
    #novi-chat-bot-icon.novi-chat-bot-icon-labelled .novi-chat-bot-avatar {
        flex: 0 0 auto;
        width: var(--novi-icon-size);
        height: var(--novi-icon-size);
    }

.novi-chat-bot-icon-label {
    font-family: var(--novi-font);
    font-size: var(--novi-fs-base);
    font-weight: 600;
    white-space: nowrap;
}

.novi-chat-bot-avatar {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border-radius: 50%;
    object-fit: cover;
}

/* ---------- theme extras ---------- */
.novi-chat-bot-message-bot > div:first-child { border-left: 4px solid var(--main-color); }
.novi-chat-bot-message-bot-button-wrapper { margin-top: 10px; }
/* guided options: one full-width row per option, with a chevron */
.novi-chat-bot-message-bot-button { display: block; width: 100%; margin: 6px 0 0 0; position: relative; padding-right: 30px; font-weight: 600; }
.novi-chat-bot-message-bot-button::after { content: "\203A"; position: absolute; right: 12px; top: 50%; transform: translateY(-52%); font-size: 20px; line-height: 1; }
#novi-chat-bot-dialog-header { font-weight: 600; letter-spacing: .2px; }

/* ---------- size: wider at tablet widths, full screen on mobile ---------- */
@media (max-width: 1200px) {
    #novi-chat-bot-dialog {
        width: 40%;
        min-width: 340px;
    }
}

@media (max-width: 800px) {
    #novi-chat-bot-dialog {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-width: none;
        min-width: 0;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 0;
        border: none;
    }

    #novi-chat-bot-dialog-header,
    #novi-chat-bot-dialog-footer {
        border-radius: 0;
    }

    #novi-chat-bot-text-input {
        font-size: 16px; /* prevents iOS zoom on focus */
    }
}
