/*-----------------------------------------------------------------------------------
 * NSAF WordPress Theme - Mobile Responsive Stylesheet
 * Ensures robust responsive layout across phones (320px-480px),
 * tablets (768px-1024px), and smaller desktop screens (< 1200px).
 *-----------------------------------------------------------------------------------*/

/* 1. Global Anti-Overflow & Fluid Media Protection */
html,
body {
  overflow-x: hidden !important;
  max-width: 100% !important;
  width: 100% !important;
  position: relative;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Ensure all media scales fluidly within parent containers */
img,
video,
iframe,
embed,
object {
  max-width: 100% !important;
  height: auto;
}

/* Responsive Table Container */
table {
  max-width: 100% !important;
  width: 100% !important;
}

.entry-content table,
.post_content table,
.table-responsive-wrapper,
.wp-block-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 2. Header & Sticky Header */
#sticky-header {
  padding-left: 15px;
  padding-right: 15px;
}

.logo img,
.sticky-logo img {
  max-width: 100% !important;
  height: auto !important;
  max-height: 60px;
}

@media (max-width: 767.98px) {
  .logo img,
  .sticky-logo img {
    max-height: 48px;
    width: auto;
  }
}

/* Hamburger button accessible tap target */
.hamburger-menu > a {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
}

.hamburger-menu > a span {
  display: block;
  background: #0C8442;
  width: 24px;
  height: 2.5px;
  margin: 2px 0;
  border-radius: 2px;
  padding: 0;
  line-height: 0;
  transition: all 0.3s ease;
}

.hamburger-menu > a.active span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.hamburger-menu > a.active span:nth-child(2),
.hamburger-menu > a.active span:nth-child(3) {
  opacity: 0;
}

.hamburger-menu > a.active span:nth-child(4) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* 3. Mobile Navigation Drawer (.slide-bar) */
.slide-bar {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 380px;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 20px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  background: #0C8442;
  background: linear-gradient(135deg, rgba(20, 130, 69, 0.96) 0%, rgba(12, 132, 66, 0.98) 100%);
  z-index: 99999;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.25);
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 480px) {
  .slide-bar {
    max-width: 100%;
    padding: 16px 20px;
  }
}

.slide-bar.show {
  right: 0 !important;
}

/* Close button in mobile drawer */
.close-mobile-menu {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.close-mobile-menu a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 22px;
  color: #ffffff;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.2s ease, transform 0.2s ease;
}

.close-mobile-menu a:hover,
.close-mobile-menu a:focus {
  background: #F6960E;
  color: #fff;
  transform: scale(1.05);
}

/* Search form in mobile drawer */
.mobile-search-form {
  position: relative;
  margin-bottom: 20px;
}

.mobile-search-form .side-search-form {
  position: relative;
  display: flex;
  align-items: center;
}

.mobile-search-form input.search {
  width: 100%;
  height: 44px;
  padding: 8px 46px 8px 14px;
  font-size: 15px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  outline: none;
}

.mobile-search-form input.search::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.mobile-search-form input.search:focus {
  background: rgba(255, 255, 255, 0.26);
  border-color: #F6960E;
}

.mobile-search-form button {
  position: absolute;
  right: 0;
  top: 0;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 0 6px 6px 0;
}

