/*
 * Mobile portal layer.
 * Scoped to logged-in mentee/mentor portal pages via body_class in functions.php.
 * Staff/admin and the public home page are intentionally outside this scope.
 */

@media (max-width: 1024px) {
  body.match-portal-mobile:not(.match-role-staff) .container {
    max-width: 100%;
    padding: 22px 16px;
  }

  body.match-portal-mobile:not(.match-role-staff) .header-inner {
    gap: 16px;
    padding: 16px;
  }

  body.match-portal-mobile:not(.match-role-staff) .brand-logo {
    width: min(280px, 58vw);
  }

  body.match-portal-mobile:not(.match-role-staff) .app-menu {
    gap: 8px;
    margin-left: 0;
  }

  body.match-portal-mobile:not(.match-role-staff) .app-menu__link {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    padding: 9px 12px;
  }

  body.match-portal-mobile:not(.match-role-staff) .card {
    padding: 22px;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfs_shell,
  body.match-portal-mobile:not(.match-role-staff) .mpw_shell {
    width: 100%;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfc-two-col-section,
  body.match-portal-mobile:not(.match-role-staff) .mpc-two-col-section {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  body.match-portal-mobile:not(.match-role-staff) {
    background: #eef3f8;
  }

  body.match-portal-mobile:not(.match-role-staff) .site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .08);
  }

  body.match-portal-mobile:not(.match-role-staff) .header-inner {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 12px 14px;
  }

  body.match-portal-mobile:not(.match-role-staff) .brand-logo-link {
    justify-content: center;
  }

  body.match-portal-mobile:not(.match-role-staff) .brand-logo {
    width: min(260px, 82vw);
  }

  body.match-portal-mobile:not(.match-role-staff) .app-menu {
    width: 100%;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 2px 2px 8px;
    margin: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  body.match-portal-mobile:not(.match-role-staff) .app-menu::-webkit-scrollbar {
    display: none;
  }

  body.match-portal-mobile:not(.match-role-staff) .app-menu__link {
    flex: 0 0 auto;
    min-height: 44px;
    border: 1px solid #dbe4ef;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 14px;
    white-space: nowrap;
    text-decoration: none;
  }

  body.match-portal-mobile:not(.match-role-staff) .app-menu__link.is-active {
    border-color: rgba(67, 56, 202, .22);
    background: #eef2ff;
    color: var(--mt-indigo, #4338ca);
  }

  body.match-portal-mobile:not(.match-role-staff) .auth-menu,
  body.match-portal-mobile:not(.match-role-staff) .app-menu__right {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  body.match-portal-mobile:not(.match-role-staff) .app-menu__right {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
  }

  body.match-portal-mobile:not(.match-role-staff) .mnr-user-info {
    width: 100%;
    align-items: center;
    border-bottom-width: 1px !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .container {
    padding: 14px 12px 24px;
  }

  body.match-portal-mobile:not(.match-role-staff) .card {
    width: 100% !important;
    max-width: none !important;
    padding: 18px;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .08);
  }

  body.match-portal-mobile:not(.match-role-staff) .card .card {
    padding: 16px;
    box-shadow: none;
  }

  body.match-portal-mobile:not(.match-role-staff) h1 {
    font-size: 26px;
    line-height: 1.15;
  }

  body.match-portal-mobile:not(.match-role-staff) h2 {
    font-size: 22px;
    line-height: 1.2;
  }

  body.match-portal-mobile:not(.match-role-staff) h3 {
    font-size: 18px;
    line-height: 1.25;
  }

  body.match-portal-mobile:not(.match-role-staff) .grid,
  body.match-portal-mobile:not(.match-role-staff) .dashboard-grid,
  body.match-portal-mobile:not(.match-role-staff) .mfs_form_grid,
  body.match-portal-mobile:not(.match-role-staff) .mpw_form_grid {
    grid-template-columns: 1fr !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .dashboard-tile {
    min-height: 96px;
    padding: 18px;
    border-radius: 14px;
  }

  body.match-portal-mobile:not(.match-role-staff) .btn,
  body.match-portal-mobile:not(.match-role-staff) .button,
  body.match-portal-mobile:not(.match-role-staff) button,
  body.match-portal-mobile:not(.match-role-staff) input[type="submit"] {
    min-height: 44px;
    touch-action: manipulation;
  }

  body.match-portal-mobile:not(.match-role-staff) input[type="text"],
  body.match-portal-mobile:not(.match-role-staff) input[type="email"],
  body.match-portal-mobile:not(.match-role-staff) input[type="password"],
  body.match-portal-mobile:not(.match-role-staff) input[type="tel"],
  body.match-portal-mobile:not(.match-role-staff) input[type="number"],
  body.match-portal-mobile:not(.match-role-staff) input[type="date"],
  body.match-portal-mobile:not(.match-role-staff) input[type="file"],
  body.match-portal-mobile:not(.match-role-staff) select,
  body.match-portal-mobile:not(.match-role-staff) textarea {
    max-width: 100%;
    font-size: 16px;
  }

  body.match-portal-mobile:not(.match-role-staff) form {
    max-width: 100% !important;
  }

  body.match-portal-mobile:not(.match-role-staff) form[style*="display:inline"] {
    display: inline-flex !important;
    margin-top: 8px;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfs_page,
  body.match-portal-mobile:not(.match-role-staff) .mpw_page {
    min-height: auto !important;
    padding: 10px !important;
    background: #eef3f8 !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfs_shell,
  body.match-portal-mobile:not(.match-role-staff) .mpw_shell {
    min-height: auto !important;
    max-height: none !important;
    border-radius: 18px !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfs_header,
  body.match-portal-mobile:not(.match-role-staff) .mfs_body,
  body.match-portal-mobile:not(.match-role-staff) .mfs_footer,
  body.match-portal-mobile:not(.match-role-staff) .mpw_header,
  body.match-portal-mobile:not(.match-role-staff) .mpw_body,
  body.match-portal-mobile:not(.match-role-staff) .mpw_footer {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfs_title,
  body.match-portal-mobile:not(.match-role-staff) .mpw_title {
    font-size: 28px !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfs_form_card,
  body.match-portal-mobile:not(.match-role-staff) .mpw_form_card {
    width: 100% !important;
    padding: 18px !important;
    border-radius: 16px !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfs_footer,
  body.match-portal-mobile:not(.match-role-staff) .mpw_footer {
    flex-direction: column-reverse !important;
    align-items: stretch !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfs_footer_left,
  body.match-portal-mobile:not(.match-role-staff) .mfs_footer_right,
  body.match-portal-mobile:not(.match-role-staff) .mpw_footer_left,
  body.match-portal-mobile:not(.match-role-staff) .mpw_footer_right {
    width: 100% !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfs_btn,
  body.match-portal-mobile:not(.match-role-staff) .mpw_btn {
    width: 100% !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfr_dual_wrap {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfr_selected,
  body.match-portal-mobile:not(.match-role-staff) .mfr_available {
    min-width: 0 !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .widefat {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
  }

  body.match-portal-mobile:not(.match-role-staff) .widefat thead {
    display: none;
  }

  body.match-portal-mobile:not(.match-role-staff) .widefat tbody,
  body.match-portal-mobile:not(.match-role-staff) .widefat tr,
  body.match-portal-mobile:not(.match-role-staff) .widefat td {
    display: block;
    width: 100%;
  }

  body.match-portal-mobile:not(.match-role-staff) .widefat tr {
    margin: 0 0 14px;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
  }

  body.match-portal-mobile:not(.match-role-staff) .widefat td {
    padding: 8px 0;
    border: 0;
  }

  body.match-portal-mobile:not(.match-role-staff) .widefat td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--mt-indigo, #4338ca);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
  }

  body.match-portal-mobile:not(.match-role-staff) .widefat td:not([data-label])::before,
  body.match-portal-mobile:not(.match-role-staff) .widefat td[data-label=""]::before {
    display: none;
  }

  body.match-portal-mobile:not(.match-role-staff) .tabulator {
    border: 0;
    background: transparent;
  }

  body.match-portal-mobile:not(.match-role-staff) .tabulator .tabulator-header {
    display: none;
  }

  body.match-portal-mobile:not(.match-role-staff) .tabulator .tabulator-tableholder {
    overflow: visible !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .tabulator .tabulator-row {
    display: block;
    width: 100% !important;
    min-height: 0 !important;
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
  }

  body.match-portal-mobile:not(.match-role-staff) .tabulator .tabulator-cell {
    display: block;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 7px 0 !important;
    border-right: 0 !important;
    white-space: normal !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .tabulator .tabulator-cell[tabulator-field]::before {
    content: attr(tabulator-field);
    display: block;
    margin-bottom: 2px;
    color: var(--mt-indigo, #4338ca);
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
  }

  body.match-portal-mobile:not(.match-role-staff) .tabulator .tabulator-footer {
    border: 0;
    background: transparent;
  }

  body.match-portal-mobile:not(.match-role-staff) .tabulator .tabulator-paginator {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }

  body.match-portal-mobile:not(.match-role-staff) .mpc-profile-table,
  body.match-portal-mobile:not(.match-role-staff) .mfc-profile-table {
    grid-template-columns: 1fr !important;
    gap: 3px 0 !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .mpc-profile-table > .muted,
  body.match-portal-mobile:not(.match-role-staff) .mfc-profile-table > .muted {
    margin-top: 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .02em;
  }

  body.match-portal-mobile:not(.match-role-staff) .mpc-profile-table > .muted + div,
  body.match-portal-mobile:not(.match-role-staff) .mfc-profile-table > .muted + div {
    padding-bottom: 8px;
    border-bottom: 1px solid #eef2f7;
  }

  body.match-portal-mobile:not(.match-role-staff) .fc {
    font-size: 12px;
  }

  body.match-portal-mobile:not(.match-role-staff) .fc .fc-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  body.match-portal-mobile:not(.match-role-staff) .fc .fc-toolbar-chunk {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  body.match-portal-mobile:not(.match-role-staff) .fc .fc-button {
    min-height: 38px;
    padding: 6px 10px;
  }

  body.match-portal-mobile:not(.match-role-staff) [id*="map"],
  body.match-portal-mobile:not(.match-role-staff) [id*="Map"] {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  body.match-portal-mobile:not(.match-role-staff) .container {
    padding: 10px 8px 20px;
  }

  body.match-portal-mobile:not(.match-role-staff) .card {
    padding: 14px;
    border-radius: 12px;
  }

  body.match-portal-mobile:not(.match-role-staff) .brand-logo {
    width: min(230px, 86vw);
  }

  body.match-portal-mobile:not(.match-role-staff) .app-menu__link {
    min-height: 42px;
    padding: 8px 11px;
    font-size: 13px;
  }

  body.match-portal-mobile:not(.match-role-staff) .auth-menu a {
    font-size: 13px;
  }

  body.match-portal-mobile:not(.match-role-staff) h1 {
    font-size: 23px;
  }

  body.match-portal-mobile:not(.match-role-staff) h2 {
    font-size: 20px;
  }

  body.match-portal-mobile:not(.match-role-staff) .btn,
  body.match-portal-mobile:not(.match-role-staff) .button {
    width: 100%;
    justify-content: center;
  }

  body.match-portal-mobile:not(.match-role-staff) form[style*="display:inline"] {
    width: 100%;
  }

  body.match-portal-mobile:not(.match-role-staff) form[style*="display:inline"] .btn,
  body.match-portal-mobile:not(.match-role-staff) form[style*="display:inline"] .button,
  body.match-portal-mobile:not(.match-role-staff) form[style*="display:inline"] button {
    width: 100%;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfs_title,
  body.match-portal-mobile:not(.match-role-staff) .mpw_title {
    font-size: 24px !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .mfs_header,
  body.match-portal-mobile:not(.match-role-staff) .mfs_body,
  body.match-portal-mobile:not(.match-role-staff) .mfs_footer,
  body.match-portal-mobile:not(.match-role-staff) .mpw_header,
  body.match-portal-mobile:not(.match-role-staff) .mpw_body,
  body.match-portal-mobile:not(.match-role-staff) .mpw_footer {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  body.match-portal-mobile:not(.match-role-staff) .widefat tr,
  body.match-portal-mobile:not(.match-role-staff) .tabulator .tabulator-row {
    padding: 12px;
    border-radius: 12px;
  }
}
