.cp-widget {
    position: fixed;
    bottom: 20px;
    width: 380px;
    height: 640px;
    background: #fff;
    border-radius: 14px;
    z-index: 999999;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
    overflow: hidden;
    flex-direction: column;
    display: flex;

    max-height: calc(100vh - 40px);

    transform: translateY(60px) scale(0.85);
    opacity: 0;
    pointer-events: none;

    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.cp-widget.cp-ready {
    transition: transform 0.4s cubic-bezier(0.22, 1.3, 0.36, 1), opacity 0.3s ease;
}

.cp-widget.visible {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.cp-widget.expanded {
    width: 520px;
    height: 720px;
    right: 20px;
    bottom: 20px;
    border-radius: 14px;
}

.cp-launcher {
    position: fixed;
    bottom: 20px;
    width: 4rem;
    height: 4rem;
    visibility: hidden;
    background: #2D3948;
    color: #fff;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    z-index: 999999;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cp-launcher:hover {
    transform: scale(1.08);
    background: #3F4E5F;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
}

.cp-launcher-icon {
    width: 30px;
    height: 30px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cp-launcher-icon-chat {
    transform: translateY(2px);
}

.cp-launcher-icon-mail {
    transform: translateY(1px);
}

.cp-launcher-icon-bot {
    transform: translateY(1px);
}

.cp-launcher-icon-send {
    transform: translateY(2px);

}



/* HEADER */
.cp-header {
    padding: 20px 14px 9px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    /*background: #1f2a33;*/
    background: linear-gradient(135deg,
            #516274 0%,
            #344256 100%);

    color: #fff;
    flex-shrink: 0;
}

/* PRAWA GÓRA — przyciski */
.cp-header-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
}

/* TEKST */
.cp-header-text {
    display: flex;
    flex-direction: column;
    padding-top: 20px;
}

/* TOP BAR */
.cp-header-top {
    display: flex;
    align-items: center;
}

/* MAIN (avatar + text) */
.cp-header-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 8px;
}

/* ikonki */
.cp-header-icon {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s ease;
}

.cp-header-icon:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* header buttons */
.cp-menu-dropdown {
    position: absolute;
    top: 50px;
    right: 10px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 6px;
    display: none;
    flex-direction: column;
    min-width: 160px;
    z-index: 999999;
}

.cp-menu-dropdown.visible {
    display: flex;
}

.cp-menu-item {
    background: none;
    border: none;
    padding: 8px 10px;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
}

.cp-menu-item:hover {
    background: #f3f4f6;
}















/* prawa strona */
.cp-header-buttons {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.cp-avatar {
    width: 56px;
    height: 56px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: transparent;

    overflow: visible;
}

.cp-avatar.is-circle {
    border-radius: 50%;
    overflow: hidden;
}

.cp-avatar-img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: contain;
}

.cp-avatar.is-circle .cp-avatar-img {
    object-fit: cover;
}

/* tekst */
.cp-title {
    font-size: 18px;
    font-weight: 600;
}

.cp-status {
    font-size: 12px;
    opacity: 0.85;
}

.cp-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    margin-right: 3px;
}

/* BODY */
.cp-body {
    flex: 1 1 auto;
    height: 0;
    min-height: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}


#cp-messages {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 14px 20px 14px;

}

/* ROW */
.cp-message-row {
    display: flex;
    margin-bottom: 12px;
}

/* ALIGN */
.cp-message-row.visitor {
    justify-content: flex-end;
}

.cp-message-row.operator,
.cp-message-row.ai {
    justify-content: flex-start;
}

/* BUBBLE BASE */
.cp-message-bubble {
    max-width: 72%;
    min-width: 40px;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

#cp-messages> :first-child {
    margin-top: 6px;
}

/* VISITOR (prawo) */
.cp-message-bubble.visitor {
    background: linear-gradient(135deg,
            #3F4E5F 0%,
            #2D3948 100%);
    color: #fff;
    border-bottom-right-radius: 6px;
    font-weight: 350;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: 0.1px;
}

/* OPERATOR / AI (lewo) */
.cp-message-bubble.operator,
.cp-message-bubble.ai {
    background: #f1f3f7;
    color: #111;
    border-bottom-left-radius: 6px;
}

/* SYSTEM (opcjonalne) */
.cp-message-bubble.system {
    background: #eee;
    color: #666;
    font-size: 12px;
    text-align: center;
    margin: 0 auto;
}

#cp-automation {
    display: none !important;
    flex-shrink: 0;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
}

#cp-automation.visible {
    display: block;
}

/* INPUT 
.cp-input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px;
    background: #fff;
    flex-shrink: 0;
} */

