/* ============================================================
   Pływający kontakt – Frontend
   ============================================================ */

/* ---------- Floating trigger ---------- */
.pk-trigger {
    position: fixed;
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--pk-icon-size, 60px);
    height: var(--pk-icon-size, 60px);
    border: none;
    border-radius: var(--pk-icon-radius, 50%);
    background: var(--pk-icon-bg, #c0392b);
    color: var(--pk-icon-color, #fff);
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    transition: background .3s, transform .3s, box-shadow .3s;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}
.pk-trigger:hover,
.pk-trigger:focus-visible {
    background: var(--pk-icon-hover, #e74c3c);
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0,0,0,0.35);
}
.pk-trigger .pk-icon { display: flex; align-items: center; justify-content: center; line-height: 0; }
.pk-trigger .pk-icon svg { width: 50%; height: 50%; fill: currentColor; }

/* Animations */
@keyframes pk-pulse {
    0%,100% { box-shadow: 0 4px 20px rgba(0,0,0,.25), 0 0 0 0 var(--pk-icon-bg); }
    50%     { box-shadow: 0 4px 20px rgba(0,0,0,.25), 0 0 0 12px transparent; }
}
@keyframes pk-bounce {
    0%,100% { transform: translateY(0); }
    25%     { transform: translateY(-8px); }
    50%     { transform: translateY(0); }
    75%     { transform: translateY(-4px); }
}
@keyframes pk-shake {
    0%,100% { transform: rotate(0); }
    10% { transform: rotate(-8deg); }
    20% { transform: rotate(8deg); }
    30% { transform: rotate(-6deg); }
    40% { transform: rotate(6deg); }
    50% { transform: rotate(0); }
}
.pk-anim-pulse  { animation: pk-pulse 2.5s infinite ease-in-out; }
.pk-anim-bounce { animation: pk-bounce 2s infinite ease-in-out; }
.pk-anim-shake  { animation: pk-shake 3s infinite ease-in-out; }
.pk-anim-none   { animation: none; }
.pk-trigger:hover { animation-play-state: paused; }

/* Tooltip */
.pk-trigger[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: #333;
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* ---------- Overlay ---------- */
.pk-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pk-popup-overlay, rgba(0,0,0,.6));
    opacity: 0;
    visibility: hidden;
    transition: opacity .35s, visibility .35s;
    padding: 20px;
}
.pk-overlay.pk-active { opacity: 1; visibility: visible; }

/* ---------- Popup ---------- */
.pk-popup {
    position: relative;
    width: 100%;
    max-width: var(--pk-popup-width, 520px);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--pk-popup-bg, #fff);
    border-radius: var(--pk-popup-radius, 16px);
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    transform: translateY(30px) scale(.95);
    transition: transform .4s cubic-bezier(.34,1.56,.64,1);
}
.pk-overlay.pk-active .pk-popup { transform: translateY(0) scale(1); }
.pk-popup::-webkit-scrollbar { width: 6px; }
.pk-popup::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 3px; }

