/**
 * L-Pass global responsive layer
 * Loaded on every frontend page via master layout.
 */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
  position: relative;
}

img,
video,
svg,
canvas,
iframe {
  max-width: 100%;
  height: auto;
}

table {
  max-width: 100%;
}

/* Keep Bootstrap containers usable on phones (overrides old style.css margin hack) */
@media (max-width: 767.98px) {
  .container,
  .container-sm,
  .container-md,
  .container-lg,
  .container-xl,
  .container-xxl {
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    width: 100%;
    max-width: 100%;
  }

  .row {
    margin-left: -8px;
    margin-right: -8px;
  }

  .row > [class*="col-"] {
    padding-left: 8px;
    padding-right: 8px;
  }

  /* Forms & buttons */
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  select,
  textarea,
  .form-control,
  .form-select {
    max-width: 100%;
  }

  .btn,
  button.btn {
    max-width: 100%;
  }

  /* Tables: prefer scroll wrappers; don't force display:block on every table */
  .table-responsive,
  .lp-table-wrap,
  .dataTables_wrapper {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    max-width: 100%;
  }

  /* Common fixed-width cards / grids */
  .card,
  .modal-dialog {
    max-width: calc(100% - 24px);
  }

  /* Travel hero shared across flights/hotels */
  .travel-page-hero {
    min-height: auto !important;
    padding: 48px 0 72px !important;
  }

  .travel-page-hero h1 {
    line-height: 1.15;
  }

  .travel-page-hero p {
    max-width: 100%;
  }

  .travel-page-hero-actions {
    flex-wrap: wrap;
    gap: 10px;
  }

  .travel-page-hero-btn,
  .travel-page-hero-badge {
    max-width: 100%;
  }

  /* Mode tabs (flights / hotels) */
  .flight-mode-tabs,
  .hotel-mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .flight-mode-tab,
  .hotel-mode-tab {
    flex: 1 1 140px;
    min-width: 0;
    justify-content: center;
    text-align: center;
  }

  /* Search cards */
  .flight-search-card,
  .hotel-search-card,
  .tp-hotel-card {
    border-radius: 16px;
    overflow: visible;
  }

  .flight-search-card > *,
  .hotel-search-card > *,
  .tp-hotel-card > * {
    margin-left: 12px !important;
    margin-right: 12px !important;
  }
}

@media (max-width: 575.98px) {
  .container,
  .container-sm {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .flight-mode-tab,
  .hotel-mode-tab {
    flex: 1 1 100%;
  }

  .tbo-flight-main,
  .tbo-timeline {
    grid-template-columns: 1fr !important;
  }

  .tbo-price-side {
    text-align: left !important;
  }

  .tbo-see-more-btn {
    min-width: 0 !important;
    width: 100%;
  }

  .hotel-form-grid {
    grid-template-columns: 1fr !important;
  }

  .hotel-col-5,
  .hotel-col-4,
  .hotel-col-6,
  .hotel-col-3,
  .hotel-col-2,
  .hotel-col-12 {
    grid-column: span 1 !important;
  }

  .tp-hotel-grid {
    grid-template-columns: 1fr !important;
  }

  .hotel-search-btn,
  .tp-hotel-btn,
  .flight-search-btn {
    width: 100% !important;
  }
}

/* Tablet */
@media (max-width: 991.98px) {
  .flight-deal-grid,
  .flight-widget-grid,
  .flight-partner-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .tbo-results-layout {
    grid-template-columns: 1fr !important;
  }

  .tbo-filter-panel {
    position: static !important;
  }
}

@media (max-width: 767.98px) {
  .flight-deal-grid,
  .flight-widget-grid,
  .flight-partner-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Membership / generic content sections */
@media (max-width: 767.98px) {
  .membership-grid,
  .plans-grid,
  .services-grid,
  .lounge-grid,
  .card-grid {
    grid-template-columns: 1fr !important;
  }

  section .row > [class*="col-"] {
    margin-bottom: 1rem;
  }

  .d-flex.gap-3,
  .d-flex.gap-4 {
    flex-wrap: wrap;
  }
}

/* Prevent absolute dropdowns from causing page overflow on small screens */
@media (max-width: 640px) {
  .dropdown-menu {
    max-width: calc(100% - 24px);
  }
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}
