/* ==========================================================================
   WEVIUS EDUCATION — RESPONSIVE HOMEPAGE STYLES
   File: assets/css/mobile-home.css

   Responsibilities
   1) Header + search layout on Mobile + Tablet (<= 1100px)
   2) Full-Screen Blurred Mobile Menu (<= 1100px)
   3) Homepage layout tweaks on Mobile only (<= 900px)
   4) Keep AJAX search grid hidden by default (outside media queries)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@500;600;700;800&display=swap');

/* --------------------------------------------------------------------------
   0) WORDPRESS ADMIN BAR OFFSETS
   -------------------------------------------------------------------------- */
html body.admin-bar .site-header {
  top: 32px !important;
}

@media (max-width: 782px) {
  html body.admin-bar .site-header {
    top: 46px !important;
  }
}

/* --------------------------------------------------------------------------
   1) HEADER + SEARCH + MENU (MOBILE + TABLET)
   Applies to: max-width 1100px
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {

  /* --- HEADER RE-LAYOUT --- */
  html body .site-header {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 18px 0 0 0 !important; /* Top padding only */
    height: auto !important;
    gap: 0 !important;
    box-shadow: none !important;
    border-bottom: none !important;
  }

  html body .site-header .header-left {
    flex: 0 0 auto !important;
    padding-left: 20px !important;
  }

  html body .site-header .header-right {
    flex: 0 0 auto !important;
    padding-right: 20px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
  }

  /* Hide desktop-only elements */
  html body .site-header .header-right .nav-link,
  html body .site-header .header-right .cta-button,
  html body .site-header .desktop-only {
    display: none !important;
  }

  /* FIX: Force "Accedi" button and Avatar to show on mobile. 
     Using 'div.user-login-btn' overrides the .desktop-only 
     class because it has higher specificity. */
  html body .site-header .header-right div.user-login-btn {
    display: flex !important;
  }

  /* Ensure the wrapper also stays visible */
  html body .user-profile-menu {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
  }

  html body .user-avatar-placeholder {
    display: flex !important;
  }



  /* --- SEARCH BAR STRIP --- */
  html body .site-header .header-center {
    order: 3 !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 18px 0 0 0 !important;
    padding: 15px 20px !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
    display: flex !important;
    position: relative !important;
  }

  html body .site-header .search-form-container {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: none !important;
  }

  html body .site-header .search-input {
    width: 100% !important;
    font-size: 16px !important; /* Prevents iOS zoom */
    padding: 12px 110px 12px 20px !important;
    box-sizing: border-box !important;
    border-radius: 25px !important;
    background: #ffffff !important;
    color: #333 !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05) !important;
  }

  html body .site-header .search-submit {
    position: absolute !important;
    right: 6px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 10 !important;
  }

  /* --- BURGER MENU ICON --- */
  html body .mobile-menu-toggle {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 4px !important;
    width: 32px !important;
    height: 24px !important;
    box-sizing: border-box !important;
    z-index: 99999 !important;
  }

  html body .mobile-menu-toggle span {
    display: block !important;
    width: 100% !important;
    height: 3px !important;
    background-color: #fff !important;
    border-radius: 3px !important;
    transition: all 0.3s ease !important;
  }






  /* --- FULL-SCREEN BLURRED MENU --- */
  html body .mobile-menu-backdrop {
    position: fixed !important;
    top: 0 !important; 
    left: 0 !important; 
    width: 100vw !important; 
    height: 100vh !important;
    /* Updated Menu Background Color */
    background: #5d4b8cd9 !important; 
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    z-index: 200000 !important;
    opacity: 0 !important; 
    visibility: hidden !important;
    transition: opacity 0.3s ease !important;
    margin: 0 !important;
    display: block !important; 
  }

  html body .mobile-menu-panel {
    position: fixed !important;
    top: 0 !important; 
    left: 0 !important; 
    right: auto !important; 
    width: 100vw !important; 
    height: 100vh !important;
    background: transparent !important;
    z-index: 200001 !important;
    display: flex !important; 
    flex-direction: column !important; 
    justify-content: center !important; 
    align-items: center !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: scale(0.95) !important;
    transition: all 0.3s ease !important;
    pointer-events: none !important;
    padding: 0 !important;
  }

  /* Active States (Toggled by JS) */
  html body .mobile-menu-backdrop.active {
    opacity: 1 !important;
    visibility: visible !important;
  }

  html body .mobile-menu-panel.active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: scale(1) !important;
    pointer-events: auto !important;
  }

  /* Prevent body scroll when menu is open */
  html body.mobile-menu-open {
    overflow: hidden !important;
  }

  /* Menu Close (X) Button */
  html body .mobile-menu-close {
    position: absolute !important;
    top: 25px !important; 
    right: 25px !important;
    background: none !important;
    border: none !important;
    color: #fff !important;
    font-size: 40px !important;
    font-weight: 300 !important;
    cursor: pointer !important;
    padding: 5px !important;
    line-height: 1 !important;
  }

  /* Menu Links Container */
  html body .mobile-menu-panel ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 80% !important;
    max-width: 320px !important;
    text-align: center !important;
  }

  html body .mobile-menu-panel li {
    margin: 0 !important;
    width: 100% !important;
    /* ADDED: Light semi-transparent line between items */
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important; 
    padding: 5px 0 !important; /* Added slight padding so borders aren't too close to buttons */
  }

  /* ADDED: Remove the border from the last item AND the item right before it */
  html body .mobile-menu-panel li:last-child,
  html body .mobile-menu-panel li.last-text-link,
  html body .mobile-menu-panel li:nth-last-child(2) {
    border-bottom: none !important;
  }


  /* Default Menu Link Style (Used for Informazioni) */
  html body .mobile-menu-panel .menu-text-link {
    display: block !important;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 19px !important; /* Reduced by 20% */
    font-family: 'Raleway', sans-serif !important; 
    font-weight: 500 !important; /* Changed to Medium weight */
    padding: 15px 0 !important;
    background: transparent !important;
    margin: 5px auto !important;
  }



  /* ==========================================================================
     CUSTOM HIGHLIGHTS FOR MOBILE MENU ITEMS
     ========================================================================== */

  /* "Per le scuole" - Light purple box, dark purple text */
  html body .mobile-menu-panel li a[href*="per-le-scuole"].menu-text-link {
    background-color: #d8d0ed !important; 
    color: #473589 !important; 
    border-radius: 12px !important;
    padding: 15px 20px !important;
    margin: 10px auto !important;
    width: 90% !important;
    font-weight: 500 !important; /* CHANGED from 800 to 500 */
    font-size: 20px !important; 
    letter-spacing: 0.5px !important;
    transition: transform 0.2s ease, background-color 0.2s ease !important;
  }

  html body .mobile-menu-panel li a[href*="per-le-scuole"].menu-text-link:active {
    transform: scale(0.95) !important;
    background-color: #cbbce3 !important;
  }

  /* "Accedi / Registrati" Button - Orange box, white text */
  html body .mobile-menu-panel li button.menu-text-link {
    background-color: #FEB05C !important;
    color: #ffffff !important;
    /* ADD THIS LINE FOR THE BLACK CONTOUR/SHADOW */
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4) !important;
    
    border-radius: 12px !important;
    padding: 15px 20px !important;
    margin: 10px auto !important;
    width: 90% !important;
    font-weight: 500 !important; /* CHANGED from 800 to 500 */
    letter-spacing: 0.5px !important;
    transition: transform 0.2s ease, background-color 0.2s ease !important;
    border: none !important;
    cursor: pointer !important;
    font-family: 'Raleway', sans-serif !important;
    font-size: 20px !important; 
  }




}

