/* Responsive overrides for modern devices */

/* Root and Base */
html {
    height: auto;
    width: 100% !important;
    overflow-x: hidden; /* Remove horizontal scrollbar */
}

body {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 0 50px 0 !important;
    min-height: 100vh !important;
    overflow-x: hidden; /* Remove horizontal scrollbar */
    position: relative !important;
    background-image: url(../img/bg1.gif) !important;
    background-repeat: repeat-x !important;
    background-attachment: scroll !important;
    background-position: top !important;
}

/* Reset fixed widths for mobile */
#wrapper {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

#header, #toptext, #contnav, #searchbar {
    width: 100% !important;
    height: auto !important;
    background-size: cover;
    background-position: center;
    margin: auto;
    box-sizing: border-box;
}

#header {
    background-image: none !important;
    background-repeat: repeat-x !important;
    background-position: top !important;
    background-size: auto !important; /* Prevent cover scaling and enable tiling of bg1.gif */
    overflow-x: auto !important; /* Hide scrollbars, camera controls scroll via JS */
    overflow-y: visible !important; /* Allow penguins to render over toptext */
    position: relative;
    z-index: 100 !important; /* Keep header higher than toptext so penguins stay in front */
    scrollbar-width: none; /* Hide scrollbar Firefox */
}

#header::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}

.inner-header {
    background-image: url(../img/headerBG.jpg);
    background-repeat: no-repeat;
    background-position: center;
    overflow: visible !important; /* Allow penguins to render over toptext */
}

#toptext {
    background-size: auto !important; /* Prevent scaling */
    position: relative;
    z-index: 50 !important; /* Sits lower than header's z-index */
}

#toptext {
        min-height: 150px;
}

/* Flexbox container for content and navigation */
#contnav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

#nav {
    width: 100% !important;
    max-width: 270px;
    float: none !important;
    margin-top: 0 !important;
}

#cont {
    width: 100% !important;
    max-width: 738px;
    float: none !important;
}

/* Navigation adjustments */
#navref {
    width: 100% !important;
    background-size: contain;
    background-repeat: no-repeat;
}

/* Hide the spacer 'line' on mobile */
#line {
    display: none !important;
}

/* Table layout removal helpers */
.responsive-table {
    width: 100%;
    border-collapse: collapse;
}

.responsive-table td {
    display: block;
    width: 100%;
}

/* Search Bar Modernization */
#searchbar {
    width: 100% !important;
    max-width: 1133px !important;
    height: 37px !important;
    background-image: url(../img/searchbar.PNG) !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    margin: 10px auto !important;
    padding: 0 !important;
    float: none !important;
    display: flex;
    justify-content: flex-end; /* Align to the right area of the graphic */
    align-items: center;
    box-sizing: border-box;
}


/* Footer adjustments */
#foot {
    margin-top: 0 !important;
    height: auto !important;
    min-height: 50px !important;
    background-size: contain;
    background-position: bottom;
    background-repeat: no-repeat;
}

.footer-text {
    position: static !important;
    margin: 0 auto !important;
    padding: 5px 10px !important;
    text-align: center;
    width: 100%;
    float: none !important;
    font-size: 14px;
}

/* Mobile Navigation Button */
#mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10005 !important;
    background: #131212;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

#mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    z-index: 10004 !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

#mobile-nav.active {
    display: flex;
}

#mobile-nav ul {
    list-style: none;
    padding: 0;
    text-align: center;
}

#mobile-nav li {
    margin: 20px 0;
}

#mobile-nav a {
    font-size: 24px;
    color: #131212;
    text-decoration: none;
    font-family: 'Khmer UI', sans-serif;
}

/* Content scaling for responsive pages */
.content-body img {
    max-width: 100%;
    height: auto;
}

/* Media Queries */
@media screen and (max-width: 768px) {
    #mobile-menu-toggle {
        display: block;
    }

    #nav {
        display: none !important;
    }

    #nav, #cont {
        width: 100% !important;
        max-width: 100%;
    }
    
    #header {
        height: 232px !important;
    }
    
    #navref {
        height: 250px !important;
    }
    
    #menu1 {
        margin-left: 0 !important;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    #computerservice, #kontakt {
        width: 100% !important;
        max-width: 322px;
        background-size: 200% 100% !important;
    }
}
