/**
 * Bharat Business Directory — mobile-only responsive layer
 * Desktop styles are unchanged; rules below apply only inside @media (max-width: …)
 */

/* —— Mobile typography (phones only) —— */
@media (max-width: 767px) {
  .btn {
    font-size: 0.8125rem !important;
    line-height: 1.25rem !important;
    padding: 0.375rem 0.65rem !important;
  }

  /* 16px minimum on public/owner forms — prevents iOS Safari zoom on focus */
  select,
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
  textarea {
    font-size: 1rem !important;
    line-height: 1.35 !important;
    padding: 0.5rem 0.75rem !important;
  }

  body.admin-app select,
  body.admin-app input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
  body.admin-app textarea {
    font-size: 0.8125rem !important;
    line-height: 1.25rem !important;
    padding: 0.4rem 0.625rem !important;
  }

  /* Search inputs with leading icons — flex layout in bbd-icon-search.css handles padding */
  input[type="search"].global-search-input {
    padding: 0.5rem 0.75rem !important;
  }

  .directory-page-intro__filters input[type="search"].directory-inline-search__input {
    font-size: 1rem !important;
    line-height: 1.35 !important;
    padding: 0 !important;
  }

  .directory-page-intro__filters .directory-location-filters select.bd-filter-select,
  .directory-page-intro__filters .directory-location-filters .select2-container--default .select2-selection--single.bd-filter-select-selection {
    font-size: 0.875rem !important;
    line-height: 1.5 !important;
    min-height: 2.5rem;
  }

  .directory-page-intro__filters .directory-location-filters .select2-container--default .select2-selection--single.bd-filter-select-selection .select2-selection__rendered {
    font-size: 0.875rem !important;
    line-height: 1.5 !important;
  }

  body.admin-app input[type="search"].admin-search-field__input {
    padding: 0.4rem 0.625rem 0.4rem 2.125rem !important;
  }

  body.font-sans select,
  body.font-sans input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  body.font-sans textarea {
    font-weight: 500 !important;
  }

  .heading-1,
  h1.heading-1 {
    font-size: 1.125rem !important;
    line-height: 1.3 !important;
  }

  .admin-dash__title {
    font-size: 1.25rem !important;
  }

  .admin-export-menu {
    width: 100%;
  }

  .admin-export-menu__trigger {
    width: 100%;
    justify-content: center;
  }

  .businesses-admin-filters {
    gap: 0.5rem !important;
  }

  .businesses-admin-filters__dropdowns {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
  }

  .businesses-admin-filters__dropdowns select {
    min-width: 0;
  }

  table.custom-table thead th,
  table.custom-table tbody td {
    font-size: 0.75rem !important;
  }

  .badge {
    font-size: 0.625rem !important;
    padding: 0.15rem 0.4rem !important;
  }

  .admin-dash-panel__title {
    font-size: 0.875rem !important;
  }

  .admin-dash-panel__desc,
  .admin-dash-pill {
    font-size: 0.6875rem !important;
  }
}

@media (max-width: 639px) {
  .heading-1,
  h1.heading-1 {
    font-size: 1.0625rem !important;
    line-height: 1.25 !important;
  }

  .owner-page-hero__title {
    font-size: 1.125rem !important;
  }

  .owner-header__page-title {
    font-size: 0.9375rem !important;
  }

  .home-search-hero__title {
    font-size: clamp(1.125rem, 4.5vw, 1.5rem) !important;
  }

  .wlb-plans__grid .owner-plan-card__price {
    font-size: clamp(1.375rem, 6vw, 2rem) !important;
  }

  .admin-dash-earnings__amount {
    font-size: clamp(1.375rem, 6vw, 1.875rem) !important;
  }

  .admin-dash-today__total {
    font-size: clamp(1.5rem, 6.5vw, 2rem) !important;
  }

  .faq-trigger,
  .faq-answer {
    font-size: 0.9375rem !important;
  }

  .faq-section__title {
    font-size: 1.0625rem !important;
  }

  .faq-trigger {
    padding: 0.875rem 1rem !important;
  }

  .faq-answer {
    padding: 0 1rem 1rem !important;
  }

  .container {
    padding-left: 0.875rem !important;
    padding-right: 0.875rem !important;
  }

  .site-content {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
}

/* —— Prevent horizontal page scroll on small screens —— */
@media (max-width: 1023px) {
  body {
    overflow-x: clip;
  }

  body.is-mobile-nav-open {
    overflow: hidden;
    touch-action: none;
  }
}

/* —— Public header: hamburger + hide inline nav on tablet/mobile —— */
.site-header__menu-btn,
.owner-header__menu-btn {
  display: none;
}

.site-header__nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.125rem;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.25;
  color: #374151;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition:
    color 0.22s ease,
    border-color 0.22s ease,
    transform 0.22s ease;
}

