/**
 * Custom Scrollbar Overlay
 * Scrollbar az oldal tartalmán belül, nem mellette
 */

/* Hide native scrollbar globally but keep functionality */
* {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

*::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

/* Custom scrollbar container */
.custom-scrollbar {
    position: fixed;
    top: 20px;
    right: 8px;
    width: 6px;
    height: calc(100vh - 40px); /* Padding top/bottom */
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show scrollbar on scroll or hover */
body.scrolling .custom-scrollbar,
.custom-scrollbar:hover {
    opacity: 1;
}

/* Scrollbar track */
.custom-scrollbar-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

/* Scrollbar thumb (the draggable part) */
.custom-scrollbar-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s ease;
}

.custom-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.custom-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 0.7);
}

/* Mobile - hide custom scrollbar completely */
@media (max-width: 767px) {
    .custom-scrollbar {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* Re-enable native scrollbar on mobile - use thin, minimal style */
    * {
        scrollbar-width: thin; /* Firefox - thin scrollbar */
        -ms-overflow-style: auto; /* IE and Edge */
    }

    *::-webkit-scrollbar {
        display: block;
        width: 6px; /* Thin scrollbar on mobile */
    }

    *::-webkit-scrollbar-track {
        background: transparent;
    }

    *::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 3px;
    }

    *::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.3);
    }

    /* Hide scrollbar on specific elements where it's not needed */
    .modal,
    .welcome-modal-content,
    .grid-modal-content {
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
    }

    .modal::-webkit-scrollbar,
    .welcome-modal-content::-webkit-scrollbar,
    .grid-modal-content::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
        width: 0;
        height: 0;
    }

    /* Game portrait módban mégis custom scrollbar kell */
    body:has(.game-wrapper) .custom-scrollbar {
        display: block !important;
        opacity: 0; /* JS fogja megjeleníteni görgetéskor */
        pointer-events: none;
    }

    body:has(.game-wrapper).scrolling .custom-scrollbar {
        opacity: 1 !important;
        pointer-events: auto;
    }

    /* Natív scrollbar elrejtése játék oldalon */
    body:has(.game-wrapper),
    body:has(.game-wrapper) * {
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }

    body:has(.game-wrapper)::-webkit-scrollbar,
    body:has(.game-wrapper) *::-webkit-scrollbar {
        display: none !important;
    }
}
