.wpcqc-entry,
.wpcqc-entry * {
    box-sizing: border-box;
}

.wpcqc-entry {
    --wpcqc-accent: #0067b2;
    --wpcqc-dark: #000d22;
    position: relative;
    z-index: 2;
    max-width: 238px;
    font-family: inherit;
}

.wpcqc-gallery-has-badge {
    position: relative !important;
}

.wpcqc-gallery-has-badge > .wpcqc-entry[data-wpcqc-auto-place="1"] {
    position: absolute;
    top: 14px;
    z-index: 3;
}

.wpcqc-gallery-has-badge > .wpcqc-entry--top-right[data-wpcqc-auto-place="1"] {
    right: 14px;
}

.wpcqc-gallery-has-badge > .wpcqc-entry--top-left[data-wpcqc-auto-place="1"] {
    left: 14px;
}

.wpcqc-badge {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-height: 58px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid rgba(0, 13, 34, .10);
    border-radius: 8px;
    background: rgba(255, 255, 255, .96);
    color: var(--wpcqc-dark);
    box-shadow: 0 7px 24px rgba(0, 13, 34, .12);
    text-align: left;
    cursor: pointer;
    transition:
        transform .18s ease,
        box-shadow .18s ease,
        border-color .18s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.wpcqc-badge:hover {
    transform: translateY(-2px);
    border-color: color-mix(
        in srgb,
        var(--wpcqc-accent) 28%,
        transparent
    );
    box-shadow: 0 10px 30px rgba(0, 13, 34, .17);
}

.wpcqc-badge:focus-visible {
    outline: 3px solid color-mix(
        in srgb,
        var(--wpcqc-accent) 32%,
        transparent
    );
    outline-offset: 3px;
}

.wpcqc-badge__icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: color-mix(
        in srgb,
        var(--wpcqc-accent) 10%,
        white
    );
    color: var(--wpcqc-accent);
}

.wpcqc-badge__icon svg,
.wpcqc-modal__icon svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wpcqc-badge__text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wpcqc-badge__text strong {
    overflow: hidden;
    font-size: 13px;
    line-height: 1.25;
    font-weight: 700;
    color: var(--wpcqc-dark);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wpcqc-badge__text small {
    font-size: 11px;
    line-height: 1.25;
    font-weight: 500;
    color: var(--wpcqc-accent);
}

.wpcqc-badge__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--wpcqc-dark);
    opacity: .48;
    transition:
        transform .18s ease,
        opacity .18s ease;
}

.wpcqc-badge:hover .wpcqc-badge__arrow {
    transform: translateX(2px);
    opacity: .8;
}

.wpcqc-badge__arrow svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

html.wpcqc-modal-open,
body.wpcqc-modal-open {
    overflow: hidden !important;
}

.wpcqc-modal[hidden] {
    display: none !important;
}

.wpcqc-modal {
    --wpcqc-accent: #0067b2;
    --wpcqc-dark: #000d22;
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: inherit;
}

.wpcqc-modal,
.wpcqc-modal * {
    box-sizing: border-box;
}

.wpcqc-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 13, 34, .76);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.wpcqc-modal__dialog {
    position: relative;
    width: min(1120px, 96vw);
    max-height: min(900px, 92vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .34);
    animation: wpcqc-modal-in .2s ease-out;
}

@keyframes wpcqc-modal-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.wpcqc-modal__header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    border-bottom: 1px solid #e7ebf0;
    background: #fff;
}

.wpcqc-modal__heading {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 13px;
}

.wpcqc-modal__icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: color-mix(
        in srgb,
        var(--wpcqc-accent) 10%,
        white
    );
    color: var(--wpcqc-accent);
}

.wpcqc-modal__eyebrow {
    margin: 0 0 2px;
    font-size: 11px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--wpcqc-accent);
}

.wpcqc-modal__heading h2 {
    margin: 0;
    font-size: clamp(19px, 2vw, 26px);
    line-height: 1.2;
    font-weight: 700;
    color: var(--wpcqc-dark);
}

.wpcqc-modal__close {
    appearance: none;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #e0e5eb;
    border-radius: 8px;
    background: #fff;
    color: var(--wpcqc-dark);
    cursor: pointer;
    transition:
        background-color .18s ease,
        border-color .18s ease;
}

.wpcqc-modal__close:hover {
    border-color: #ccd4de;
    background: #f4f7fa;
}