.site-header__nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #ff9933, var(--bharat-primary), #138808);
  border-radius: 1px;
  transform: translateX(-50%);
  transition: width 0.28s ease;
  pointer-events: none;
}

.site-header__nav-link:hover {
  color: var(--bharat-primary);
  transform: translateY(-1px);
}

.site-header__nav-link:hover::after {
  width: 100%;
}

.site-header__nav-link.is-active {
  color: var(--bharat-primary);
  border-bottom-color: var(--bharat-primary);
}

.site-header__nav-link.is-active::after {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .site-header__nav-link,
  .site-header__nav-link::after {
    transition: none;
  }

  .site-header__nav-link:hover {
    transform: none;
  }
}

@media (min-width: 1024px) {
  .site-header__bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 1.5rem;
  }

  .site-header__nav-link {
    font-size: 0.9375rem;
  }

  .site-header__start {
    justify-self: start;
  }

  .site-header__nav--desktop {
    justify-content: center;
    justify-self: center;
    gap: 1.35rem;
  }

  .site-header__end {
    justify-self: end;
  }
}

@media (max-width: 1023px) {
  .site-header__menu-btn,
  .owner-header__menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    color: #374151;
    background: transparent;
    border: 0;
    border-radius: 0.5rem;
    cursor: pointer;
  }

  .site-header__menu-btn:hover,
  .site-header__menu-btn:focus-visible,
  .owner-header__menu-btn:hover,
  .owner-header__menu-btn:focus-visible {
    color: var(--bharat-primary);
    background: var(--bharat-primary-light);
    outline: none;
  }

  .site-header__menu-btn svg,
  .owner-header__menu-btn svg {
    width: 1.5rem;
    height: 1.5rem;
  }

  .site-header__nav--desktop {
    display: none !important;
  }
}

@media (max-width: 479px) {
  .site-header-cta__long {
    display: none;
  }

  .site-header-cta__short {
    display: inline;
  }

  .site-header-account__title {
    font-size: 0.75rem;
    max-width: 5.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .site-header-account {
    padding: 0.45rem 0.55rem;
    gap: 0.35rem;
  }
}

.site-header-cta__short {
  display: none;
}

/* —— Mobile drawer —— */
.mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgb(15 23 42 / 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-overlay[hidden] {
  display: none !important;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: min(100vw, 20rem);
  max-width: 100%;
  background: #fff;
  box-shadow: 0 12px 40px rgb(15 23 42 / 0.18);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.3s ease, visibility 0.3s ease;
}

.mobile-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.mobile-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 4rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.mobile-drawer__head img {
  height: 2rem;
  width: auto;
}

.mobile-drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  color: #6b7280;
  background: transparent;
  border: 0;
  border-radius: 9999px;
  cursor: pointer;
  line-height: 0;
}

.mobile-drawer__close svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
}

.mobile-drawer__close:hover,
.mobile-drawer__close:focus-visible {
  color: #111827;
  background: #f3f4f6;
  outline: none;
}

.mobile-drawer__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.75rem 0.75rem 1.25rem;
}

