/* ============================================================
   menu-desktop-mode-fix.css
   Fixes the stacked / overlapping header menu on madeeasy.in
   when a phone browser uses "Desktop site" (layout width ~980px).

   Selectors come from the centre page HTML:
   header#ctl00_rowtophead.header-sticky, .coll-us, .nav-top,
   .nav-bot, .main_manu, .navbar-nav, .nav-item, .nav-link

   LOAD THIS FILE LAST in <head> (after bootstrap.min-alpha6.css
   and jquery.fancybox.min.css), otherwise Bootstrap overrides it.

   !important is used because the winning rules live in
   style.css / responsive.css / megamenu.css, which were not
   available to inspect.
   ============================================================ */

/* Stop mobile browsers inflating text in desktop mode */
html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Only the 768px-991px band: phone "Desktop site" (~980px) and small tablets */
@media (min-width: 768px) and (max-width: 991px) {

  /* The header height must follow its content, so it never covers the page */
  header.header-sticky,
  header.header-sticky .nav-bot {
    height: auto !important;
    min-height: 0 !important;
  }

  /* Keep the collapsible area open at this width */
  header.header-sticky .navbar-collapse {
    display: flex !important;
    flex-basis: auto !important;
    width: 100%;
  }

  /* Both menus: one horizontal row that WRAPS to a second row if needed,
     instead of one item per line */
  header.header-sticky .navbar-nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
  }

  header.header-sticky .navbar-nav > .nav-item,
  header.header-sticky .navbar-nav > li {
    float: none !important;
    width: auto !important;
    flex: 0 0 auto;
    margin: 0 !important;
  }

  /* Blue main menu bar: centred, compact links */
  header.header-sticky .nav-bot .navbar-nav {
    justify-content: center;
  }

  header.header-sticky .nav-bot .navbar-nav > .nav-item > .nav-link {
    display: block;
    padding: 10px 9px !important;
    font-size: 12.5px !important;
    white-space: nowrap;
  }

  /* Small icon menu (Academic Counselling, Book Publications, Careers, Contact Us) */
  header.header-sticky .nav-top .navbar-nav {
    justify-content: flex-end;
  }

  /* The mobile-only extra menu must stay hidden at this width */
  header.header-sticky .mob-extra-menu {
    display: none !important;
  }

  /* Top-right pill buttons + phone number: wrap instead of overlapping */
  header.header-sticky .coll-us {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }

  header.header-sticky .coll-us > * {
    float: none !important;
    position: static !important;
    width: auto !important;      /* overrides the inline width:140px */
    margin: 0 !important;
  }
}


/* ============================================================
   PART 2 - SUBMENUS (mega menus) in the 768px-991px band
   In Bootstrap alpha6 collapsed mode, .dropdown-menu becomes
   position:static and is squeezed into the menu row. This puts
   each submenu back as an overlay panel under the blue bar.
   ============================================================ */
@media (min-width: 768px) and (max-width: 991px) {

  /* Anchor the panels to the whole blue bar, not to each menu item */
  header.header-sticky .nav-bot,
  header.header-sticky .nav-bot .main_manu {
    position: relative;
  }

  header.header-sticky .nav-bot .navbar-nav > .nav-item.dropdown {
    position: static !important;
  }

  /* Submenu = full-width overlay panel; scrolls if taller than the screen */
  header.header-sticky .nav-bot .navbar-nav .dropdown-menu.mega-menu:not(.center-mm) {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    margin: 0 !important;
    z-index: 1050;
    max-height: 70vh;
    overflow-y: auto;
  }

  /* The small "Centres" list stays a compact dropdown */
  header.header-sticky .nav-bot .navbar-nav .dropdown-menu.mega-menu.center-mm {
    position: absolute !important;
    top: 100% !important;
    left: auto !important;
    right: 0 !important;
    width: auto !important;
    min-width: 200px;
    float: none !important;
    margin: 0 !important;
    z-index: 1050;
  }

  /* Inner wrappers must not keep a fixed desktop width/height */
  header.header-sticky .mega-menu .about-hover,
  header.header-sticky .mega-menu .main-hover,
  header.header-sticky .mega-menu .main-hover-left {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
  }

  header.header-sticky .mega-menu .container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 15px;
    padding-right: 15px;
  }
}


/* ============================================================
   PART 3 - ALL MENUS (incl. hamburger icon) ON ONE ROW
   In the 768px-991px band the Bootstrap container is only 720px
   wide, so the 10 menus + hamburger wrapped and the hamburger
   dropped below the bar. This widens the bar, tightens the gaps
   and keeps everything on a single row.
   TUNING KNOBS: --nav-font and --nav-pad below.
   ============================================================ */
