/* Basis mobile menu styling */
.mobilenav {
  display: none;
}

/* Menu styling voor tablets en mobiel */
@media only screen and (max-width: 992px) {
  #desktopnav {
    display: none !important;
  }

  #myNav,
  .mobilenav {
    display: block !important;
  }

  .mobilenav {
    font-size: 28px;
    cursor: pointer;
    background: transparent;
    padding: 8px 12px;
    color: #333;
    position: absolute;
    right: 20px;
    top: 20px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    z-index: 499;
  }

  .mobilenav:hover {
    background-color: rgba(0, 0, 0, 0.1);
  }

  .overlay {
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 500;
    top: 0;
    left: 0;
    background-color: rgba(42, 42, 42, 0.85); /* Toegevoegde opacity */
    overflow-x: hidden;
    transition: all 0.4s ease-in-out;
    backdrop-filter: blur(5px); /* Extra effect voor moderne browsers */
  }

  /* Logo styling in mobile menu */
  .overlay .logo.mobile {
    padding: 20px;
    text-align: center;
    margin-top: 60px;
    width: 100%;
  }

  /* Specifieke CCM image block styling */
  .overlay .logo.mobile .ccm-image-block,
  .overlay .logo.mobile img.ccm-image-block,
  .overlay .logo.mobile .img-fluid {
    width: 450px !important;
    height: auto !important;
    max-width: 90% !important;
    margin: 0 auto;
    display: block;
  }

  .overlay-content {
    position: relative;
    width: 100%;
    text-align: center;
    padding: 20px;
    margin-top: 30px;
  }

  .overlay a {
    padding: 20px 8px;
    text-decoration: none;
    font-size: 28px !important;
    color: #ffffff !important;
    display: block;
    transition: all 0.3s ease;
    font-family: inherit;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    -webkit-tap-highlight-color: transparent; /* Voorkom highlight op mobiel */
  }

  .overlay-content .nav {
    max-height: calc(100vh - 200px);
    display: block !important;
    overflow: auto !important;
    padding: 20px 0;
  }

  .overlay a:hover,
  .overlay a:focus {
    color: #82B03C !important;
  }

  .overlay .closebtn {
    position: fixed; /* Changed to fixed for better positioning */
    top: 20px;
    right: 25px;
    font-size: 46px !important;
    line-height: 1 !important;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    z-index: 502;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .overlay .closebtn:hover {
    color: #82B03C !important;
  }

  /* Touch device optimizations */
  .overlay-content .nav {
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
  }

  .overlay[style*="width: 100%"] .overlay-content a {
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
    animation-delay: calc(var(--item-index) * 0.1s);
  }

  .subheader {
    background: rgba(130, 176, 60, 0.9); /* Opacity toegevoegd aan achtergrond */
    padding: 15px 0; /* Extra padding voor twee rijen */
  }

  .subheader .nav {
    flex-wrap: wrap !important; /* Force wrap op mobiel */
    justify-content: center;
    overflow-x: visible;
    padding: 0 15px;
  }

  .subheader .nav > li {
    flex: 1 1 auto;
    width: calc(50% - 10px); /* Ongeveer twee items per rij */
    min-width: 0; /* Reset min-width */
    margin: 5px;
  }

  .subheader .nav > li > a {
    font-size: 15px;
    padding: 10px 5px;
    white-space: normal; /* Sta text wrapping toe indien nodig */
  }

  /* Reset divider voor mobiel */
  .subheader .nav > li::after {
    display: none;
  }

  .subheader {
    background: rgba(130, 176, 60, 0.9);
    padding: 10px;
  }

  .subheader .nav {
    padding: 0 10px;
    gap: 8px;
    grid-template-columns: repeat(2, 1fr); /* 2 kolommen op mobiel */
  }

  .subheader .nav > li {
    min-width: calc(50% - 4px); /* 2 items per rij op mobiel */
  }

  .subheader .nav > li > a {
    font-size: 15px;
    padding: 8px 5px;
    white-space: normal;
  }

  .subheader .nav {
    gap: 8px;
  }

  .subheader .nav > li {
    flex: 1;
    min-width: calc(25% - 6px); /* 4 items per rij */
    max-width: calc(25% - 6px);
  }

  .subheader {
    background: rgba(130, 176, 60, 0.9);
    padding: 10px;
  }

  .subheader .nav {
    flex-flow: row wrap;
    gap: 8px;
    padding: 0 10px;
  }

  .subheader .nav > li {
    flex: 0 1 calc(25% - 6px); /* Blijft 4 items per rij */
  }
}

