/**
 * Mobile Fixes for Primary Care Plus
 * Clean rebuild - Version 3
 */

/* ============================================
   SECTION 1: Viewport & Overflow Fixes
   ============================================ */
html {
  overflow-x: hidden !important;
}

body {
  overflow-x: hidden !important;
}

.dmInner,
.dmOuter,
#dm-outer-wrapper,
#dmStyle_outerContainer,
#dmStyle_innerContainer,
.dmLayoutWrapper,
#site_content,
.site_content {
  min-width: 0 !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

/* ============================================
   SECTION 2: Mobile Column Layouts
   ============================================ */
@media (max-width: 767px) {
  .dmRespCol,
  .dmRespCol[class*="large-"],
  .dmRespCol[class*="medium-"] {
    width: 100% !important;
    float: none !important;
    display: block !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .dmRespColsWrapper {
    display: flex !important;
    flex-direction: column !important;
  }

  .dmRespRow {
    padding: 20px 15px !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
  }

  h1, h2, h3, p {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
  }

  #dm div.dmContent h1,
  #dm div.dmContent h2 {
    font-size: 24px !important;
    line-height: 1.3 !important;
  }

  #dm div.dmContent h3 {
    font-size: 20px !important;
  }

  .dmRespCol.empty-column,
  .dmRespCol:empty {
    display: none !important;
  }

  img {
    max-width: 100% !important;
    height: auto !important;
  }

  .dmWidget {
    max-width: 100% !important;
  }
}

/* ============================================
   SECTION 3: Hide Original Duda Drawer
   ============================================ */
@media (max-width: 1024px) {
  #hamburger-drawer,
  .hamburger-drawer,
  .layout-drawer,
  #layout-drawer-overlay,
  .layout-drawer-overlay {
    display: none !important;
    visibility: hidden !important;
  }
}

/* ============================================
   SECTION 4: New Mobile Menu Styles
   ============================================ */

/* Overlay */
#mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#mobile-menu-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Drawer */
#mobile-menu-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 85vw;
  max-width: 320px;
  height: 100vh;
  height: 100dvh;
  background-color: #003399;
  z-index: 99999;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

#mobile-menu-drawer.is-open {
  transform: translateX(0);
}

/* Menu Header */
.mobile-menu-header {
  display: flex;
  justify-content: flex-end;
  padding: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 32px;
  cursor: pointer;
  padding: 5px 10px;
  line-height: 1;
}

.mobile-menu-close:hover {
  color: #99ccff;
}

/* Navigation */
.mobile-menu-nav {
  padding: 0;
}

.mobile-menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-menu-list > li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-list > li > a {
  display: block;
  padding: 18px 20px;
  color: #ffffff;
  text-decoration: none;
  font-size: 18px;
  font-family: inherit;
  transition: background-color 0.2s ease;
}

.mobile-menu-list > li > a:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Submenu toggle arrow */
.mobile-menu-list .arrow {
  float: right;
  font-size: 12px;
  transition: transform 0.3s ease;
}

/* Submenu */
.mobile-menu-list .submenu {
  list-style: none;
  margin: 0;
  padding: 0;
  background-color: #002266;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.mobile-menu-list .submenu li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-menu-list .submenu li:last-child {
  border-bottom: none;
}

.mobile-menu-list .submenu a {
  display: block;
  padding: 14px 20px 14px 35px;
  color: #ccddff;
  text-decoration: none;
  font-size: 16px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-menu-list .submenu a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Hamburger button z-index fix */
.layout-drawer-hamburger,
#layout-drawer-hamburger {
  z-index: 100000 !important;
}

/* Hide Contact Us button in mobile header */
[id="1322170030"],
.hamburger-header-container .dmButtonLink,
#hamburger-header-container .dmButtonLink,
#hamburger-header .dmButtonLink,
a.u_1585272651,
[id="1585272651"],
.showOnMedium .dmButtonLink {
  display: none !important;
  visibility: hidden !important;
}

/* ============================================
   SECTION 5: Additional Mobile Fixes
   ============================================ */
@media (max-width: 767px) {
  .fullBleedMode {
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow: hidden !important;
  }

  .fullBleedMode > .dmRespColsWrapper {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }

  /* Reduce image container heights */
  .imageWidget,
  [class*="blogImg"],
  .blogImgLink {
    height: auto !important;
    max-height: 300px !important;
  }

  /* Forms */
  input, textarea, select {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}