@media (min-width: 768px) and (max-width: 991px) {

  header.header-sticky .nav-bot {
    --nav-font: 11.5px;   /* lower to 11px / 10.5px if it still wraps */
    --nav-pad: 5px;       /* left/right space inside each menu link */
  }

  /* 1. Use the full screen width instead of the 720px container */
  header.header-sticky .nav-bot .container,
  header.header-sticky .nav-bot .main_manu,
  header.header-sticky .nav-bot .navbar {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
  }

  /* 2. One row, no wrapping; leftover space is shared evenly between items */
  header.header-sticky .nav-bot .navbar-nav {
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  /* 3. Compact items: no extra side padding/margins on the <li> */
  header.header-sticky .nav-bot .navbar-nav > li {
    flex: 0 1 auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
  }

  /* 4. Compact links */
  header.header-sticky .nav-bot .navbar-nav > .nav-item > .nav-link {
    padding: 10px var(--nav-pad) !important;
    font-size: var(--nav-font) !important;
    letter-spacing: 0 !important;
    white-space: nowrap;
  }

  /* 5. Hamburger icon: stays in the row, at the far end */
  header.header-sticky .nav-bot .navbar-nav > li.desk-menu {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center;
    padding: 0 6px !important;
  }

  header.header-sticky .nav-bot .hamburger-desk {
    margin: 0 !important;
    padding: 0 4px !important;
    line-height: 1;
    cursor: pointer;
  }
}

/* Narrow tablets (768-860px): squeeze a little more */
@media (min-width: 768px) and (max-width: 860px) {
  header.header-sticky .nav-bot {
    --nav-font: 10.5px;
    --nav-pad: 3px;
  }
}


/* ============================================================
   PART 4 - STOP THE HAMBURGER OVERLAPPING "NOTIFICATION"
   Two causes handled here:
   (a) the hamburger <li> is probably positioned absolutely by the
       desktop CSS, so it sits ON TOP of the last menu instead of
       after it -> forced back into normal flow;
   (b) the items were still slightly too wide -> tighter gaps and a
       font size that scales with the screen width.
   ============================================================ */
@media (min-width: 768px) and (max-width: 991px) {

  header.header-sticky .nav-bot {
    --nav-font: clamp(9.5px, 1.12vw, 11.5px);  /* scales with screen width */
    --nav-pad: 3px;                            /* space left/right of each menu name */
  }

  /* Menu items never shrink or overlap: each keeps its own space */
  header.header-sticky .nav-bot .navbar-nav > li.nav-item {
    flex: 0 0 auto !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  header.header-sticky .nav-bot .navbar-nav > li.nav-item > .nav-link {
    padding: 10px var(--nav-pad) !important;
    font-size: var(--nav-font) !important;
    letter-spacing: 0 !important;
    white-space: nowrap;
  }

  /* Hamburger: back into the normal row, after Notification */
  header.header-sticky .nav-bot .navbar-nav > li.desk-menu {
    position: static !important;
    float: none !important;
    transform: none !important;
    inset: auto !important;
    flex: 0 0 auto !important;
    width: auto !important;
    margin: 0 0 0 4px !important;
    padding: 0 4px !important;
    z-index: auto !important;
  }

  header.header-sticky .nav-bot .hamburger-desk {
    position: static !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    line-height: 1;
  }

  /* Small separators between items take less room */
  header.header-sticky .nav-bot .navbar-nav > li.nav-item {
    border-left-width: 0 !important;
  }
}

/* Narrow tablets: tighten one more step */
@media (min-width: 768px) and (max-width: 860px) {
  header.header-sticky .nav-bot {
    --nav-font: clamp(9px, 1.1vw, 10.5px);
    --nav-pad: 2px;
  }
}


/* ============================================================
   PART 5 - CENTRE EVERY MENU NAME INSIDE ITS CELL
   Each menu item becomes a cell that shares the spare bar width
   equally, with its text centred horizontally and vertically.
   ============================================================ */
@media (min-width: 768px) and (max-width: 991px) {

  /* Cells fill the full height of the bar */
  header.header-sticky .nav-bot .navbar-nav {
    align-items: stretch !important;
    justify-content: flex-start !important;
  }

  /* Each menu cell grows to share the free space; never shrinks */
  header.header-sticky .nav-bot .navbar-nav > li.nav-item {
    flex: 1 1 auto !important;
    display: flex !important;
    align-items: center;            /* vertical centre */
    justify-content: center;        /* horizontal centre */
    text-align: center !important;
  }

  header.header-sticky .nav-bot .navbar-nav > li.nav-item > .nav-link {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-align: center !important;
    padding-left: var(--nav-pad) !important;
    padding-right: var(--nav-pad) !important;
  }

  /* Hamburger cell: fixed size, icon centred vertically */
  header.header-sticky .nav-bot .navbar-nav > li.desk-menu {
    flex: 0 0 auto !important;
    align-self: stretch;
    display: flex !important;
    align-items: center;
    justify-content: center;
  }
}