.cp-input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px;
    background: #fff;
    flex: 0 0 auto;
    flex-shrink: 0;
    box-sizing: border-box;
}

.cp-input textarea {
    flex: 1;
    resize: none;
    border: none;
    outline: none;
    background: #f1f3f7;
    border-radius: 16px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: auto;
}

.cp-input button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #2D3948;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background 0.2s ease;
}

.cp-input button:hover {
    transform: scale(1.05);
    background: #3F4E5F
}

/* FOOTER */
.cp-footer {
    flex: 0 0 auto;
    font-size: 11px;
    text-align: center;
    padding: 6px;
    color: #aaa;

    flex-shrink: 0;
}



/* dymek reguły */
.cp-teaser {
    position: fixed;
    bottom: 95px;
    max-width: 260px;
    padding: 12px 14px;
    background: #fff;
    color: #111;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    z-index: 999999;

    animation: cpFadeInUp 0.4s ease, cpBounce 0.6s ease 0.4s;
}

.cp-teaser::after {
    content: "";
    position: absolute;
    bottom: -6px;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
}

.cp-teaser.cp-pos-right::after {
    right: 22px;
    left: auto;
}

.cp-teaser.cp-pos-left::after {
    left: 22px;
    right: auto;
}

.cp-teaser-text {
    position: relative;
    z-index: 1;
}

.cp-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 10px;
    height: 10px;
    background: #ff3b3b;
    border-radius: 50%;
    display: none;
}

@keyframes cpFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cpBounce {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }

    100% {
        transform: translateY(0);
    }
}

.cp-teaser.hide {
    animation: cpFadeOut 0.3s ease forwards;
}

@keyframes cpFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(10px);
    }
}



.cp-flow-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 12px 0;
}

.cp-flow-content {
    max-width: 78%;
}

.cp-flow-bubble {
    background: #f1f4f8;
    border-radius: 18px 18px 18px 6px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.45;
    color: #111;
}