.wpcqc-modal__close:focus-visible {
    outline: 3px solid color-mix(
        in srgb,
        var(--wpcqc-accent) 28%,
        transparent
    );
    outline-offset: 2px;
}

.wpcqc-modal__close svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.wpcqc-modal__body {
    min-height: 0;
    flex: 1 1 auto;
    display: grid;
    grid-template-columns:
        minmax(230px, 300px)
        minmax(0, 1fr);
    overflow: hidden;
}

.wpcqc-modal__meta {
    overflow: auto;
    padding: 22px;
    border-right: 1px solid #e7ebf0;
    background: #f7f9fc;
}

.wpcqc-modal__description {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.65;
    color: #4b5b70;
}

.wpcqc-modal__details {
    margin: 0;
}

.wpcqc-modal__details > div {
    padding: 13px 0;
    border-bottom: 1px solid #e1e6ec;
}

.wpcqc-modal__details > div:first-child {
    padding-top: 0;
}

.wpcqc-modal__details dt {
    margin: 0 0 4px;
    font-size: 11px;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #7a8798;
}

.wpcqc-modal__details dd {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 600;
    color: var(--wpcqc-dark);
}

.wpcqc-modal__viewer {
    position: relative;
    min-width: 0;
    min-height: 520px;
    background: #dfe5ec;
}

.wpcqc-modal__iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.wpcqc-modal__loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    color: #5d6c80;
    background: #edf1f5;
    transition:
        opacity .2s ease,
        visibility .2s ease;
}

.wpcqc-modal__viewer.is-loaded
.wpcqc-modal__loading {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.wpcqc-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(0, 103, 178, .18);
    border-top-color: var(--wpcqc-accent);
    border-radius: 50%;
    animation: wpcqc-spin .8s linear infinite;
}

@keyframes wpcqc-spin {
    to {
        transform: rotate(360deg);
    }
}

.wpcqc-modal__footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #e7ebf0;
    background: #fff;
}

.wpcqc-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.3;
    font-weight: 600;
    text-decoration: none !important;
    transition:
        background-color .18s ease,
        border-color .18s ease,
        color .18s ease;
}

.wpcqc-button--primary {
    border-color: var(--wpcqc-accent);
    background: var(--wpcqc-accent);
    color: #fff !important;
}

.wpcqc-button--primary:hover {
    filter: brightness(1.08);
}

.wpcqc-button--secondary {
    border-color: #d6dde6;
    background: #fff;
    color: var(--wpcqc-dark) !important;
}

.wpcqc-button--secondary:hover {
    background: #f5f7fa;
}

@media (max-width: 900px) {

    .wpcqc-modal__body {
        grid-template-columns: 1fr;
        overflow: auto;
    }

    .wpcqc-modal__meta {
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid #e7ebf0;
    }

    .wpcqc-modal__viewer {
        min-height: 58vh;
    }
}