.mobile-drawer__links {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.mobile-drawer__link {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 1rem;
  font-weight: 700;
  color: #374151;
  text-decoration: none;
  border-radius: 0.5rem;
}

.mobile-drawer__link:hover,
.mobile-drawer__link.is-active {
  color: var(--bharat-primary);
  background: var(--bharat-primary-light);
}

.mobile-drawer__cta {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.mobile-drawer__cta .site-header-account,
.mobile-drawer__cta .btn-mobile-drawer {
  display: flex;
  width: 100%;
  justify-content: center;
}

.mobile-drawer__cta .locale-switcher {
  display: block;
  width: 100%;
}

.mobile-drawer__cta .locale-switcher__form {
  display: none;
}

@media (max-width: 767px) {
  .owner-header__menu-btn {
    display: inline-flex;
  }

  .owner-header__nav--desktop {
    display: none !important;
  }

  .owner-header__brand img,
  .owner-header__brand--sidebar-mobile img {
    height: 1.625rem;
  }

  .owner-header__bar {
    gap: 0.5rem !important;
  }

  .owner-app:not(.owner-app--no-sidebar) .owner-header__brand--sidebar-mobile .owner-header__brand-label {
    display: none;
  }
}

@media (min-width: 768px) {
  .owner-header__menu-btn {
    display: none;
  }

  .owner-app:not(.owner-app--no-sidebar) .owner-header__menu-btn {
    display: inline-flex;
  }
}

@media (min-width: 1024px) {
  .owner-app:not(.owner-app--no-sidebar) .owner-header__menu-btn {
    display: none;
  }
}

/* —— Admin / owner tables on mobile —— */
@media (max-width: 767px) {
  .overflow-x-auto,
  .table-scroll-wrap,
  .pending-admin-table-wrap,
  .businesses-admin-table-wrap,
  .businesses-admin-table,
  .edit-req-table-wrap,
  .admin-login-index-table-wrap,
  .admin-logs-table-wrap,
  .flex.flex-col > .overflow-x-auto {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  table.custom-table,
  table.min-w-full,
  .admin-login-index-table,
  .admin-login-biz-table,
  .edit-req-table,
  .pending-table,
  .admin-logs-input-table {
    min-width: 34rem;
  }

  .businesses-admin-table .businesses-table {
    min-width: 0 !important;
  }

  .admin-segment-tabs,
  .admin-export-menu__trigger {
    max-width: 100%;
  }
}

@media (max-width: 479px) {
  .biz-engagement__periods {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .biz-engagement__periods button {
    font-size: 0.6875rem;
    padding: 0.45rem 0.25rem;
  }

  .owner-biz-grid .owner-biz-card__actions {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

@media (max-width: 639px) {
  .business-desc-editor .ql-toolbar.ql-snow {
    display: flex;
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.35rem !important;
  }

  .business-desc-editor .ql-toolbar.ql-snow .ql-formats {
    margin-right: 0.35rem;
    margin-bottom: 0.15rem;
  }

  .category-picker-drawer__panel {
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 1023px) {
  .home-reels__track,
  .home-featured-businesses__track,
  .home-states-section__track,
  .home-featured-products__track,
  .home-category-strip__track {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
}

/* —— Public header: reduce crowding on phones —— */
@media (max-width: 767px) {
  .site-header__end .locale-switcher,
  .owner-header__end .locale-switcher {
    display: none;
  }

  .site-header__end {
    min-width: 0;
    flex-shrink: 1;
    gap: 0.35rem !important;
  }

  .site-header__start {
    min-width: 0;
  }

  .global-search-trigger {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
  }
}

@media (max-width: 399px) {
  .site-header__end .global-search-trigger {
    display: none;
  }
}

/* —— Owner header: allow shrink on small screens —— */
@media (max-width: 767px) {
  .owner-header__end {
    min-width: 0;
    flex-shrink: 1;
  }

  .owner-header__brand-label {
    max-width: 7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* —— User-facing mobile typography (owner + public; desktop sizes unchanged) —— */
@media (max-width: 767px) {
  body:not(.admin-app).font-sans,
  .owner-app {
    font-size: 0.9375rem;
    line-height: 1.5;
  }

  .owner-app .owner-page-hero__title {
    font-size: 1.3125rem !important;
    line-height: 1.25 !important;
  }

  .owner-app .owner-page-hero__desc {
    font-size: 0.8125rem !important;
  }

  .owner-app .owner-section-head__title {
    font-size: 1rem !important;
  }

  .owner-app .owner-section-head__desc {
    font-size: 0.75rem !important;
  }

  .owner-app .owner-content {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
  }

  .directory-page-intro__title {
    font-size: 1.25rem !important;
  }

  .directory-page-intro__desc {
    font-size: 0.8125rem !important;
  }

  .owner-contact-verify__title {
    font-size: 0.9375rem !important;
  }

  .owner-contact-verify__desc,
  .owner-contact-verify__label {
    font-size: 0.75rem !important;
  }

  .owner-plan-card__name {
    font-size: 1.125rem !important;
  }

  .owner-plan-card__tagline,
  .owner-plan-card__doc-rule {
    font-size: 0.75rem !important;
  }

  .mobile-drawer__link {
    font-size: 0.9375rem;
    min-height: 2.625rem;
  }
}

@media (max-width: 639px) {
  .owner-app .owner-page-hero__title {
    font-size: 1.1875rem !important;
  }

  .directory-page-intro__title {
    font-size: 1.125rem !important;
  }

  .owner-header__page-title {
    font-size: 0.875rem !important;
  }

  .owner-settings-intro__title,
  .owner-settings-visibility__title,
  .owner-sticky-settings__title {
    font-size: 1rem !important;
  }

  .owner-settings-intro__meta,
  .owner-settings-visibility__intro,
  .owner-settings-option__desc,
  .owner-settings-panel__text {
    font-size: 0.8125rem !important;
  }

  .owner-biz-page__title,
  .owner-biz-page--with-sidebar .owner-biz-page__title {
    font-size: 1.125rem !important;
  }

  .owner-biz-page__back {
    font-size: 0.8125rem !important;
  }

  body.admin-app .admin-dash__title {
    font-size: 1.125rem !important;
  }

  body.admin-app .settings-hub__title-page {
    font-size: 1.125rem !important;
  }

  body.admin-app .settings-hub__title {
    font-size: 0.875rem !important;
  }

  body.admin-app .settings-hub__desc,
  body.admin-app .settings-hub__subtitle {
    font-size: 0.75rem !important;
  }

  body.admin-app .container {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
}
