/* =====================================================================
   RESPONSIVE FIXES — Pharma Edutech
   -----------------------------------------------------------------
   Purpose : make every page behave correctly on mobile, tablet,
             laptop, desktop and large-desktop screens.
   Scope   : layout / structure only. No content, copy, fonts or
             images are changed — this file only patches spacing,
             wrapping and show/hide behaviour so existing content
             reflows correctly at every screen size.
   Load    : this file must be linked AFTER all other stylesheets
             (bootstrap.min.css, style.css, css.css, global.css …)
             so its rules can safely override the legacy CSS.
   ===================================================================== */


/* ---------------------------------------------------------------------
   0. GLOBAL SAFETY NET
   Prevents any stray fixed-width element from forcing a horizontal
   scrollbar / clipped content on small screens.
--------------------------------------------------------------------- */
html {
    -webkit-text-size-adjust: 100%;
}
html, body {
    max-width: 100%;
    overflow-x: hidden;
}
img, iframe, video, embed, object {
    max-width: 100%;
    height: auto;
}
.flexslider img {
    height: auto; /* keep slider images intrinsic, flexslider already sizes the wrapper */
}

/* Any legacy <table> that isn't already inside .table-responsive
   gets horizontal scrolling instead of squeezing/breaking on phones */
@media (max-width: 767px) {
    table {
        max-width: 100%;
    }
    table.table:not(.table-responsive table) {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}


/* ---------------------------------------------------------------------
   1. PRIMARY NAVIGATION (the reported bug)
   -----------------------------------------------------------------
   Root cause: `.site-nav` is set to `white-space: nowrap` and its
   items use `display:inline-block`, so on phones the open mobile
   menu overflows sideways instead of stacking — only "Home / About
   Us / Programmes" stay on-screen and the rest of the links become
   unreachable. The submenus also only ever open on `:hover`, which
   doesn't exist on touch devices, so they'd be unusable even if the
   overflow were fixed.

   Fix: below the tablet breakpoint (767px) the menu is turned into
   a full-width, vertically stacked list, and submenus become
   tap-to-expand accordions (behaviour added in js/responsive-nav.js).
   Desktop/tablet hover behaviour above 767px is left completely
   untouched.
--------------------------------------------------------------------- */
@media (max-width: 767px) {

    .navbar-header {
        float: none;
    }
    .navbar-toggle {
        display: block;
    }
    .navbar-collapse.collapse.in {
        max-height: 75vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .nav-bg {
        padding: 0;
    }

    /* stack the top-level items full width instead of nowrap-inline */
    .site-nav {
        white-space: normal;
        width: 100%;
        margin: 0 !important;
    }
    .site-nav > li {
        display: block;
        float: none;
        width: 100%;
    }
    .site-nav > li > a {
        display: block;
        width: 100%;
        box-sizing: border-box;
        border-left: none !important;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
    }
    .site-nav > li:first-child > a {
        border-top: none;
    }

    /* submenus: switch from absolute hover-flyouts to static tap panels */
    .site-nav .flyout,
    .site-nav .flyout-alt {
        position: static;
    }
    .site-nav .flyout-content {
        position: static !important;
        left: 0 !important;
        top: auto !important;
        width: 100% !important;
        height: 0;
        overflow: hidden;
        background-color: #899C26 !important;
    }
    .site-nav .flyout.mobile-open > .flyout-content,
    .site-nav .flyout-alt.mobile-open > .flyout-content {
        height: auto !important;
        overflow: visible !important;
    }
    .site-nav .flyout-content > li > a {
        padding-left: 30px;
    }

    /* rotate the existing caret icon to show open/closed state
       (no new icon added, just re-using the fa-angle-down already in the markup) */
    .site-nav .flyout > a .fa-angle-down,
    .site-nav .flyout-alt > a .fa-angle-down {
        float: right;
        transition: transform .2s ease;
    }
    .site-nav .flyout.mobile-open > a .fa-angle-down,
    .site-nav .flyout-alt.mobile-open > a .fa-angle-down {
        transform: rotate(180deg);
    }
}


/* ---------------------------------------------------------------------
   2. HEADER (logo / contact bar / flag icons)
   Bootstrap's un-prefixed col-md-* already stacks these full width
   below 992px; these tweaks just clean up spacing once stacked.
--------------------------------------------------------------------- */
@media (max-width: 767px) {
    header .top .col-md-9,
    header .top .col-md-3 {
        text-align: center;
    }
    .navbar-brand {
        float: none;
        display: inline-block;
        margin-top: 15px;
    }
    .container.padding0 .col-md-7,
    .container.padding0 .col-md-5 {
        float: none;
        width: 100%;
        text-align: center;
    }
    .container.padding0 .col-md-5[style] {
        margin-top: 10px !important;
    }
}


/* ---------------------------------------------------------------------
   3. SLIDER CAPTION
   Keeps the flexslider caption box inside the viewport instead of a
   fixed 295px box that can crowd very narrow screens.
--------------------------------------------------------------------- */
@media (max-width: 480px) {
    .main-slider .flex-caption {
        width: 100%;
        box-sizing: border-box;
        left: 0;
        right: 0;
    }
}


/* ---------------------------------------------------------------------
   4. TABLET (768px – 991px) fine tuning
--------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 991px) {
    .site-nav {
        white-space: normal;
    }
    .site-nav > li > a {
        padding: 10px 8px;
    }
}