/* Close */
.pk-close {
    position: absolute; top: 12px; right: 14px; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: none; border-radius: 50%;
    background: rgba(0,0,0,.06); color: #555; font-size: 22px;
    cursor: pointer; transition: background .2s, transform .2s, color .2s; line-height: 1;
}
.pk-close:hover { background: rgba(0,0,0,.12); color: #000; transform: rotate(90deg); }

/* Content */
.pk-popup-content { padding: 36px 32px 32px; }

/* ---------- Form header ---------- */
.pk-form-header { text-align: center; margin-bottom: 24px; }
.pk-form-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--pk-btn-bg, #c0392b), var(--pk-btn-hover, #e74c3c));
    border-radius: 14px; margin-bottom: 12px;
    box-shadow: 0 4px 14px rgba(192,57,43,.25);
    color: #fff;
}
.pk-form-icon svg { width: 24px; height: 24px; fill: currentColor; }
.pk-form-logo {
    display: inline-block; margin-bottom: 12px;
}
.pk-form-logo img {
    max-width: var(--pk-logo-width, 120px); max-height: var(--pk-logo-height, 60px);
    object-fit: contain; display: block; margin: 0 auto;
}
.pk-form-header h2 { font-size: 21px; color: #1a1a2e; font-weight: 700; margin: 0 0 4px; }
.pk-form-header p { font-size: 14px; color: #888; margin: 0; }

/* ---------- Row (side by side) ---------- */
.pk-row { display: flex; gap: 12px; }
.pk-row .pk-field { flex: 1; min-width: 0; }

/* ---------- Fields ---------- */
.pk-field { margin-bottom: 16px; }
.pk-field label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--pk-label-color, #444); margin-bottom: 5px;
}
.pk-req { color: var(--pk-btn-bg, #c0392b); }
.pk-field input[type="text"],
.pk-field input[type="email"],
.pk-field input[type="tel"],
.pk-field select,
.pk-field textarea {
    display: block; width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--pk-input-border, #e0e0e0);
    border-radius: 10px;
    font-size: 14px; font-family: inherit; color: #333;
    background: #fafafa;
    transition: border-color .2s, box-shadow .2s, background .2s;
    outline: none;
    box-sizing: border-box;
}
.pk-field input:focus,
.pk-field select:focus,
.pk-field textarea:focus {
    border-color: var(--pk-input-focus, #c0392b);
    box-shadow: 0 0 0 3px rgba(192,57,43,.08);
    background: #fff;
}
.pk-field textarea { resize: vertical; min-height: 90px; }
.pk-field input::placeholder,
.pk-field textarea::placeholder { color: #bbb; }
.pk-field select { cursor: pointer; }

/* Consent */
.pk-consent label {
    display: flex; align-items: flex-start; gap: 8px;
    font-weight: 400; font-size: 13px; color: #666; cursor: pointer;
}
.pk-consent input[type="checkbox"] {
    width: 18px; height: 18px; margin-top: 1px; accent-color: var(--pk-btn-bg, #c0392b);
}

/* Submit */
.pk-submit {
    display: block; width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--pk-btn-bg, #c0392b), var(--pk-btn-hover, #e74c3c));
    color: var(--pk-btn-text, #fff);
    border: none; border-radius: 10px;
    font-size: 15px; font-weight: 600;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s, opacity .2s;
    margin-top: 4px;
}
.pk-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(192,57,43,.3); }
.pk-submit:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* Feedback */
.pk-feedback {
    text-align: center; padding: 12px; margin-top: 14px;
    border-radius: 8px; font-size: 14px; font-weight: 500;
}
.pk-feedback.pk-success { background: #eafaf1; color: #27ae60; }
.pk-feedback.pk-error   { background: #fdf2f2; color: #c0392b; }

/* ---------- reCAPTCHA ---------- */
.pk-recaptcha-container {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}
.pk-recaptcha-container > div { transform-origin: center; }
.pk-recaptcha-notice {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin: 0 0 12px;
    line-height: 1.4;
}
.pk-recaptcha-notice a { color: #888; text-decoration: underline; }
.pk-recaptcha-notice a:hover { color: #555; }

/* Field validation */
.pk-field-error input,
.pk-field-error textarea,
.pk-field-error select {
    border-color: #c0392b !important;
    box-shadow: 0 0 0 3px rgba(192,57,43,.1) !important;
}

/* ---------- Mobile ---------- */
#pk-wrapper[data-hide-mobile="1"] .pk-trigger { display: none; }
@media (min-width: 769px) {
    #pk-wrapper[data-hide-mobile="1"] .pk-trigger { display: flex; }
}
@media (max-width: 600px) {
    .pk-overlay {
        align-items: center;
        justify-content: center;
        padding: 5vh 5vw;
        padding: 5dvh 5vw;
    }
    .pk-popup {
        width: 90vw !important;
        max-width: 90vw !important;
        height: 90vh;
        height: 90dvh;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: 14px !important;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
    .pk-overlay .pk-popup { transform: scale(.9); opacity: 0; }
    .pk-overlay.pk-active .pk-popup { transform: scale(1); opacity: 1; }

    .pk-popup-content {
        padding: 10px 12px 8px;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    /* Kompaktowy header */
    .pk-form-header { margin-bottom: 4px; }
    .pk-form-icon { width: 26px; height: 26px; border-radius: 7px; margin-bottom: 2px; }
    .pk-form-icon svg { width: 13px; height: 13px; }
    .pk-form-logo { margin-bottom: 3px; }
    .pk-form-logo img { max-width: calc(var(--pk-logo-width, 120px) * 0.66); max-height: calc(var(--pk-logo-height, 60px) * 0.6); }
    .pk-form-header h2 { font-size: 14px; margin-bottom: 0; }
    .pk-form-header p { font-size: 10px; }

    /* Formularz flex */
    #pk-form {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    #pk-form .pk-field:last-of-type { flex: 1; display: flex; flex-direction: column; }
    #pk-form .pk-field:last-of-type textarea { flex: 1; min-height: 30px; }

    /* Row na mobile */
    .pk-row { gap: 6px; }

    /* Kompaktowe pola */
    .pk-field { margin-bottom: 3px; }
    .pk-field label { font-size: 10px; margin-bottom: 1px; }
    .pk-field input[type="text"],
    .pk-field input[type="email"],
    .pk-field input[type="tel"],
    .pk-field select,
    .pk-field textarea {
        padding: 5px 8px;
        font-size: 12px;
        border-radius: 5px;
        border-width: 1px;
    }
    .pk-field textarea { min-height: 30px; resize: none; }

    /* Kompaktowy consent */
    .pk-consent { margin-bottom: 2px !important; }
    .pk-consent label { font-size: 9px; gap: 4px; line-height: 1.2; }
    .pk-consent input[type="checkbox"] { width: 13px; height: 13px; flex-shrink: 0; }

    /* Kompaktowy przycisk */
    .pk-submit { padding: 7px; font-size: 12px; border-radius: 6px; margin-top: 2px; }

    /* Mniejszy close */
    .pk-close { width: 26px; height: 26px; font-size: 15px; top: 5px; right: 6px; }

    /* reCAPTCHA na mobile */
    .pk-recaptcha-container { margin-bottom: 3px; }
    .pk-recaptcha-container > div { transform: scale(0.77); transform-origin: center; margin: -5px 0; }
    .pk-recaptcha-notice { font-size: 8px; margin-bottom: 3px; }

    /* Feedback */
    .pk-feedback { padding: 5px; margin-top: 3px; font-size: 10px; }
}
