/* ========== GLOBAL RESETS ========== */
html,
body {
  overflow-x: hidden;
  width: 100%;
}

/* ========== MODAL FIX (prevent full‑height modal) ========== */
.modal-content {
  height: auto;
  max-height: 90vh;
  overflow-y: auto;
}

/* ========== OLD PAGINATION / FILTER STYLES (unchanged) ========== */
.pb-4,
.py-4 {
  margin-left: 29px;
  padding-bottom: 1.5rem !important;
}
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
}
.pagination a {
  padding-top: 5px;
  width: 40px;
  height: 40px;
  text-align: center;
  border: 1px solid black;
  margin: 5px;
  display: inline-block;
  text-decoration: none;
  color: black;
}
.pagination a:hover {
  color: white;
  background-color: #0a2f64;
}
.filter_name a {
  padding-left: 10px;
}
.active > .page-link,
.page-link.active {
  z-index: 3;
  color: var(--bs-pagination-active-color);
  background-color: #0a2f64;
  border-color: #0a2f64;
}
.dn1 {
  display: none !important;
}
.db {
  display: flex !important;
  margin-left: 7px;
}
.my_fild {
  min-height: 600px !important;
}

/* ========== POP‑UP (already responsive, kept as is) ========== */
.parentPopup {
  display: none;
  align-items: center;
  justify-content: center;
  background-color: #11111175;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10;
}
#emailPopup {
  position: relative;
  width: 35%;
  background: white;
  padding: 40px;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}
.popup-content {
  text-align: center;
}
.popup-content h2 {
  color: #555;
  font-weight: 400;
  font-size: 2.1rem;
  margin-bottom: 0px;
}
.popup-content h3 {
  margin-bottom: 10px;
  color: #666;
  font-weight: 400;
  font-size: 1.5rem;
  margin-bottom: 2rem;
}
#emailForm input {
  padding: 10px;
  margin-bottom: 10px;
  width: 100%;
  border: 1px solid #d5d2d2;
  outline: none;
  border-radius: 4px;
}
#emailForm input::placeholder {
  color: #999 !important;
}
#emailForm input:focus {
  border-bottom: 1px solid #d5d2d2 !important;
}
#emailForm p {
  text-align: center;
  margin-bottom: 0px;
}
#emailForm p a {
  color: #0a2f64;
}
#emailForm button {
  padding: 10px 38px;
  background-color: transparent;
  color: #00afef;
  border: 2.5px solid #00afef;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
}
#emailForm button:hover {
  background-color: #00afef;
  color: #fff;
}
.close-button {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #00afef;
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
}
.close-button:hover {
  background-color: #c62828;
}
@media screen and (max-width: 1500px) {
  #emailPopup { width: 55%; }
}
@media screen and (max-width: 1140px) {
  #emailPopup { width: 55%; }
}
@media screen and (max-width: 820px) {
  #emailPopup { width: 74%; }
}
@media screen and (max-width: 500px) {
  #emailPopup {
    width: 96%;
    padding: 20px;
  }
  .map-location { width: 90%; }
  .popup-content h2 {
    font-size: 1.2rem;
    line-height: 1.2;
  }
  .popup-content h3 {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
  }
  #emailForm p { font-size: 14px; }
  .close-button {
    width: 26px;
    height: 26px;
    right: -5px;
  }
}

