/* IAM Connect X Mobile-First Responsive Patch */

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

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
}

body {
  -webkit-text-size-adjust: 100%;
}

img,
video,
iframe,
svg {
  max-width: 100% !important;
  height: auto;
}

table {
  max-width: 100%;
}

.container,
.container-fluid,
main,
section,
header,
footer,
.card,
.dashboard,
.dashboard-content,
.content,
.page,
.wrapper,
.row {
  max-width: 100% !important;
}

.row,
.d-flex,
.flex,
.nav,
.navbar,
.cards,
.card-row,
.dashboard-grid,
.stats-grid,
.marketplace-grid,
.worker-grid,
.profile-grid,
.admin-grid {
  flex-wrap: wrap !important;
}

input,
select,
textarea,
button,
.btn,
.form-control,
.form-select {
  max-width: 100% !important;
}

.worker-card,
.profile-card,
.marketplace-card,
.card {
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.worker-card img,
.profile-card img,
.marketplace-card img,
.card img,
.worker-photo,
.profile-photo,
.avatar,
.profile-image {
  width: 100% !important;
  max-width: 100% !important;
  object-fit: cover;
  display: block;
}

.worker-image-wrap,
.profile-image-wrap,
.card-img-wrap,
.marketplace-image-wrap {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: 16px;
}

.worker-grid,
.marketplace-grid,
.profile-list,
.cards-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
  gap: 1rem;
  width: 100%;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .container,
  .container-fluid,
  main,
  section,
  .page,
  .content,
  .dashboard-content {
    width: 100% !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  [class*="col-"] {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }

  .card,
  .worker-card,
  .profile-card,
  .marketplace-card,
  .dashboard-card,
  .stat-card {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 18px;
  }

  .worker-grid,
  .marketplace-grid,
  .profile-list,
  .cards-grid,
  .dashboard-grid,
  .stats-grid,
  .admin-grid {
    grid-template-columns: 1fr !important;
  }

  .worker-card img,
  .profile-card img,
  .marketplace-card img,
  .worker-photo,
  .profile-photo,
  .avatar,
  .profile-image {
    height: 230px !important;
    object-fit: cover !important;
    border-radius: 16px;
  }

  .btn,
  button,
  input[type="submit"],
  input[type="button"] {
    width: 100%;
    min-height: 44px;
    margin-top: 6px;
    margin-bottom: 6px;
    white-space: normal;
  }

  input,
  select,
  textarea,
  .form-control,
  .form-select {
    width: 100% !important;
    font-size: 16px !important;
  }

  .navbar-nav,
  .nav,
  .dashboard-nav,
  .sidebar,
  aside {
    width: 100% !important;
    max-width: 100% !important;
  }

  .sidebar,
  aside {
    position: relative !important;
    height: auto !important;
  }

  h1 {
    font-size: 1.8rem !important;
  }

  h2 {
    font-size: 1.5rem !important;
  }

  h3 {
    font-size: 1.25rem !important;
  }

  .hero,
  .hero-section {
    padding: 36px 14px !important;
  }

  .hero .btn,
  .cta .btn,
  .actions .btn,
  .profile-actions .btn,
  .worker-actions .btn {
    display: block;
    width: 100%;
  }

  .table,
  table {
    min-width: 640px;
  }
}

@media (min-width: 769px) and (max-width: 1100px) {
  .worker-grid,
  .marketplace-grid,
  .profile-list,
  .cards-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr)) !important;
  }
}