/* --------------------------------------------------------------------------
   2) HOMEPAGE LAYOUT (MOBILE ONLY)
   Applies to: max-width 900px
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {

  /* 2.1 Force pure white background */
  html,
  html body {
    min-height: unset !important;
    height: auto !important;
    background: #ffffff !important;
  }

  /* 2.2 Homepage container spacing */
  html body .homepage-container {
    padding: 0 20px 40px 20px !important;
    margin-bottom: 0 !important;
    min-height: 0 !important;
    background: transparent !important;
  }

  html body #homepage-content {
    padding: 0 !important;
    margin: 0 !important;
  }

  /* 2.3 Remove extra spacing under last row */
  html body #row-3,
  html body .video-row:last-of-type {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  /* 2.4 Filter bar: horizontal scroll */
  html body #wevius-filter-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    align-items: center !important;
    padding: 12px 20px !important;
    margin-top: 5px !important;
    margin-bottom: 20px !important;
    margin-left: -20px !important;
    margin-right: -20px !important;
    width: calc(100% + 40px) !important;
  }

  html body #wevius-filter-bar::-webkit-scrollbar {
    display: none !important;
  }

  html body #wevius-filter-bar::before {
    content: "Filtri" !important;
    display: inline-flex !important;
    align-items: center !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #000 !important;
    margin-right: 15px !important;
    padding-right: 15px !important;
    border-right: 1px solid #eaeaea !important;
    flex: 0 0 auto !important;
    height: 24px !important;
  }

  html body #wevius-filter-bar .filter-pill {
    flex: 0 0 auto !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
  }

  html body #wevius-filter-bar .filter-pill.active {
    background-color: #3C307B !important;
    color: #ffffff !important;
    box-shadow: none !important;
  }

  html body #wevius-filter-bar .filter-separator {
    display: none !important;
  }

  /* 2.5 Banners */
  html body .home-banner {
    display: block !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    margin-bottom: 20px !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 900 / 500 !important;
  }

  html body .banner-large,
  html body .banner-standard {
    height: auto !important;
    min-height: 160px !important;
  }

  html body .home-banner img,
  html body .home-banner picture,
  html body .home-banner picture img {
    height: 100% !important;
    width: 100% !important;
    object-fit: cover !important;
    display: block !important;
  }

  /* 2.6 Video rows: horizontal carousel */
  html body .video-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 15px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    margin-bottom: 20px !important;
    margin-left: -20px !important;
    margin-right: -20px !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    width: calc(100% + 40px) !important;
    box-sizing: border-box !important;
  }

  html body .video-row::-webkit-scrollbar {
    display: none !important;
  }

  html body .video-card-link {
    flex: 0 0 70% !important;
    min-width: 200px !important;
    margin-bottom: 0 !important;
    display: block !important;
    background: #fff !important;
    border: 8px solid #fff !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  html body .video-card-link img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 2.7 Info message + footer */
  html body #filter-info-message {
    margin-top: 10px !important;
    margin-bottom: 0 !important;
    padding: 15px !important;
  }

  html body .site-footer {
    padding: 20px 16px !important;
    margin-top: 0 !important;
  }


  /* ==========================================================================
     CUSTOM MOBILE TAP EFFECTS (Remove default grey highlight)
     ========================================================================== */
  
  /* 1. Remove the ugly default mobile grey tap highlight box */
  html body .header-right,
  html body .user-profile-menu,
  html body .user-login-btn,
  html body .mobile-menu-toggle {
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
  }

  /* 2. Login/Avatar Button: App-like shrink tap effect */
  html body .user-login-btn {
    transition: transform 0.15s ease, opacity 0.15s ease !important;
    transform-origin: center center !important;
  }
  
  /* When physically touching the login button */
  html body .user-login-btn:active {
    transform: scale(0.92) !important;
    opacity: 0.7 !important;
  }

  /* 3. Hamburger Menu: App-like shrink tap effect */
  html body .mobile-menu-toggle {
    transition: transform 0.15s ease, opacity 0.15s ease !important;
    transform-origin: center center !important;
  }
  
  /* When physically touching the hamburger menu */
  html body .mobile-menu-toggle:active {
    transform: scale(0.85) !important;
    opacity: 0.7 !important;
  }




}

/* --------------------------------------------------------------------------
   3) AJAX SEARCH RESULTS GRID
   -------------------------------------------------------------------------- */
html body #search-results-grid {
  display: none;
}

html body #search-results-grid[style*="display: none"],
html body #search-results-grid[style*="display:none"] {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}


  