/* ========== PDF VIEWER VERTICAL CONTROLS (responsive) ========== */
.pdf-vertical-controls {
  width: 70px;
  min-width: 70px;
  background: #f8f9fa;
  border-right: 1px solid #dee2e6;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.5rem;
  gap: 0.8rem;
  box-shadow: 2px 0 5px rgba(0,0,0,0.02);
}
.btn-page-nav {
  width: 42px;
  height: 42px;
  border: 1px solid #ced4da;
  background: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  color: #0a2f64;
  transition: all 0.15s;
}
.btn-page-nav:hover {
  background: #0a2f64;
  color: white;
  border-color: #0a2f64;
}
.current-page-box {
  width: 50px;
  height: 40px;
  border: 2px solid #0a2f64;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 700;
  font-size: 1.2rem;
  color: #0a2f64;
}
.next-page-preview {
  font-size: 0.9rem;
  color: #6c757d;
  font-weight: 500;
}
.page-total-small {
  font-size: 11px;
  color: #6c757d;
  margin-top: -0.3rem;
}
.pdf-vertical-controls .btn-icon-sm {
  width: 42px;
  height: 42px;
  border: 1px solid #ced4da;
  background: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-size: 1.1rem;
  color: #333;
}
.pdf-vertical-controls .btn-icon-sm:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}
.zoom-label-vertical {
  font-size: 12px;
  margin: 4px 0;
  color: #212529;
  font-weight: 500;
  user-select: none;
}
.pdf-viewer-wrapper {
  flex: 1;
  overflow: auto;
  position: relative;
  background: #fcfcfc;
}