/* Extra breakpoint voor kleine tablets */
@media only screen and (max-width: 768px) {
  .mobilenav {
    top: 15px;
    right: 15px;
  }
  
  .overlay .closebtn {
    top: 15px;
    right: 20px;
  }
  
  .subheader .nav > li > a {
    padding: 8px 10px;
    font-size: 13px;
  }
}

/* Extra breakpoint voor mobiele telefoons */
@media only screen and (max-width: 480px) {
  .overlay a {
    font-size: 24px !important;
    padding: 15px 8px;
  }
  
  .mobilenav {
    top: 10px;
    right: 10px;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media only screen and (max-width: 1200px) {
  .subheader .nav {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 15px;
  }
  
  .subheader .nav::-webkit-scrollbar {
    display: none;
  }
}

@media only screen and (max-width: 992px) {
  .subheader {
    background: rgba(130, 176, 60, 0.7); /* Verminderde opacity */
    padding: 10px 0;
  }

  .subheader .nav {
    display: flex;
    flex-direction: row; /* Zorgt voor horizontale flow */
    flex-wrap: wrap;
    justify-content: flex-start; /* Start vanaf links */
    gap: 10px;
    width: 100%;
  }

  .subheader .nav > li {
    flex: 0 1 calc(25% - 8px); /* 4 items per rij, rekening houdend met gap */
    min-width: 0;
    margin: 0;
  }

  .subheader .nav > li > a {
    font-size: 14px;
    padding: 8px 5px;
    white-space: normal;
    text-align: center;
    display: block;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
  }

  /* Reset divider voor mobiel */
  .subheader .nav > li::after {
    display: none;
  }

}

/* Extra kleine schermen */
@media only screen and (max-width: 576px) {
  .subheader .nav > li {
    flex: 0 1 calc(50% - 5px); /* 2 items per rij op kleine schermen */
  }

  
  .subheader .nav > li > a {
    font-size: 13px;
    padding: 6px 4px;
  }
}

/* Extra aanpassingen voor kleinere schermen */
@media only screen and (max-width: 576px) {
  .subheader .nav {
    min-width: 100%; /* Full width op kleine schermen */
    grid-template-columns: 1fr; /* 1 kolom op zeer kleine schermen */
  }
  
  .subheader .nav > li > a {
    font-size: 14px;
    padding: 6px 4px;
  }

  .subheader .nav > li {
    min-width: calc(50% - 4px); /* 2 items per rij */
    max-width: calc(50% - 4px);
  }

  .subheader .nav > li {
    flex: 0 1 calc(50% - 4px); /* 2 items per rij op kleine schermen */
  }
  
  .subheader .nav > li > a {
    font-size: 13px;
    padding: 8px 4px;
    white-space: normal; /* Sta tekstomslag toe op kleine schermen */
  }
}/* Tablet en desktop layout behouden, alleen aanpassingen voor mobiel */@media only screen and (max-width: 576px) {  .subheader .nav {    padding: 0 5px; /* Minder padding */    gap: 5px; /* Kleinere tussenruimte */  }  .subheader .nav > li > a {    font-size: 13px; /* Kleinere tekst */    padding: 8px 4px; /* Minder padding rond tekst */    letter-spacing: -0.2px; /* Tekst iets compacter */  }}

/* Behoud dezelfde layout als tablet, alleen kleiner */
@media only screen and (max-width: 576px) {
  .subheader .nav {
    display: flex;
    flex-flow: row wrap;
    justify-content: space-between;
    gap: 5px;
    padding: 5px;
  }

  .subheader .nav > li {
    flex: 0 1 calc(25% - 4px); /* Blijf 4 items per rij */
    min-width: 0;
  }

  .subheader .nav > li > a {
    font-size: 12px; /* Kleinere tekst */
    padding: 6px 2px;
    letter-spacing: -0.2px;
  }
}