/* Businfo App 1.2.0-beta1 — public UI hardening for Businfo 4.7.4. */

/* Shared public-view safety: component content must never enlarge the viewport. */
.bi-shell-public.is-businfo-page .bi-main-column,
.bi-shell-public.is-businfo-page .bi-main-content,
.bi-shell-public.is-businfo-page .bi-main-content > *,
.bi-shell-public.is-businfo-page .container,
.bi-shell-public.is-businfo-page .bi-public-page,
.bi-shell-public.is-businfo-page .bi-entity-container,
.bi-shell-public.is-businfo-page .bi-collection-container,
.bi-shell-public.is-businfo-page .bi-search-container {
  min-width: 0;
  max-width: 100%;
}

.bi-shell-public.is-businfo-page .bi-main-content {
  overflow-wrap: anywhere;
}

.bi-shell-public.is-businfo-page pre,
.bi-shell-public.is-businfo-page code,
.bi-shell-public.is-businfo-page .table-responsive {
  max-width: 100%;
}

.bi-shell-public.is-businfo-page pre {
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.bi-shell-public.is-businfo-page .btn,
.bi-shell-public.is-businfo-page button,
.bi-shell-public.is-businfo-page input,
.bi-shell-public.is-businfo-page select,
.bi-shell-public.is-businfo-page textarea {
  max-width: 100%;
}

/* Focused public flows keep the global shell but remove fixed navigation pressure. */
.is-focused-public-flow.bi-shell-public {
  padding-bottom: 0;
}

.is-focused-public-flow .bi-content-grid {
  padding-top: clamp(.75rem, 2vw, 1.5rem);
}

/* Home */
.view-home .bus-home-wrapper,
.view-home .home-hero-grid,
.view-home .home-search-column,
.view-home .businfo-search-shell,
.view-home .businfo-search-grid {
  min-width: 0;
  max-width: 100%;
}

.view-home .home-section-head > *,
.view-home .recommended-company-body,
.view-home .route-card-body {
  min-width: 0;
}

/* Public entity pages */
.view-company .company-section-nav,
.view-companyseopage .company-section-nav,
.view-route .bi-entity-nav,
.view-location .bi-entity-nav {
  scrollbar-width: thin;
  scroll-padding-inline: 1rem;
}

.view-company .company-trip-main,
.view-company .company-trip-title,
.view-company .company-trip-stations,
.view-route .businfo-trip-main,
.view-route .businfo-trip-summary,
.view-location .location-trip-company,
.view-location .location-trip-route,
.view-search .trip-company-block,
.view-search .trip-route-link {
  min-width: 0;
  overflow-wrap: anywhere;
}

.view-company .company-mobile-cta {
  /* The bottom offset already includes the template bottom navigation height. */
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

.view-route .businfo-fare-table,
.view-lookup .table {
  width: 100%;
}

.view-route .businfo-card-body,
.view-route .businfo-filter-panel,
.view-search .search-filter-panel,
.view-search .trip-card,
.view-location .location-section,
.view-companies .bi-company-card,
.view-company .company-section-card,
.view-companyseopage .company-section-card {
  min-width: 0;
}

/* Search and lookup */
.view-search .search-booking-drawer,
.view-company .company-booking-drawer,
.view-route .businfo-booking-drawer {
  padding-bottom: max(var(--bi-safe-bottom), var(--bi-keyboard-inset));
  overscroll-behavior: contain;
}

.view-search .search-drawer-trip,
.view-company .company-drawer-trip,
.view-route .businfo-drawer-trip {
  min-width: 0;
}

.view-lookup .card,
.view-lookup .card-body,
.view-lookup form {
  min-width: 0;
  max-width: 100%;
}

/* Authentication and onboarding */
.view-login .bi-auth-shell,
.view-signup .bi-auth-shell,
.view-passwordreset .bi-auth-shell,
.view-register .registration-page,
.view-register .wizard-card {
  min-width: 0;
  max-width: 100%;
}

.view-login .bi-auth-label-row,
.view-signup .bi-auth-label-row,
.view-passwordreset .bi-auth-label-row {
  flex-wrap: wrap;
}

.view-login .bi-auth-actions .btn,
.view-signup .bi-auth-actions .btn,
.view-passwordreset .bi-auth-actions .btn {
  min-width: 0;
}

/* Mobile: 320–767px */
@media (max-width: 767px) {
  .bi-shell-public.is-businfo-page .bi-content-grid {
    width: 100%;
    padding-inline: 0;
    padding-top: .75rem;
  }

  .bi-shell-public.is-businfo-page .bi-breadcrumbs {
    width: calc(100% - 1.5rem);
    padding-top: .65rem;
  }

  .view-home .bus-hero .container,
  .view-home .home-section .container,
  .view-search .businfo-search-results,
  .view-lookup .container,
  .view-company .businfo-company-container,
  .view-companyseopage .businfo-company-container,
  .view-route .businfo-route-container {
    width: calc(100% - 1.5rem);
    margin-inline: auto;
  }

  .view-home .home-section-head,
  .view-company .company-section-heading,
  .view-companyseopage .company-section-heading,
  .view-location .location-section-heading,
  .view-search .search-overview {
    gap: .75rem;
  }

  .view-home .home-stat-grid,
  .view-company .company-kpi-grid,
  .view-location .location-summary-grid,
  .view-route .businfo-quick-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view-company .company-kpi-grid > *,
  .view-location .location-summary-grid > *,
  .view-route .businfo-quick-facts > * {
    min-width: 0;
  }

  .view-company .company-trip-side,
  .view-search .trip-price-block,
  .view-search .trip-booking-action,
  .view-route .businfo-trip-side,
  .view-location .location-trip-price,
  .view-location .location-booking-button {
    min-width: 0;
    width: 100%;
    text-align: start;
  }

  .view-company .company-trip-side,
  .view-location .location-trip-card {
    align-items: stretch;
  }

  .view-company .company-trip-side .btn,
  .view-search .trip-booking-action .btn,
  .view-route .businfo-trip-side .btn,
  .view-location .location-booking-button .btn {
    width: 100%;
    min-width: 0;
  }

  .view-route .businfo-card-header,
  .view-route .businfo-filter-topbar,
  .view-search .search-drawer-header,
  .view-company .company-drawer-header,
  .view-location .location-section-heading {
    flex-wrap: wrap;
  }

  .view-route .businfo-fare-table,
  .view-lookup .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .view-lookup .card-body.p-md-5,
  .view-lookup .card-header.p-4,
  .view-register .wizard-card {
    padding: 1rem !important;
  }

  .view-login .bi-auth-page,
  .view-signup .bi-auth-page,
  .view-passwordreset .bi-auth-page {
    min-height: auto;
  }

  .view-login .bi-auth-shell,
  .view-signup .bi-auth-shell,
  .view-passwordreset .bi-auth-shell {
    min-height: auto;
  }

  .view-register .wizard-steps li {
    min-width: 0;
  }

  .view-register .wizard-steps b {
    flex: 0 0 auto;
  }
}

/* Very narrow phones: 320–359px */
@media (max-width: 359px) {
  .bi-template-container {
    width: calc(100% - 1rem);
  }

  .bi-header-inner {
    gap: .15rem;
  }

  .bi-brand {
    max-width: 104px;
  }

  .bi-brand img {
    max-width: 100px;
    height: 34px;
  }

  .bi-header-actions {
    gap: .05rem;
  }

  .bi-icon-button,
  .bi-header-chip,
  .bi-user-chip {
    width: 42px;
    height: 42px;
    min-height: 42px;
  }

  .bi-public-bottom-nav a {
    font-size: .6rem;
    padding-inline: .1rem;
  }

  .view-company .company-actions,
  .view-location .bi-entity-actions,
  .view-route .bi-entity-actions,
  .view-companyseopage .company-chip-row {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .view-company .company-actions .btn,
  .view-location .bi-entity-actions .btn,
  .view-route .bi-entity-actions .btn {
    width: 100%;
  }

  .view-login .bi-auth-panel-inner,
  .view-signup .bi-auth-panel-inner,
  .view-passwordreset .bi-auth-panel-inner,
  .view-signup .bi-signup-form-pane {
    padding-inline: .8rem;
  }
}

/* Tablet: 768–1023px */
@media (min-width: 768px) and (max-width: 1023px) {
  .bi-shell-public.is-businfo-page .bi-content-grid {
    padding-top: 1.25rem;
  }

  .view-home .home-route-grid,
  .view-home .recommended-company-grid,
  .view-companies .bi-company-card-grid,
  .view-locations .locations-index-grid,
  .view-location .location-company-grid,
  .view-location .location-node-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view-company .company-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .view-route .businfo-filter-grid,
  .view-search .search-advanced-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view-register .registration-page {
    width: min(calc(100% - 2rem), 980px);
  }
}

/* Small laptop: preserve useful content width without forcing desktop navigation early. */
@media (min-width: 1024px) and (max-width: 1199px) {
  .bi-template-container,
  .bi-shell-public .container {
    width: min(calc(100% - 2.5rem), var(--bi-template-page-max));
  }

  .view-home .home-route-grid,
  .view-home .recommended-company-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Desktop: stable reading width while allowing wide data views. */
@media (min-width: 1200px) {
  .view-login .bi-auth-shell,
  .view-signup .bi-auth-shell,
  .view-passwordreset .bi-auth-shell {
    margin-inline: auto;
  }

  .view-lookup .container {
    max-width: 920px;
  }
}
