/*
 * Padel.tc WebView interaction guard
 * Prevents browser-like long-press/copy/drag behaviours across the application.
 * Editable fields and explicitly allowed areas remain selectable.
 */

html,
body,
body *:not(input):not(textarea):not([contenteditable="true"]):not(.allow-selection):not(.allow-selection *) {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

html,
body {
    /*
     * Scroll kesinlikle açık kalır.
     * Uzun basma / seçme engeli scroll ile karıştırılmaz.
     */
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-x: none;
    overscroll-behavior-y: auto;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    -webkit-text-size-adjust: 100%;
}

a,
button,
[role="button"],
input[type="button"],
input[type="submit"],
input[type="reset"],
label,
summary {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent !important;
}

img,
svg,
video,
canvas,
picture,
source {
    -webkit-user-drag: none !important;
    user-drag: none !important;
    -webkit-touch-callout: none !important;
}

input,
textarea,
[contenteditable="true"],
.allow-selection,
.allow-selection * {
    -webkit-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
}

/* Prevent native image/link ghost dragging in desktop WebViews. */
a img,
a svg,
button img,
button svg {
    pointer-events: none;
}

/* Restore pointer events when the element itself is intentionally interactive. */
a.profile-avatar img,
a.chat-avatar-link img,
[data-image-modal] img,
[data-lightbox] img,
.allow-image-pointer img {
    pointer-events: auto;
}


/*
 * =========================================================
 * AREA PADEL - GLOBAL SCROLL FIX v2
 * =========================================================
 * Daha önce uzun basma/kopyalama koruması eklenirken bazı sayfalarda
 * overflow:hidden / touch-action:none kalmış olabilir.
 *
 * Sohbet ve gerçek modal açık durumları hariç normal sayfalarda
 * mouse wheel + parmakla dikey kaydırma daima açıktır.
 */

/* Normal kullanıcı sayfaları */
html:not(:has(.cnc-chat-page)),
body:not(:has(.cnc-chat-page)) {
    height: auto !important;
    min-height: 100% !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/*
 * Ana mobil wrapper'da eski `overflow:hidden` dikey scroll'u
 * kilitlemesin. Yatay taşma yine gizli.
 */
body:not(:has(.cnc-chat-page)) .cnc-app {
    height: auto !important;
    min-height: 100vh !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    touch-action: pan-y !important;
}

/* İçerik pan hareketini kabul etsin. */
body:not(:has(.cnc-chat-page)) main,
body:not(:has(.cnc-chat-page)) .cnc-app,
body:not(:has(.cnc-chat-page)) .page,
body:not(:has(.cnc-chat-page)) .content {
    touch-action: pan-y !important;
}

/*
 * Gerçek popup/sheet açıldığında mevcut sayfa CSS'i scroll kilidini
 * yönetmeye devam eder. Bu sınıflara müdahale etmiyoruz.
 */
body.cnc-team-picker-open,
body.cnc-sheet-open,
html.cnc-chat-modal-open,
body.cnc-chat-modal-open,
html.cnc-chat-match-modal-open,
body.cnc-chat-match-modal-open {
    overscroll-behavior: none;
}


/*
 * =========================================================
 * AREA PADEL - SCROLLBAR HIDE
 * =========================================================
 * Kaydırma çalışmaya devam eder; yalnızca görsel scrollbar gizlenir.
 */
html,
body,
.cnc-app,
main,
.page,
.content {
    scrollbar-width: none !important;       /* Firefox */
    -ms-overflow-style: none !important;    /* Eski Edge / IE */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.cnc-app::-webkit-scrollbar,
main::-webkit-scrollbar,
.page::-webkit-scrollbar,
.content::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;               /* Chrome / Android WebView / Safari */
    background: transparent !important;
}