/* ---------- Responsive PDF controls ---------- */
@media (max-width: 768px) {
  .pdf-vertical-controls {
    width: 50px;
    min-width: 50px;
    padding: 0.5rem 0.2rem;
    gap: 0.5rem;
  }
  .btn-page-nav,
  .pdf-vertical-controls .btn-icon-sm {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  .current-page-box {
    width: 40px;
    height: 32px;
    font-size: 1rem;
  }
  .pdf-viewer-wrapper {
    flex: 1;
  }
}
@media (max-width: 480px) {
  /* Optional: convert vertical controls to horizontal bar (uncomment if needed) */
  /*
  .pdf-viewer-with-controls {
    flex-direction: column;
  }
  .pdf-vertical-controls {
    flex-direction: row;
    width: 100%;
    min-width: 100%;
    height: 50px;
    border-right: none;
    border-top: 1px solid #dee2e6;
    overflow-x: auto;
    padding: 0.3rem;
    gap: 0.4rem;
    justify-content: space-around;
  }
  .pdf-vertical-controls hr,
  .pdf-vertical-controls .page-total-small,
  .pdf-vertical-controls .next-page-preview {
    display: none;
  }
  .current-page-box {
    width: 45px;
    height: 30px;
  }
  */
}

/* ========== HEADER & NAVBAR FIXES ========== */
.navbar-nav .dropdown:hover .dropdown-menu {
  display: block;
}
@media (max-width: 991.98px) {
  .navbar-nav .dropdown-menu {
    position: static !important;
    border: none;
    box-shadow: none;
  }
}

/* ========== FOOTER RESPONSIVE IMPROVEMENTS ========== */
@media (max-width: 991.98px) {
  footer .col-lg-4,
  footer .col-lg-2,
  footer .col-lg-1,
  footer .col-lg-3 {
    margin-top: 2rem;
  }
  footer .custom_mar_lefts {
    margin-left: 0 !important;
  }
  footer .map-location {
    margin-top: 2rem;
  }
}
@media (max-width: 767.98px) {
  footer .col-md-6 {
    margin-top: 1.5rem;
  }
  footer .global-map img {
    max-width: 100%;
    height: auto;
  }
}

/* ========== FAQ SECTION ========== */
@media (max-width: 576px) {
  .faq-section .card-body {
    padding: 1rem !important;
  }
  .faq-section .accordion-button {
    font-size: 0.9rem;
  }
}

/* ========== SIDEBAR RELATED ITEMS ========== */
@media (max-width: 575.98px) {
  .related-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .related-thumb {
    width: 100%;
  }
  .related-thumb img {
    width: 100%;
    height: auto;
    max-height: 120px;
  }
}

/* ================================================================
   TABLET / MOBILE (below 992px) – container scroll + LEFT BORDER + SIDEBAR FIXES
   ================================================================ */
@media (max-width: 991.98px) {
    .main-content {
        height: calc(100vh - 140px) !important;
        overflow: hidden !important;
        border-left: 1px solid #e5e7eb;
    }
    #pdfViewerWrapper {
        height: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        flex: 1 1 auto !important;
    }
    #pdfPagesContainer {
        height: 100% !important;
        overflow-y: auto !important;
        padding: 0.5rem 0.75rem;
    }
    .sidebar-col {
        margin-top: 2rem;
    }
    .pdf-search-wrap {
        max-width: 100% !important;
        width: 100%;
    }
    .pdf-viewer-with-controls {
        border-left: none;
    }
    .pdf-vertical-controls {
        margin-left: 1px;
    }

    /* ---------- Sidebar: remove toggle button margin ---------- */
    .sidebar-col .btn.d-lg-none {
        margin-bottom: 0 !important;
    }

    /* ---------- Sidebar title block: flush + sticky just below toggle ---------- */
    .sidebar-col .content-header {
        border-bottom: none !important;
        margin-bottom: 0;
        padding-bottom: 0.5rem;
        top: 2px !important;            /* override JS sticky */
    }

    /* ---------- Sidebar: related docs heading right below title ---------- */
    .sidebar-right h3 {
        margin-top: 0 !important;
    }

    /* ---------- Improved Related Docs (thumbnail + text side by side) ---------- */
    .related-item {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
        text-decoration: none;
        padding: 0.75rem;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        background: #fff;
        transition: box-shadow 0.2s;
        margin-bottom: 0.75rem;
    }
    .related-item:hover {
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    .related-thumb {
        flex-shrink: 0;
        width: 80px;
        height: auto;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .related-thumb img {
        width: 100%;
        height: auto;
        max-height: 100px;
        object-fit: contain;
        border-radius: 4px;
    }
    .related-info {
        flex: 1;
        min-width: 0;
    }
    .related-title {
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 0.25rem;
        color: #212529;
        white-space: normal;
        word-wrap: break-word;
    }
    .related-meta,
    .related-badges {
        font-size: 0.75rem;
        color: #6c757d;
    }
    .related-badges .badge {
        display: inline-block;
        padding: 0.2em 0.5em;
        font-size: 0.65rem;
        border-radius: 10px;
    }
}

/* ================================================================
   SMALLER TABLET (below 768px)
   ================================================================ */
@media (max-width: 767.98px) {
    .main-content {
        height: calc(100vh - 160px) !important;
    }
    .doc-actions-bar .d-flex {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .btn-dl-main-link {
        width: auto;
    }
}

/* ================================================================
   PHONES (below 576px) – ULTRA‑TIGHT LAYOUT
   ================================================================ */
@media (max-width: 575.98px) {
    .main-content {
        height: calc(100vh - 150px) !important;
    }
    #pdfPagesContainer {
        padding: 0.25rem;
    }
    .pdf-vertical-controls {
        width: 36px !important;
        min-width: 36px !important;
        padding: 0.25rem 0.1rem !important;
        gap: 2px !important;
    }
    .btn-page-nav,
    .pdf-vertical-controls .btn-icon-sm {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.75rem !important;
    }
    .current-page-box {
        width: 30px !important;
        height: 26px !important;
        font-size: 0.7rem !important;
    }
    .btn-page-nav i, .btn-icon-sm i {
        font-size: 0.7rem !important;
    }
    .zoom-label-vertical {
        font-size: 0.55rem;
    }

    .doc-actions-bar {
        padding: 0.25rem 0.4rem !important;
    }
    .doc-actions-bar .d-flex {
        flex-wrap: nowrap !important;
        gap: 0.25rem !important;
    }
    .action-group {
        gap: 0.15rem !important;
    }
    .action-btn {
        padding: 2px 4px !important;
        font-size: 0.65rem !important;
    }
    .action-btn i {
        font-size: 0.75rem !important;
    }
    .btn-dl-main-link {
        padding: 0.2rem 0.3rem !important;
        font-size: 0.65rem !important;
    }
    .btn-dl-main-link span.d-none.d-sm-inline {
        display: none !important;
    }
    .pdf-search-wrap .pdf-search-input {
        padding: 0.15rem 0.3rem;
        font-size: 0.7rem;
    }

    #pdfViewerWrapper {
        overflow-x: auto !important;
    }

    .related-item {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    .related-thumb img {
        max-height: 100px;
    }
}