/*
 * VozniNet Modern – Mobile QA fixes, round 2.
 * Scope: header positioning, universal mobile back-to-top,
 * contact form width and Turnstile containment.
 */

/* Universal mobile back-to-top. Hidden until JS activates it. */
#vn-mobile-back-to-top {
    display: none;
}

@media (max-width: 768px) {

    /* ---------------------------------------------------------
       HEADER
       Actual modern header uses .vn-header. Remove the inherited
       extra margin; JS sets exact top according to admin-bar height.
       --------------------------------------------------------- */
    .vn-header,
    header.vn-header,
    #masthead.vn-header,
    .site-header.vn-header {
        margin-top: 0 !important;
    }

    /* ---------------------------------------------------------
       BACK TO TOP
       Independent of the legacy .btn-up implementation.
       --------------------------------------------------------- */
    #vn-mobile-back-to-top {
        position: fixed;
        right: 18px;
        bottom: 145px;
        z-index: 9997;
        width: 52px;
        height: 52px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: #00b86b;
        color: #fff;
        font: 700 30px/52px Arial, sans-serif;
        text-align: center;
        cursor: pointer;
        box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(8px);
        transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
    }

    #vn-mobile-back-to-top.is-visible {
        display: block;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

    /* Keep the old mobile-suppressed button out of the way. */
    .btn-up {
        display: none !important;
    }

    /* ---------------------------------------------------------
       CONTACT FORM
       JS marks the narrow ancestor chain with .vn-cf7-mobile-shell.
       This overrides inherited fixed/max widths only on /kontakty.
       --------------------------------------------------------- */
    body.vn-contact-page .vn-cf7-mobile-shell {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body.vn-contact-page .wpcf7,
    body.vn-contact-page .wpcf7-form,
    body.vn-contact-page .wpcf7-form > p,
    body.vn-contact-page .wpcf7-form-control-wrap {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    body.vn-contact-page .wpcf7-form-control-wrap {
        display: block !important;
    }

    body.vn-contact-page .wpcf7 input[type="text"],
    body.vn-contact-page .wpcf7 input[type="email"],
    body.vn-contact-page .wpcf7 input[type="tel"],
    body.vn-contact-page .wpcf7 input[type="url"],
    body.vn-contact-page .wpcf7 input[type="number"],
    body.vn-contact-page .wpcf7 input[type="date"],
    body.vn-contact-page .wpcf7 textarea,
    body.vn-contact-page .wpcf7 select {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body.vn-contact-page .wpcf7 textarea {
        resize: vertical !important;
    }

    body.vn-contact-page .cf7-cf-turnstile,
    body.vn-contact-page .cf-turnstile,
    body.vn-contact-page [class*="turnstile"] {
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    body.vn-contact-page .cf7-cf-turnstile iframe,
    body.vn-contact-page .cf-turnstile iframe,
    body.vn-contact-page [class*="turnstile"] iframe {
        max-width: none !important;
    }

    body.vn-contact-page .vn-cf7-status {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 420px) {
    body.vn-contact-page .vn-cf7-mobile-shell {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

@media (max-width: 340px) {
    #vn-mobile-back-to-top {
        right: 14px;
        width: 48px;
        height: 48px;
        font-size: 28px;
        line-height: 48px;
    }
}

/* VOZNINET MOBILE HEADER FINAL OVERRIDE START */
@media (max-width: 768px) {
    .vn-header,
    header.vn-header,
    #masthead.vn-header,
    .site-header.vn-header {
        top: 0 !important;
        margin-top: 0 !important;
    }
}
/* VOZNINET MOBILE HEADER FINAL OVERRIDE END */

/* VOZNINET REAL MOBILE HEADER OVERRIDE START */
@media (max-width: 768px) {
    html body[class] .header {
        margin-top: 0 !important;
    }
}
/* VOZNINET REAL MOBILE HEADER OVERRIDE END */

/* VOZNINET MOBILE HEADER FIXED FINAL START */
@media (max-width: 768px) {
    html body .header {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        z-index: 9990 !important;
    }

    #vn-mobile-header-spacer {
        display: block;
        width: 100%;
        margin: 0;
        padding: 0;
        border: 0;
    }
}
/* VOZNINET MOBILE HEADER FIXED FINAL END */


/* VOZNINET 320PX FINAL TUNING */
@media (max-width: 340px) {
    #vn-mobile-back-to-top {
        width: 44px !important;
        height: 44px !important;
        right: 10px !important;
        bottom: 138px !important;
        font-size: 25px !important;
        line-height: 44px !important;
    }

    body.vn-contact-page .cf7-cf-turnstile,
    body.vn-contact-page .cf-turnstile {
        transform-origin: left top !important;
    }
}

/* VOZNINET TURNSTILE FLEXIBLE RESET START */
@media (max-width: 768px) {
    body.vn-contact-page .cf7-cf-turnstile,
    body.vn-contact-page .cf-turnstile,
    body.vn-contact-page [class*="turnstile"] {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        transform: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 0 !important;
        box-sizing: border-box !important;
    }

    body.vn-contact-page .cf7-cf-turnstile iframe,
    body.vn-contact-page .cf-turnstile iframe,
    body.vn-contact-page [class*="turnstile"] iframe,
    body.vn-contact-page iframe[src*="challenges.cloudflare.com"] {
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
        transform-origin: initial !important;
    }
}
/* VOZNINET TURNSTILE FLEXIBLE RESET END */

/* VOZNINET 320 CONTACT FINAL START */
@media (max-width: 340px) {

    body.vn-contact-page .cf-turnstile[data-size="compact"],
    body.vn-contact-page [id^="cf-turnstile-"][data-size="compact"],
    body.vn-contact-page [data-sitekey][data-size="compact"] {
        width: 150px !important;
        max-width: 150px !important;
        min-width: 150px !important;
        margin-left: 0 !important;
        margin-right: auto !important;
        transform: none !important;
        overflow: visible !important;
    }

    body.vn-contact-page .cf-turnstile[data-size="compact"] iframe,
    body.vn-contact-page [id^="cf-turnstile-"][data-size="compact"] iframe,
    body.vn-contact-page [data-sitekey][data-size="compact"] iframe {
        width: 150px !important;
        max-width: 150px !important;
        min-width: 150px !important;
        height: 140px !important;
        transform: none !important;
    }

    body.vn-contact-page .vn-mobile-contact-card {
        padding: 14px !important;
        column-gap: 10px !important;
        row-gap: 8px !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
    }

    body.vn-contact-page .vn-mobile-contact-text {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    body.vn-contact-page .vn-mobile-contact-value {
        display: inline-block !important;
        min-width: 0 !important;
        max-width: 100% !important;
        font-size: 13px !important;
        line-height: 1.45 !important;
        white-space: normal !important;
        word-break: normal !important;
        hyphens: none !important;
    }

    body.vn-contact-page .vn-mobile-contact-whatsapp {
        overflow-wrap: normal !important;
    }

    body.vn-contact-page .vn-mobile-contact-email {
        overflow-wrap: anywhere !important;
        word-break: normal !important;
    }
}
/* VOZNINET 320 CONTACT FINAL END */

/* VOZNINET GLOBAL BACK TO TOP START */

/* Hide the old home-only arrow so all templates use one global control. */
body .btn-up {
    display: none !important;
}

#vn-global-back-to-top {
    position: fixed;
    z-index: 9995;
    left: 18px;
    bottom: 18px;
    width: 54px;
    height: 54px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #08b66c;
    color: #fff;
    font-size: 34px;
    line-height: 54px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(0,0,0,.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

#vn-global-back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

#vn-global-back-to-top:hover,
#vn-global-back-to-top:focus-visible {
    filter: brightness(.95);
    outline: none;
}

/*
 * Mobile already has cookie UI on the left and chat on the right.
 * Keep the global arrow on the right, above the chat, as approved in QA.
 */
@media (max-width: 768px) {
    #vn-global-back-to-top {
        left: auto;
        right: 10px;
        bottom: 138px;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        font-size: 25px;
        line-height: 44px;
    }

    /* Disable the older mobile-only button to avoid duplicates. */
    #vn-mobile-back-to-top {
        display: none !important;
    }
}

/* VOZNINET GLOBAL BACK TO TOP END */