@media (max-width: 767px) {

    /* =====================================================
       MOBILE – KAFEL CERTYFIKATU NA ZDJĘCIU
       ===================================================== */

    .wpcqc-gallery-has-badge {
        position: relative !important;
    }

    /*
     * Kafelek pozostaje absolutnie na zdjęciu.
     * Jest zwężony i ustawiony po prawej stronie.
     */
    .wpcqc-gallery-has-badge
    > .wpcqc-entry[data-wpcqc-auto-place="1"] {
        position: absolute !important;
        top: 12px !important;
        right: 10px !important;
        left: auto !important;

        width: calc(100% - 110px) !important;
        max-width: 230px !important;
        min-width: 155px;

        margin: 0 !important;
        z-index: 4 !important;
    }

    /*
     * Kompaktowy układ certyfikatu.
     * Bez dużej ikony po lewej.
     */
    .wpcqc-gallery-has-badge
    > .wpcqc-entry[data-wpcqc-auto-place="1"]
    .wpcqc-badge {
        min-height: 54px;
        grid-template-columns:
            minmax(0, 1fr)
            18px;
        gap: 6px;
        padding: 7px 9px;
    }

    .wpcqc-gallery-has-badge
    > .wpcqc-entry[data-wpcqc-auto-place="1"]
    .wpcqc-badge__icon {
        display: none;
    }

    .wpcqc-gallery-has-badge
    > .wpcqc-entry[data-wpcqc-auto-place="1"]
    .wpcqc-badge__text {
        gap: 1px;
    }

    .wpcqc-gallery-has-badge
    > .wpcqc-entry[data-wpcqc-auto-place="1"]
    .wpcqc-badge__text strong {
        font-size: 12px;
        line-height: 1.2;
    }

    .wpcqc-gallery-has-badge
    > .wpcqc-entry[data-wpcqc-auto-place="1"]
    .wpcqc-badge__text small {
        overflow: hidden;
        font-size: 10px;
        line-height: 1.2;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .wpcqc-gallery-has-badge
    > .wpcqc-entry[data-wpcqc-auto-place="1"]
    .wpcqc-badge__arrow {
        width: 18px;
    }

    /*
     * Badge produktu, np. BESTSELLER,
     * pozostaje po lewej stronie zdjęcia.
     */
    .single-product
    .wpcqc-gallery-has-badge
    .product-badge {
        position: absolute !important;
        top: 18px !important;
        right: auto !important;
        left: 10px !important;
        margin: 0 !important;
        z-index: 5 !important;
    }

    .single-product
    .wpcqc-gallery-has-badge
    .product-badge .badge {
        margin: 0 !important;
    }

    /* =====================================================
       MOBILE – MODAL
       ===================================================== */

    .wpcqc-modal {
        align-items: stretch;
        padding: 8px;
    }

    .wpcqc-modal__dialog {
        width: 100%;
        max-height: none;
        height: calc(100dvh - 16px);
        border-radius: 10px;
    }

    .wpcqc-modal__header {
        padding: 13px 14px;
    }

    .wpcqc-modal__icon {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
    }

    .wpcqc-modal__heading h2 {
        font-size: 18px;
    }

    .wpcqc-modal__meta {
        padding: 16px;
    }

    .wpcqc-modal__viewer {
        min-height: 60vh;
    }

    .wpcqc-modal__footer {
        display: grid;
        grid-template-columns: 1fr 1fr;
        padding: 10px;
    }

    .wpcqc-button {
        padding-inline: 10px;
        text-align: center;
    }
}

@media (max-width: 374px) {

    /*
     * Dodatkowe zwężenie kafelka
     * na bardzo małych telefonach.
     */
    .wpcqc-gallery-has-badge
    > .wpcqc-entry[data-wpcqc-auto-place="1"] {
        width: calc(100% - 100px) !important;
        min-width: 145px;
    }

    .wpcqc-gallery-has-badge
    > .wpcqc-entry[data-wpcqc-auto-place="1"]
    .wpcqc-badge__text strong {
        font-size: 11px;
    }

    .wpcqc-gallery-has-badge
    > .wpcqc-entry[data-wpcqc-auto-place="1"]
    .wpcqc-badge__text small {
        font-size: 9px;
    }
}

@media (max-width: 480px) {

    .wpcqc-modal__footer {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {

    .wpcqc-badge,
    .wpcqc-badge__arrow,
    .wpcqc-modal__dialog,
    .wpcqc-spinner {
        animation: none !important;
        transition: none !important;
    }
}


/* =========================================================
   ODPORNA IKONA ZAMKNIĘCIA MODALA
   ========================================================= */

.wpcqc-modal .wpcqc-modal__close {
    position: relative !important;
    min-width: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    border: 1px solid #e0e5eb !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    color: #0f172a !important;
    box-shadow: none !important;
    font-size: 0 !important;
    line-height: 1 !important;
    overflow: visible !important;
}

.wpcqc-modal .wpcqc-modal__close::before,
.wpcqc-modal .wpcqc-modal__close::after {
    content: "" !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 19px !important;
    height: 2px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: currentColor !important;
    opacity: 1 !important;
    transform-origin: center !important;
    pointer-events: none !important;
}

.wpcqc-modal .wpcqc-modal__close::before {
    transform:
        translate(-50%, -50%)
        rotate(45deg) !important;
}

.wpcqc-modal .wpcqc-modal__close::after {
    transform:
        translate(-50%, -50%)
        rotate(-45deg) !important;
}

.wpcqc-modal .wpcqc-modal__close svg {
    display: none !important;
}

.wpcqc-modal .wpcqc-modal__close:hover {
    border-color: #cbd5e1 !important;
    background: #f1f5f9 !important;
    color: #0067b2 !important;
}