/* Mobile Navigation Links and Submenus */
.side-mobile-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.side-mobile-menu ul li {
  position: relative;
  display: block;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.side-mobile-menu ul li a {
  display: block;
  padding: 12px 48px 12px 4px;
  color: #ffffff;
  font-size: 16px;
  font-family: 'Koulen', 'KhmerOScontent', sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.4;
  word-break: break-word;
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.side-mobile-menu ul li a:hover,
.side-mobile-menu ul li.open > a {
  color: #F6960E;
}

/* Integrated Submenu Toggle Button */
.side-mobile-menu ul li button.dropdown-toggle-btn {
  position: absolute !important;
  right: 0 !important;
  top: 0 !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  min-height: 44px;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  color: #ffffff !important;
  font-size: 16px !important;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  z-index: 5;
  float: none !important;
  transition: transform 0.25s ease, color 0.2s ease;
}

.side-mobile-menu ul li.open > button.dropdown-toggle-btn {
  transform: rotate(180deg);
  color: #F6960E !important;
}

.side-mobile-menu ul li ul.sub-menu {
  display: none;
  padding: 4px 0 8px 12px;
  margin: 0 0 6px 0;
  list-style: none;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

.side-mobile-menu ul li.open > ul.sub-menu,
.side-mobile-menu ul li ul.sub-menu.mm-show {
  display: block !important;
}

.side-mobile-menu ul li ul.sub-menu li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.side-mobile-menu ul li ul.sub-menu li:last-child {
  border-bottom: none;
}

.side-mobile-menu ul li ul.sub-menu li a {
  padding: 9px 8px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  text-transform: none;
  font-family: inherit;
}

.side-mobile-menu ul li ul.sub-menu li a:hover {
  color: #F6960E;
  padding-left: 12px;
}

/* Mobile Beneficiary Button in Drawer */
.mobile-beneficiary-btn .benifit-user {
  display: block;
  text-align: center;
  background: #F6960E;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 15px;
  text-transform: uppercase;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.mobile-beneficiary-btn .benifit-user:hover {
  background: #d87d00;
  color: #ffffff;
}

/* Mobile Language Selector */
.mobile-language-selector {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.mobile-language-selector a {
  color: #ffffff;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-size: 13px;
}

/* 4. Responsive Image & Content Overrides */
@media (max-width: 1199.98px) {
  .ssp-beneficiaries-first-image img,
  .ssp-beneficiaries-fourth-Image img,
  .ssp-beneficiaries-eigtht-images img,
  .sap-beneficiaries-first-image img,
  .sap-beneficiaries-last-same-image-section img,
  .sap-beneficiaries-last-same-image-section-orange img,
  .ssp-fourth-Image img,
  .sap-first-image img,
  .ssp-first-image img,
  .custom-vc-social-security-single-image img,
  .custom-vc-benefit-single-image img,
  .custom-vc-picture-column-single-image-two img,
  .custom-vc-picture-column-single-image-two-needed img,
  .custom-vc-picture-column-single-image-three img,
  .custom-vc-picture-column-single-image-three-social img,
  .custom-vc-double-image img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    margin-left: 0 !important;
  }

  /* Decorative pseudo-elements that cause horizontal overflow */
  .custom-vc-benefit-single-image:before,
  .custom-vc-note-single-image:before,
  .sap-custom-background-twoImages:before,
  .ssp-fourth-Image:before,
  .ssp-beneficiaries-fourth-Image:before,
  .ssp-beneficiaries-eigtht-images:before {
    display: none !important;
  }

  .ssp-background-image,
  .ssp-background-image-second {
    display: none !important;
  }
}

/* 5. Typography & Headings on Mobile */
@media (max-width: 767.98px) {
  h1,
  .page-titles {
    font-size: 26px !important;
    line-height: 1.35 !important;
  }

  h2,
  .post-title,
  .section-title h2 {
    font-size: 22px !important;
    line-height: 1.4 !important;
  }

  h3 {
    font-size: 18px !important;
    line-height: 1.45 !important;
  }

  .custom-header-large h1,
  .custom-header-large h2,
  .custom-header-large h3 {
    font-size: 28px !important;
  }

  .custom-header-default h1,
  .custom-header-default h2,
  .custom-header-default h3 {
    font-size: 24px !important;
  }

  .custom-header-medium h1,
  .custom-header-medium h2,
  .custom-header-medium h3 {
    font-size: 20px !important;
  }

  /* Beneficiary Cards */
  .events-content {
    position: relative !important;
    bottom: auto !important;
    padding: 15px !important;
    width: 100% !important;
  }

  .events-content h3 {
    width: 100% !important;
    max-width: 100% !important;
    white-space: normal !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
    margin-top: 8px !important;
    word-break: break-word !important;
  }

  /* FAQ Accordion on Mobile */
  .faq-details-area h3 {
    font-size: 24px !important;
  }

  .faq-wrapper button.green,
  .faq-wrapper button.light-blue {
    font-size: 16px !important;
    padding: 10px 14px !important;
  }

  /* Step elements */
  .vc_step-title {
    font-size: 1.35rem !important;
  }

  .vc_step-number {
    font-size: 2rem !important;
  }

  /* Indent and spacing fixes */
  .indent-120,
  .indent-65,
  .indent-35 {
    padding-left: 0px !important;
  }

  .pt-130 {
    padding-top: 45px !important;
  }

  .head-nosidebar {
    padding-top: 45px !important;
    padding-bottom: 20px !important;
  }

  /* Hide decorative side wings causing horizontal scroll */
  .mission > div::before,
  .vission > div::after {
    display: none !important;
  }

  .search-now {
    position: static !important;
    width: 100% !important;
    right: auto !important;
    transform: none !important;
    margin-top: 15px;
  }

  /* News List Items on Mobile */
  .news-list-item {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 15px 0 !important;
  }

  .news-list-item .img-wrapper {
    width: 100% !important;
    margin-bottom: 12px;
  }

  .news-list-item .post-info-2 {
    margin-left: 0 !important;
    width: 100% !important;
  }

  /* Category Item Thumbnails */
  .list-item .tumbnail {
    margin-bottom: 15px;
  }

  /* Owl Carousel navigation within bounds */
  .owl-carousel .nav-btn.pre-slide {
    margin-left: 0 !important;
    left: 5px !important;
  }

  .owl-carousel .next-slide {
    right: 5px !important;
  }

  /* Footer on Mobile */
  .footer-area {
    padding-top: 25px;
    padding-bottom: 15px;
  }

  .footer-widget {
    margin-bottom: 25px;
  }

  .footer-widget .footer-widget-title {
    font-size: 18px;
    line-height: 1.4;
    margin-bottom: 12px;
  }

  .copyright-area {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .copyright-text {
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
  }
}