.cp-flow-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.cp-flow-button {
    border: 1px solid var(--cp-primary, #2563eb);
    color: var(--cp-primary, #2563eb);
    background: #fff;
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.cp-flow-button:hover {
    background: var(--cp-primary, #2563eb);
    color: #fff;
}

.cp-flow-user-choice {
    display: flex;
    justify-content: flex-end;
    margin: 10px 0;
}

.cp-flow-user-bubble {
    max-width: 75%;
    background: #1f2a33;
    color: #fff;
    border-radius: 18px 18px 6px 18px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.4;
}


/* SVG icon */
.cp-send-icon {
    width: 23px;
    height: 23px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.0;
}

/* focus efekt */
.cp-input textarea:focus {
    outline: none;
}


.cp-input textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px #1f2a33;
}

/* Typing */
.cp-typing {
    min-height: 18px;
    padding: 0 14px 2px;
    font-size: 12px;
    margin-top: -4px;
    color: #7c8490;
    font-style: italic;
    flex-shrink: 0;
}

.cp-typing:not(:empty)::after {
    content: "";
    display: inline-block;
    width: 16px;
    animation: cpTypingDots 1.2s infinite;
}

@keyframes cpTypingDots {
    0% {
        content: "";
    }

    33% {
        content: ".";
    }

    66% {
        content: "..";
    }

    100% {
        content: "...";
    }
}



#cp-new-msg-indicator {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    color: #fff;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    z-index: 999;
    white-space: nowrap;
}


/* =====================================================
   WIDGET POSITION
   ===================================================== */

.cp-widget.cp-pos-right {
    right: 20px;
    left: auto;
}

.cp-widget.cp-pos-left {
    left: 20px;
    right: auto;
}

.cp-launcher.cp-pos-right {
    right: 20px;
    left: auto;
}

.cp-launcher.cp-pos-left {
    left: 20px;
    right: auto;
}

.cp-teaser.cp-pos-right {
    right: 20px;
    left: auto;
}

.cp-teaser.cp-pos-left {
    left: 20px;
    right: auto;
}


/* =====================================================
   WIDGET COLOR
   ===================================================== */

.widget-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.widget-color-preset,
.widget-color-custom {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid #dbe3ef;
    background: var(--preset-color, #fff);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.widget-color-preset:hover,
.widget-color-custom:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

.widget-color-preset.active,
.widget-color-custom.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.widget-color-custom {
    background: #ffffff;
    color: #2563eb;
    font-size: 22px;
    font-weight: 500;
    position: relative;
}

.widget-color-custom input[type="color"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.widget-color-hex {
    width: 120px;
    margin-left: auto;
}

.widget-gradient-row {
    width: fit-content;
    min-width: 280px;
    margin-top: 14px;
}

.widget-gradient-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
    color: #475569;
}

.widget-gradient-value {
    font-weight: 600;
    color: #0f172a;
}

.widget-gradient-range {
    width: 280px;
    accent-color: var(--admin-primary, #2563eb);
}




.widget-color-layout {
    display: grid;

    grid-template-columns: 1fr 290px;
    grid-template-rows: auto auto;

    column-gap: 32px;
    row-gap: 18px;

    align-items: start;
}

.widget-color-row {
    grid-column: 1;
    grid-row: 1;
}

.widget-main-color-column {
    grid-column: 2;
    grid-row: 1;
}

.widget-main-color-column {
    grid-column: 2;
    grid-row: 1;

    position: relative;
}

.widget-main-color-description {
    position: absolute;
    top: -28px;
    left: 0;
}

.widget-main-color-input-row {
    display: flex;
    align-items: center;
}

.widget-gradient-row {
    grid-column: 1;
    grid-row: 2;
}

.widget-text-color-column {
    grid-column: 2;
    grid-row: 2;

    display: flex;
    flex-direction: column;
    align-items: flex-start;

}


.widget-text-color-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;

    margin-top: 6px;
}


.widget-text-color-preset {
    width: 34px;
    height: 34px;

    flex: 0 0 34px;

    border-radius: 999px;
    border: 1px solid var(--surface-soft-border);

    background: var(--preset-color);

    cursor: pointer;
}

.widget-text-color-hex {
    width: 150px;
    min-width: 170px;
}

/* =====================================================
   WIDGET COLOR — COMPACT DESKTOP
   ===================================================== */

@media (min-width: 1600px) {

    .widget-color-layout {
        grid-template-columns: minmax(0, 1fr) minmax(220px, 250px);
        column-gap: 20px;
    }

    .widget-main-color-column,
    .widget-text-color-column {
        min-width: 0;
    }

    .widget-main-color-input-row,
    .widget-text-color-row {
        width: 100%;
    }

    .widget-color-hex.sx-input {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        margin-left: 0;
        box-sizing: border-box;
    }

    .widget-text-color-hex.sx-input {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

}



/* =====================================================
   WIDGET LAUNCHER BUBBLES
   ===================================================== */

.cp-launcher-eyes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    width: 100%;
    height: 100%;
}


/* =====================================================
   PRE-CHAT FORM
   ===================================================== */

.chatpro-pre-chat-form {
    margin: 12px 10px;
    padding: 14px;

    border-radius: 18px;
    background: #ffffff;

    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pcf-title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

.pcf-description {
    margin-top: -4px;
    margin-bottom: 4px;

    font-size: 13px;
    color: #64748b;
}

.chatpro-pre-chat-form input[type="text"],
.chatpro-pre-chat-form input[type="email"],
.chatpro-pre-chat-form input[type="tel"] {
    width: 100%;
    height: 38px;

    box-sizing: border-box;

    border: 1px solid #e2e8f0;
    border-radius: 14px;

    padding: 0 12px;

    background: #f8fafc;

    font-size: 14px;
    color: #111827;

    outline: none;
}

.chatpro-pre-chat-form .pcf-message {
    width: 100%;
    min-height: 86px;

    box-sizing: border-box;

    border: 1px solid #e2e8f0;
    border-radius: 14px;

    padding: 10px 12px;

    background: #f8fafc;

    font-size: 14px;
    line-height: 1.4;
    color: #111827;

    resize: vertical;
    outline: none;

    font-family: inherit;
}

.chatpro-pre-chat-form .pcf-message:focus {
    border-color: var(--cp-primary-color, #2D3948);
    background: #ffffff;

    box-shadow: 0 0 0 3px rgba(45, 57, 72, 0.12);
}

.chatpro-pre-chat-form input:focus {
    border-color: var(--cp-primary-color, #2D3948);
    background: #ffffff;

    box-shadow: 0 0 0 3px rgba(45, 57, 72, 0.12);
}

.pcf-consent {
    display: flex;
    align-items: flex-start;
    gap: 8px;

    margin-top: 2px;

    font-size: 12px;
    line-height: 1.4;
    color: #475569;
}

.pcf-consent input {
    margin-top: 2px;
    flex-shrink: 0;
}

.pcf-error {
    font-size: 12px;
    color: #dc2626;
}

.pcf-submit {
    height: 38px;

    border: none;
    border-radius: 999px;

    background: var(--cp-primary-color, #2D3948);
    color: #ffffff;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}

.pcf-submit:hover {
    filter: brightness(1.05);
}