/* ==========================================================================
   CleanWave Callback — Premium Widget
   ========================================================================== */

.cwcb-widget,
.cwcb-widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ========================================================================
   BUBBLE — zielony, okrągły, premium
   ======================================================================== */

.cwcb-bubble {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 999998;
    display: flex;
    align-items: center;
    gap: 0;
    background: linear-gradient(135deg, #43A047 0%, #2E7D32 100%);
    color: #fff;
    border: none;
    border-radius: 60px;
    width: 60px;
    height: 60px;
    cursor: pointer;
    box-shadow:
        0 4px 16px rgba(46, 125, 50, 0.35),
        0 0 0 0 rgba(67, 160, 71, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: cwcb-ring 3s ease-in-out infinite;
    justify-content: center;
    overflow: hidden;
}

.cwcb-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(46, 125, 50, 0.5);
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
}

/* Ikona wyśrodkowana */
.cwcb-bubble__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
}

.cwcb-bubble__icon svg {
    width: 26px;
    height: 26px;
}

/* Label — rozwija bubble w pill */
.cwcb-bubble__label {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                margin 0.3s ease;
    margin-right: 0;
}

.cwcb-bubble--expanded,
.cwcb-bubble:hover {
    width: auto;
    border-radius: 60px;
    padding-right: 20px;
}

.cwcb-bubble--expanded .cwcb-bubble__label,
.cwcb-bubble:hover .cwcb-bubble__label {
    max-width: 240px;
    opacity: 1;
    margin-right: 0;
}

@keyframes cwcb-ring {
    0%   { box-shadow: 0 4px 16px rgba(46, 125, 50, 0.35), 0 0 0 0 rgba(67, 160, 71, 0.4); }
    30%  { box-shadow: 0 4px 16px rgba(46, 125, 50, 0.35), 0 0 0 12px rgba(67, 160, 71, 0); }
    100% { box-shadow: 0 4px 16px rgba(46, 125, 50, 0.35), 0 0 0 0 rgba(67, 160, 71, 0); }
}

/* Schowaj bubble gdy popup otwarty */
.cwcb-widget[aria-hidden="false"] .cwcb-bubble {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

/* ========================================================================
   POPUP — premium card
   ======================================================================== */

.cwcb-popup {
    position: fixed;
    bottom: 100px;
    left: 28px;
    z-index: 999999;
    width: 370px;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 130px);
    max-height: calc(100dvh - 130px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 20px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.04);
    transform: translateY(16px) scale(0.96);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                visibility 0.3s;
}

.cwcb-widget[aria-hidden="false"] .cwcb-popup {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* ---- Close ---- */
.cwcb-popup__close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    font-size: 20px;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 0.2s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
}

.cwcb-popup__close:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* ---- Header ---- */
.cwcb-popup__header {
    background: linear-gradient(135deg, #1E88E5 0%, #1565C0 100%);
    color: #fff;
    padding: 28px 24px 22px;
    display: flex;
    gap: 16px;
    align-items: center;
    border-radius: 20px 20px 0 0;
}

.cwcb-popup__icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.cwcb-popup__icon svg {
    width: 24px;
    height: 24px;
}

.cwcb-popup__title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: #fff !important;
}

.cwcb-popup__subtitle,
.cwcb-popup__outside-msg {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.45;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9) !important;
}

/* ---- Form ---- */
.cwcb-form {
    padding: 24px;
}

.cwcb-form__field {
    margin-bottom: 16px;
}

.cwcb-form__field input {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border: 2px solid #D0D5DD;
    border-radius: 12px;
    font-size: 15px;
    color: #1a1a1a;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    line-height: 52px;
}

.cwcb-form__field input:focus {
    border-color: #1E88E5;
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.12);
}

.cwcb-form__field input::placeholder {
    color: #98A2B3;
    font-weight: 400;
}

/* ---- Submit ---- */
.cwcb-form__submit {
    width: 100%;
    height: 52px;
    padding: 0 24px;
    background: linear-gradient(135deg, #43A047 0%, #2E7D32 100%);
    color: #fff !important;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 10px;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.25);
}

.cwcb-form__submit svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.cwcb-form__submit:hover {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
    box-shadow: 0 4px 14px rgba(46, 125, 50, 0.35);
    transform: translateY(-1px);
}

.cwcb-form__submit:active {
    transform: translateY(0) scale(0.99);
    box-shadow: 0 1px 4px rgba(46, 125, 50, 0.2);
}

.cwcb-form__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ---- Message ---- */
.cwcb-form__msg {
    margin: 12px 0 0;
    font-size: 13px;
    text-align: center;
    color: #D32F2F;
    min-height: 18px;
    line-height: 1.4;
}

.cwcb-form__msg--success {
    color: #2E7D32;
}

/* ---- Success state ---- */
.cwcb-popup__success {
    padding: 44px 24px;
    text-align: center;
}

.cwcb-popup__success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    color: #2E7D32;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
}

.cwcb-popup__success h3 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.01em;
}

.cwcb-popup__success p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

/* ========================================================================
   MOBILE
   ======================================================================== */

@media (max-width: 480px) {
    .cwcb-popup {
        left: 12px;
        right: 12px;
        bottom: 80px;
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-width: none;
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        border-radius: 18px;
    }

    .cwcb-bubble {
        bottom: 90px;
        bottom: calc(90px + env(safe-area-inset-bottom, 0px));
        left: 18px;
        min-width: 56px;
        width: 56px;
        height: 56px;
    }

    .cwcb-bubble--expanded,
    .cwcb-bubble:hover {
        width: auto;
    }

    .cwcb-bubble__icon {
        min-width: 56px;
        width: 56px;
        height: 56px;
    }

    .cwcb-bubble__icon svg {
        width: 24px;
        height: 24px;
    }

    .cwcb-widget[aria-hidden="false"] .cwcb-bubble {
        transition: none;
    }

    .cwcb-form {
        padding: 18px;
    }

    .cwcb-popup__header {
        padding: 22px 18px 18px;
        border-radius: 18px 18px 0 0;
    }

    .cwcb-form__field input {
        padding: 13px 14px;
        font-size: 16px; /* Prevent iOS auto-zoom */
    }
}

/* Landscape phone */
@media (max-height: 500px) {
    .cwcb-popup {
        bottom: 8px;
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
    }

    .cwcb-popup__header {
        padding: 16px 18px 14px;
    }

    .cwcb-popup__icon {
        display: none;
    }

    .cwcb-form {
        padding: 14px 18px;
    }

    .cwcb-form__field {
        margin-bottom: 8px;
    }

    .cwcb-popup__success {
        padding: 24px 18px;
    }
}
